/* ── Roshi Admin — minimal dark UI ────────────────────────────────────── */
:root {
  --bg:        #0d0d0d;
  --surface:   #161616;
  --border:    #2a2a2a;
  --text:      #e8e0d5;
  --muted:     #8a8070;
  --accent:    #c9a96e;  /* warm saffron */
  --success:   #7bae7f;
  --error:     #c97070;
  --radius:    10px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.screen { width: 100%; }
.hidden { display: none !important; }

/* ── Auth ───────────────────────────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.center-card {
  max-width: 400px;
  text-align: center;
}

.logo {
  font-size: 48px;
  margin-bottom: 16px;
}

h1 { font-size: 28px; font-weight: 600; margin-bottom: 8px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

/* ── App Shell ──────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-sm { font-size: 18px; font-weight: 600; }

.user-bar { display: flex; align-items: center; gap: 12px; }

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Form ───────────────────────────────────────────────────────────────── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-row .field { margin-bottom: 0; }

label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="text"],
input[type="number"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
  transition: border-color .15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── File drop ──────────────────────────────────────────────────────────── */
.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background: rgba(201, 169, 110, 0.04);
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

#file-label {
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* ── Progress ───────────────────────────────────────────────────────────── */
#upload-progress-wrap { margin-bottom: 16px; }

.progress-bar-bg {
  background: var(--border);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width .2s ease;
}

.small { font-size: 12px; }

/* ── Buttons ─────────────────────────────────────────────────────────────  */
.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 11px 24px;
  font-size: 15px;
  cursor: pointer;
  transition: opacity .15s;
  width: 100%;
}

.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.small { padding: 5px 10px; font-size: 12px; }

.btn-delete {
  background: transparent;
  border: 1px solid rgba(220, 80, 60, 0.35);
  color: #c0392b;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-delete:hover { background: rgba(220, 80, 60, 0.08); border-color: #c0392b; }
.btn-delete:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Messages ────────────────────────────────────────────────────────────  */
.muted { color: var(--muted); }
.error { color: var(--error); font-size: 13px; margin-top: 10px; }
.success { color: var(--success); font-size: 13px; margin-top: 10px; }
.center { text-align: center; }

/* ── Table ───────────────────────────────────────────────────────────────  */
.table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.table-header h2 { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

td.r2-key { font-family: monospace; font-size: 11px; color: var(--muted); word-break: break-all; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green { background: rgba(123, 174, 127, 0.15); color: var(--success); }
.badge-gray  { background: rgba(138, 128, 112, 0.15); color: var(--muted); }
.badge-blue  { background: rgba(110, 160, 201, 0.15); color: #6ea0c9; }
.badge-gold  { background: rgba(200, 160, 60, 0.15);  color: #c8a03c; }

.checkbox-group { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }

@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; }
  header { padding: 12px 16px; }
  main { padding: 20px 14px 50px; }
  .card { padding: 18px; }
}
