/* ============================================================
   betburger-multilogin — admin UI stylesheet
   Light + dark (follows the OS via prefers-color-scheme).
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg:            #f4f5f7;
  --surface:       #ffffff;
  --surface-2:     #f8f9fb;
  --border:        #e4e7ec;
  --border-strong: #d0d5dd;

  --text:          #1a2233;
  --text-muted:    #667085;
  --text-faint:    #98a2b3;

  --primary:       #2563eb;
  --primary-hover: #1d4ed8;
  --primary-weak:  #eef4ff;

  --danger:        #d92d20;
  --danger-hover:  #b42318;
  --danger-weak:   #fef3f2;
  --danger-border: #f4bcb6;

  --success:       #067647;
  --success-weak:  #ecfdf3;

  --ring: rgba(37, 99, 235, 0.32);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
  --shadow-md: 0 4px 16px -4px rgba(16, 24, 40, 0.12), 0 2px 6px -2px rgba(16, 24, 40, 0.06);

  --radius:    10px;
  --radius-sm: 7px;
  --maxw:      960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0f1218;
    --surface:       #161a22;
    --surface-2:     #1c222c;
    --border:        #29313d;
    --border-strong: #3a4353;

    --text:          #e7eaf0;
    --text-muted:    #9aa3b2;
    --text-faint:    #69727f;

    --primary:       #5c93ff;
    --primary-hover: #7aa8ff;
    --primary-weak:  #182338;

    --danger:        #f97066;
    --danger-hover:  #fda29b;
    --danger-weak:   #241716;
    --danger-border: #5b2b27;

    --success:       #47cd89;
    --success-weak:  #10251c;

    --ring: rgba(92, 147, 255, 0.40);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.50);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

/* ---------- top nav ---------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topnav-brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.topnav-brand span { color: var(--primary); }

.topnav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.topnav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
}
.topnav-links a:hover { color: var(--text); background: var(--surface-2); }
.topnav-links a.is-active { color: var(--primary); background: var(--primary-weak); }

.topnav form { margin: 0; }

/* ---------- layout ---------- */

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.page-header h1 { margin: 0; }

h1 {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.75rem; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 0.9rem; }

/* ---------- card ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/* ---------- forms ---------- */

label {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}
label:last-child { margin-bottom: 0; }

input, select, textarea {
  display: block;
  width: 100%;
  max-width: 380px;
  margin-top: 0.4rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { max-width: 460px; resize: vertical; line-height: 1.45; }
input[type="date"] { max-width: 220px; }

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.form-inline {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-inline label { margin-bottom: 0; flex: 1; min-width: 240px; }
.form-inline input { max-width: none; }

/* ---------- buttons ---------- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.05rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  line-height: 1;
  color: #fff;
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.btn-ghost {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover {
  background: var(--danger-weak);
  color: var(--danger-hover);
  border-color: var(--danger);
}

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 550;
  border-radius: 6px;
}
.btn-link:hover { background: var(--primary-weak); }

/* ---------- tables ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

table { border-collapse: collapse; width: 100%; }

th, td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  white-space: nowrap;
}
th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

td.faint { color: var(--text-faint); }
td.cell-strong { font-weight: 600; color: var(--text); }

td.actions { text-align: right; }
td.actions > * { vertical-align: middle; }
td.actions .btn-link { margin-right: 0.25rem; }

.inline-form { display: inline; }

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-danger {
  background: var(--danger-weak);
  color: var(--danger);
  border-color: var(--danger-border);
}
.badge-success {
  background: var(--success-weak);
  color: var(--success);
  border-color: transparent;
}

/* ---------- alerts ---------- */

.error {
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  color: var(--danger);
  background: var(--danger-weak);
  border: 1px solid var(--danger-border);
}

/* ---------- empty state ---------- */

.empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92rem;
  white-space: normal;
}

/* ---------- status definition list ---------- */

.dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  font-size: 0.92rem;
}
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; }

/* ---------- back link ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}
.back-link:hover { color: var(--text); }

/* ---------- downloads ---------- */

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.download-item:first-of-type { padding-top: 0; }
.download-item:last-of-type { padding-bottom: 0; border-bottom: none; }
.download-item .di-name { font-weight: 600; }
.download-item .di-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }
.download-item form { margin: 0; }

/* ---------- login ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 340px;
  margin: 0;
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }
.login-card button { width: 100%; margin-top: 0.25rem; }

/* ---------- responsive ---------- */

@media (max-width: 600px) {
  .container { padding: 1.5rem 1rem 3rem; }
  .topnav { gap: 0.6rem; }
  .topnav-brand { width: 100%; margin-bottom: 0.15rem; }
  th, td { padding: 0.6rem 0.7rem; font-size: 0.85rem; }
}
