/* Hosting Panel: shared styles. No external resources. */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --accent: #c8f135;
  --accent-hover: #d6f85a;
  --accent-ink: #12190a;
  --radius: 12px;

  --bg: #f1f1ee;
  --grid: rgba(20, 30, 10, 0.06);
  --surface: #ffffff;
  --surface-2: #fafaf5;
  --border: #d9d9d2;
  --text: #11181c;
  --text-muted: #566066;
  --danger: #a12626;
  --danger-bg: #fdecec;
  --danger-border: #f1b5b5;
  --warn-bg: #fff6dd;
  --ok: #2d7a12;
  --focus: #2f6b00;
  --shadow: 0 18px 50px rgba(20, 30, 10, 0.1);
}

:root[data-theme="dark"] {
  --bg: #0e1318;
  --grid: rgba(255, 255, 255, 0.05);
  --surface: #19222b;
  --surface-2: #0f161d;
  --border: #2f3b47;
  --text: #f3f5f2;
  --text-muted: #a3adb5;
  --danger: #ffb4b4;
  --danger-bg: #3a1c1c;
  --danger-border: #6e3030;
  --warn-bg: #3a3118;
  --ok: #8bd45a;
  --focus: #c8f135;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0e1318;
    --grid: rgba(255, 255, 255, 0.05);
    --surface: #19222b;
    --surface-2: #0f161d;
    --border: #2f3b47;
    --text: #f3f5f2;
    --text-muted: #a3adb5;
    --danger: #ffb4b4;
    --danger-bg: #3a1c1c;
    --danger-border: #6e3030;
    --warn-bg: #3a3118;
    --ok: #8bd45a;
    --focus: #c8f135;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; font-size: 16px; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }

.preview-bar { background: #fff3b0; color: #3a3000; border-bottom: 1px solid #e0cd6c; padding: 8px 16px; font-size: 14px; text-align: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid transparent; padding: 14px 18px; cursor: pointer; text-decoration: none; position: relative; min-height: 44px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: #aacf1f; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-block { width: 100%; justify-content: space-between; }
.btn-small { padding: 8px 12px; min-height: 36px; font-size: 14px; }
.btn:disabled, .btn[aria-busy="true"] { cursor: not-allowed; opacity: 0.7; }
.btn-arrow { margin-left: auto; font-size: 18px; }
.btn .spinner { display: none; margin-left: auto; }
.btn[aria-busy="true"] .btn-arrow { display: none; }
.btn[aria-busy="true"] .spinner { display: inline-block; }

.icon-btn { background: transparent; color: var(--text); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface-2); }
.theme-glyph { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

.link-btn { background: none; border: 0; color: var(--text); font: inherit; text-decoration: underline; cursor: pointer; padding: 6px 2px; min-height: 32px; }
.link-row { margin-top: 14px; font-size: 14px; }

/* Spinner (respects reduced motion) */
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
.spinner-inline { color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-right-color: currentColor; opacity: 0.6; }
  .skeleton { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* Forms */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
input[type="text"], input[type="password"] { width: 100%; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-height: 46px; }
input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 76px; }
.input-action { position: absolute; right: 6px; top: 6px; bottom: 6px; background: transparent; border: 0; color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 0 10px; border-radius: 8px; }
.input-action:hover { color: var(--text); }
.field-error { color: var(--danger); font-size: 14px; margin-top: 6px; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; border: 1px solid; }
.alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

/* Login */
.login-shell { display: grid; grid-template-columns: 1.08fr 1fr; min-height: 100vh; min-height: 100dvh; }
.hero { background: radial-gradient(120% 90% at 20% 0%, #33451f 0%, #121c10 55%, #0c140d 100%); color: #f4f7ee; padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { border-radius: 10px; flex: none; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { font-size: 13px; color: #b9c4ad; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 700; margin-bottom: 18px; }
.hero-title { font-size: clamp(2.2rem, 4.4vw, 4rem); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; max-width: 14em; }
.hero-lead { margin-top: 22px; color: #c6cfbb; max-width: 30em; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 24px; border-top: 1px solid rgba(200, 241, 53, 0.25); }
.chips li { border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: #e1e8d8; background: rgba(255, 255, 255, 0.05); }

.login-main { position: relative; display: flex; align-items: center; justify-content: center; padding: 48px 24px; background-color: var(--bg); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 32px 32px; }
.login-main:focus { outline: none; }
.theme-toggle { position: absolute; top: 20px; right: 20px; }

.card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px 36px 30px; box-shadow: var(--shadow); }
.card-eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
:root[data-theme="dark"] .card-eyebrow { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .card-eyebrow { color: var(--accent); } }
.card-title { font-size: 2.2rem; letter-spacing: -0.03em; line-height: 1.1; font-weight: 700; }
.card-title:focus { outline: none; }
.card-lead { color: var(--text-muted); margin: 10px 0 24px; font-size: 0.9rem; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--text-muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #5bc21f; flex: none; }
.status-line { display: flex; align-items: center; gap: 12px; margin: 0 0 22px; font-size: 0.95rem; }

/* Error page */
.error-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.error-page { max-width: 460px; padding: 32px; }
.error-title { font-size: 2.4rem; letter-spacing: -0.03em; margin-bottom: 8px; }
.error-page .btn { margin-top: 8px; }

@media (min-width: 900px) and (max-height: 720px) {
  .login-main { padding-top: 20px; padding-bottom: 20px; }
  .card { padding-top: 28px; padding-bottom: 24px; }
}

@media (max-width: 899px) {
  .login-shell { grid-template-columns: 1fr; }
  .hero { padding: 24px 24px 28px; gap: 20px; }
  .hero-title { font-size: 1.9rem; }
  .hero-lead { font-size: 0.95rem; margin-top: 12px; }
  .login-main { padding: 28px 16px 40px; align-items: flex-start; }
  .theme-toggle { top: 12px; right: 12px; }
  .card { padding: 28px 22px 24px; margin-top: 24px; }
}
@media (max-width: 520px) {
  .chips, .hero-lead { display: none; }
  .hero { padding: 18px 20px; }
  .hero-title { font-size: 1.55rem; }
  .eyebrow { margin-bottom: 8px; }
}

/* Admin layout */
.admin-shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto 1fr; grid-template-areas: "sidebar topbar" "sidebar content"; min-height: 100vh; }
.topbar { grid-area: topbar; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-title { font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }
.sidebar { grid-area: sidebar; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; }
.brand-compact { padding: 4px 8px 18px; }
.nav-list { display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; min-height: 40px; }
a.nav-link:hover { background: var(--surface-2); }
.nav-link.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav-disabled { color: var(--text-muted); cursor: not-allowed; }
.nav-soon { font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.content { grid-area: content; padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.content:focus { outline: none; }
.page-head { margin-bottom: 24px; }
.page-title { font-size: 1.7rem; letter-spacing: -0.02em; }
.page-sub { color: var(--text-muted); margin-top: 4px; font-size: 0.95rem; }
.section { margin-bottom: 24px; }
.section-title { font-size: 1.05rem; font-weight: 650; margin-bottom: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head .section-title { margin-bottom: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 1.8rem; font-weight: 650; margin: 4px 0; }
.stat-note { font-size: 12px; color: var(--text-muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.two-col .section { margin-bottom: 0; }
.empty-state { text-align: center; padding: 28px 12px; border: 1px dashed var(--border); border-radius: 10px; margin-top: 8px; }
.empty-title { font-weight: 600; }
.empty-text { color: var(--text-muted); font-size: 0.92rem; margin-top: 4px; }
.service-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); }
.service-list li:first-child { border-top: 0; }
.badge { font-size: 12px; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--border); }
.badge-muted { color: var(--text-muted); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }

.skeleton-group { display: grid; gap: 10px; margin: 8px 0 12px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; }
.skeleton-line { height: 16px; }
.skeleton-short { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Notifications and dialog */
.notifications { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 10px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--border); border-left-width: 5px; border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.toast-success { border-left-color: #5bc21f; }
.toast-warning { border-left-color: #e0a800; }
.toast-error { border-left-color: #d64545; }
.toast-msg { flex: 1; }
.toast-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font: inherit; padding: 0 4px; min-height: 24px; }
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); max-width: 420px; width: calc(100vw - 32px); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(5, 10, 5, 0.55); }
.dialog-body { padding: 24px; }
.dialog-title { font-size: 1.2rem; }
.dialog-message { color: var(--text-muted); margin: 8px 0 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

.scrim { position: fixed; inset: 0; background: rgba(5, 10, 5, 0.5); z-index: 30; }

@media (max-width: 899px) {
  .admin-shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "content"; }
  .menu-toggle { display: inline-flex; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform 0.2s ease; overflow-y: auto; }
  .admin-shell.nav-open .sidebar { transform: none; }
  .content { padding: 20px 16px 40px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Sign-out and similar one-button forms sit inline in the top bar. */
.inline-form { display: inline; margin: 0; }
.topbar-user { font-size: 0.875rem; color: var(--text-muted, inherit); margin-inline: 0.5rem; }

/* Security page */
.alert-ok { border: 1px solid var(--ok-border, #3a7d54); background: var(--ok-bg, rgba(58, 125, 84, 0.12)); padding: 0.75rem 1rem; border-radius: 0.5rem; margin-bottom: 1rem; }
.code-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.5rem; }
.code-list code, .pair-cmd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; word-break: break-all; }
.callout { border: 1px solid currentColor; border-radius: 0.5rem; padding: 0.75rem 1rem; margin-top: 1rem; }
.stack-form { display: grid; gap: 0.75rem; max-width: 24rem; margin-top: 0.75rem; }
.session-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.resend-row { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; margin-top: 0.75rem; }

/* Jobs */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.filter-row { font-size: 14px; margin: 0 0 12px; }
.filter-row [aria-current="page"] { font-weight: 600; text-decoration: none; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { margin: 0; }
.event-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.event-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
