:root {
  --bg: #09091e;
  --bg-soft: #0f112b;
  --panel: rgba(15, 17, 43, 0.80);
  --panel-strong: rgba(19, 22, 55, 0.95);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #e8ecf5;
  --muted: #7c88a8;
  --accent: #f45546;
  --accent-soft: rgba(244, 85, 70, 0.14);
  --accent-glow: rgba(244, 85, 70, 0.28);
  --danger: #ff7b7b;
  --danger-soft: rgba(255, 123, 123, 0.12);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.03), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(38, 52, 80, 0.5), transparent 50%),
    linear-gradient(160deg, #09091e 0%, #0f112b 55%, #1a2040 100%);
  background-attachment: fixed;
}

a { color: inherit; }

/* ── Layout shells ─────────────────────────────────────────────────────────── */

.shell {
  width: min(1200px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

/* ── Auth (login) ──────────────────────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 24px;
}

.auth-card {
  width: min(400px, 100%);
  background: rgba(15, 17, 43, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.03) inset;
  backdrop-filter: blur(24px);
}

.auth-head {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  height: 90px;
  width: auto;
  margin-bottom: 22px;
  opacity: 0.92;
}

.auth-head h1 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field > span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.auth-field input {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%;
  font: inherit;
}

.auth-field input:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.auth-field input:focus {
  border-color: rgba(244, 85, 70, 0.55);
  box-shadow: 0 0 0 3px rgba(244, 85, 70, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.auth-submit {
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  font: inherit;
  font-weight: 600;
  background: linear-gradient(135deg, #f45546 0%, #d63222 100%);
  color: white;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 24px rgba(244, 85, 70, 0.22);
  width: 100%;
}

.auth-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 12px 28px rgba(244, 85, 70, 0.32);
}

.auth-error {
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.4;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 123, 123, 0.22);
  color: #ffc8c8;
}

.auth-foot {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ── Admin page ────────────────────────────────────────────────────────────── */

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.admin-header-logo {
  height: 24px;
  width: auto;
  opacity: 0.85;
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header-meta h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.admin-header-meta p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

/* Section headers */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.section-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* Panel cards */
.panel {
  background: rgba(15, 17, 43, 0.60);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
}

.panel-body {
  padding: 22px 24px;
}

.panel-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.panel-desc {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* Forms */
.form-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 13px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:hover, select:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(244, 85, 70, 0.5);
  box-shadow: 0 0 0 3px rgba(244, 85, 70, 0.10);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-primary {
  background: linear-gradient(135deg, #f45546 0%, #d63222 100%);
  color: white;
  box-shadow: 0 6px 18px rgba(244, 85, 70, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 22px rgba(244, 85, 70, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-size: 12px;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-danger {
  background: var(--danger-soft);
  color: #ffd3d3;
  border: 1px solid rgba(255, 123, 123, 0.25);
}

/* Submit in forms */
button[type="submit"]:not(.btn) {
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #f45546 0%, #d63222 100%);
  color: white;
  box-shadow: 0 6px 18px rgba(244, 85, 70, 0.2);
  transition: transform 0.15s, filter 0.15s;
  width: 100%;
}

button[type="submit"]:not(.btn):hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

/* Grids */
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* Client cards */
.client-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, background 0.2s;
}

.client-card:hover {
  border-color: rgba(244, 85, 70, 0.3);
  background: rgba(244, 85, 70, 0.03);
}

.client-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.client-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.client-card p {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.client-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.client-stat {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 12px;
}

.client-stat .lbl {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 4px;
}

.client-stat .val {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.card-actions {
  display: flex;
  gap: 8px;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 13px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.td-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-rotate {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-rotate input {
  width: 140px;
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 8px;
}

/* Tags / badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-admin {
  background: rgba(215, 166, 60, 0.12);
  color: #f6d487;
  border: 1px solid rgba(215, 166, 60, 0.25);
}

.tag-client {
  background: rgba(244, 85, 70, 0.12);
  color: #f9a09a;
  border: 1px solid rgba(244, 85, 70, 0.25);
}

.tag-active {
  background: rgba(100, 200, 130, 0.10);
  color: #9ce3b1;
  border: 1px solid rgba(100, 200, 130, 0.22);
}

.tag-disabled {
  background: rgba(255, 255, 255, 0.06);
  color: #8899aa;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

/* Misc */
.code-text {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #b0bfd6;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13px;
  background: rgba(244, 85, 70, 0.10);
  border: 1px solid rgba(244, 85, 70, 0.25);
  color: #f9a09a;
  margin-bottom: 20px;
}

.error {
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13px;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 123, 123, 0.22);
  color: #ffc8c8;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

/* Client list (replaces client-card grid) */
.client-list .client-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.client-list .client-slug {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

.client-list .client-desc {
  color: var(--muted);
  font-size: 12.5px;
  max-width: 320px;
  line-height: 1.5;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(19, 22, 55, 0.98) 0%, rgba(15, 17, 43, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
  max-height: calc(100vh - 48px);
  overflow: auto;
  animation: modalUp 0.22s cubic-bezier(.2, .8, .2, 1);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-close {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font: inherit;
  font-size: 18px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  padding-top: 6px;
}

.modal-actions .btn {
  width: auto;
}

/* Inside-modal: keep submit button compact (override the global full-width rule) */
.modal-body button[type="submit"]:not(.btn) {
  width: auto;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Responsive */
@media (max-width: 900px) {
  .two-col, .three-col, .stats-strip {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  .modal {
    border-radius: 14px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 32px 22px 24px;
    border-radius: 16px;
  }

  .shell {
    width: calc(100vw - 32px);
  }
}
