/* gotta.today — modern admin UI
   Design tokens are inspired by Linear / Vercel / Raycast aesthetics. */

@import url('https://rsms.me/inter/inter.css');

:root {
    color-scheme: dark;
    --bg-0:        #0b0d12;
    --bg-1:        #11141b;
    --bg-2:        #161a23;
    --bg-elev:     #1a1f2b;
    --bg-input:    #0d1017;
    --border:      #232936;
    --border-soft: #1c212c;
    --text:        #e7e9ee;
    --text-dim:    #a4abb8;
    --text-mute:   #6b7180;

    --accent:      #7c8cff;
    --accent-2:    #b275ff;
    --accent-grad: linear-gradient(135deg, #7c8cff 0%, #b275ff 100%);

    --ok:    #3fd29c;
    --warn:  #f5b454;
    --error: #ff6b7a;
    --info:  #59b6ff;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --shadow:    0 10px 30px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.03) inset;
    --shadow-sm: 0 2px 12px rgba(0,0,0,.25);
    --ring:      0 0 0 3px rgba(124,140,255,.25);

    --font: "Inter var", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, "JetBrains Mono", monospace;

    --t: 180ms cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
*:focus { outline: none; }
*:focus-visible { box-shadow: var(--ring); border-radius: var(--radius-sm); }

html, body {
    margin: 0; padding: 0;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Soft radial wash that follows the gradient */
body::before {
    content: "";
    position: fixed; inset: 0;
    background:
        radial-gradient(60vw 50vh at 90% -10%, rgba(178,117,255,.10), transparent 60%),
        radial-gradient(55vw 45vh at -10% 110%, rgba(124,140,255,.10), transparent 65%);
    pointer-events: none;
    z-index: 0;
}
body > * { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-2); }

h1, h2, h3 { letter-spacing: -0.02em; font-weight: 600; }
h1 { font-size: 1.75rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 28px 0 12px; color: var(--text); }
h3 { font-size: 0.85rem; margin: 0; text-transform: uppercase; color: var(--text-mute); letter-spacing: .08em; font-weight: 600; }

p { margin: 8px 0; color: var(--text-dim); }

code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    padding: 1px 7px;
    border-radius: 5px;
    color: var(--text);
}
pre {
    font-family: var(--mono);
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    padding: 14px 16px;
    border-radius: var(--radius);
    overflow: auto;
    font-size: 0.85rem;
}

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }

/* ───── Buttons ───── */
button, .button {
    appearance: none;
    border: 1px solid transparent;
    background: var(--accent-grad);
    color: white;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: 500 0.92rem var(--font);
    letter-spacing: -0.005em;
    transition: transform var(--t), filter var(--t), box-shadow var(--t);
    box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 18px rgba(124,140,255,.25);
}
button:hover, .button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button:active, .button:active { transform: translateY(0); filter: brightness(.95); }
button.secondary, .button.secondary {
    background: var(--bg-elev);
    color: var(--text);
    border-color: var(--border);
    box-shadow: none;
}
button.secondary:hover { background: var(--bg-2); border-color: #2e3647; }
button.link {
    background: none; box-shadow: none; color: var(--text-mute);
    padding: 8px 4px; font-weight: 400;
}
button.link:hover { color: var(--text); transform: none; }

/* ───── Inputs ───── */
input, select, textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font: inherit;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
    resize: vertical;
    min-height: 0;
}
textarea { min-height: 120px; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: #2e3647; }
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--ring);
    background: var(--bg-1);
}
input::placeholder { color: var(--text-mute); }
label {
    display: block;
    margin: 14px 0;
    color: var(--text-dim);
    font-size: 0.82rem;
    letter-spacing: .01em;
    font-weight: 500;
}
label input, label select, label textarea { display: block; margin-top: 6px; }

form { margin: 18px 0; max-width: 420px; }
form.inline { display: inline-block; max-width: none; margin: 0; }

/* ───── Status banners ───── */
.error, .warn, .ok, .info {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 14px 0;
    font-size: 0.9rem;
    border: 1px solid;
    display: flex; align-items: center; gap: 10px;
}
.error { background: rgba(255,107,122,.10); border-color: rgba(255,107,122,.4);  color: #ffd1d6; }
.warn  { background: rgba(245,180,84,.10); border-color: rgba(245,180,84,.4);   color: #ffe7c0; }
.ok    { background: rgba(63,210,156,.10); border-color: rgba(63,210,156,.4);   color: #c4f4dd; }
.info  { background: rgba(89,182,255,.10); border-color: rgba(89,182,255,.35);  color: #d1eaff; }
.error::before,.warn::before,.ok::before,.info::before {
    flex: 0 0 20px; height: 20px; width: 20px;
    display: inline-grid; place-items: center;
    border-radius: 100%;
    font-weight: 700; font-size: 0.78rem; line-height: 1;
}
.ok::before    { content: "✓"; background: rgba(63,210,156,.22);  color: var(--ok); }
.warn::before  { content: "!"; background: rgba(245,180,84,.22);  color: var(--warn); }
.error::before { content: "✕"; background: rgba(255,107,122,.22); color: var(--error); }
.info::before  { content: "i"; background: rgba(89,182,255,.22);  color: var(--info); font-style: italic; }

/* ───── Login ───── */
.login { display: grid; place-items: center; min-height: 100vh; }
.login main { max-width: 380px; width: 100%; padding: 0 22px; }
.login-card {
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 36px 32px;
    animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
.brand {
    text-align: center;
    margin-bottom: 24px;
}
.brand-mark {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--accent-grad);
    display: grid; place-items: center;
    box-shadow: 0 8px 28px rgba(124,140,255,.45);
    color: white; font-weight: 700; font-size: 22px;
    letter-spacing: -0.04em;
}
.brand h1 {
    font-size: 1.35rem; margin: 0;
    background: var(--accent-grad);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.tagline { color: var(--text-mute); font-size: 0.88rem; margin: 6px 0 0; }
.login form { max-width: none; margin: 0; }
.login button[type=submit] { width: 100%; padding: 12px 18px; font-size: 0.95rem; margin-top: 6px; }

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ───── Install stepper ───── */
.install ol.steps {
    display: flex; gap: 8px; list-style: none; padding: 0;
    margin: 24px 0 28px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-1); padding: 6px;
}
.install ol.steps li {
    flex: 1; padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-mute);
    font-size: 0.85rem; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    transition: background var(--t), color var(--t);
    counter-increment: step;
}
.install ol.steps li::before {
    content: counter(step);
    width: 22px; height: 22px;
    display: inline-grid; place-items: center;
    border-radius: 100%;
    border: 1px solid var(--border);
    background: var(--bg-2);
    font-size: 0.75rem; font-weight: 600;
    color: var(--text-mute);
    transition: all var(--t);
}
.install ol.steps li.active { background: var(--bg-elev); color: var(--text); }
.install ol.steps li.active::before { background: var(--accent-grad); border-color: transparent; color: white; }
.install ol.steps li.done { color: var(--ok); }
.install ol.steps li.done::before { content: "✓"; background: rgba(63,210,156,.15); border-color: rgba(63,210,156,.45); color: var(--ok); }
.install section {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    margin: 16px 0;
    box-shadow: var(--shadow-sm);
}
.install footer { margin-top: 32px; color: var(--text-mute); }

/* ───── App shell ───── */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 14px 28px;
    background: rgba(17,20,27,.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar .logo {
    display: flex; align-items: center; gap: 10px;
    font-weight: 600; letter-spacing: -0.02em;
}
.topbar .logo .dot {
    width: 22px; height: 22px; border-radius: 7px;
    background: var(--accent-grad);
    box-shadow: 0 3px 10px rgba(124,140,255,.4);
}
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
    color: var(--text-dim); padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 500;
    transition: background var(--t), color var(--t);
}
.topbar nav a:hover { background: var(--bg-2); color: var(--text); }
.topbar nav a.active { background: var(--bg-elev); color: var(--text); }
.topbar .who {
    color: var(--text-mute); font-size: 0.85rem;
    display: flex; align-items: center; gap: 12px;
}
.topbar .avatar {
    width: 28px; height: 28px; border-radius: 100%;
    background: var(--accent-grad); color: white;
    display: grid; place-items: center;
    font-size: 0.78rem; font-weight: 600;
}

/* ───── Cards / Stats ───── */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 18px 0 28px;
}
.card {
    position: relative;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--border);
    padding: 16px 18px;
    border-radius: var(--radius);
    transition: transform var(--t), border-color var(--t), box-shadow var(--t);
    overflow: hidden;
}
.card:hover { transform: translateY(-2px); border-color: #2e3647; box-shadow: var(--shadow-sm); }
.card .num {
    font-size: 2.1rem; font-weight: 700;
    margin-top: 6px;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.card.ok    .num { color: var(--ok); }
.card.warn  .num { color: var(--warn); }
.card.error .num { color: var(--error); }
.card.info  .num { color: var(--info); }
.card::after {
    content: ""; position: absolute; inset: auto -30% -60% auto;
    width: 140px; height: 140px; border-radius: 100%;
    background: radial-gradient(circle, currentColor, transparent 65%);
    opacity: .07; pointer-events: none;
}

/* ───── Panels / Sections ───── */
.panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin: 18px 0;
    box-shadow: var(--shadow-sm);
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }

/* ───── Tables ───── */
table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    margin: 8px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-1);
}

/* Allows tables in panels to scroll horizontally on narrow viewports. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-scroll table { margin: 0; border: 0; border-radius: 0; }

/* JSON / log context preformatted block */
pre.log-context {
    margin: 6px 0 0;
    padding: 12px 14px;
    font-size: 0.78rem;
    line-height: 1.55;
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-0);
}
details > summary { cursor: pointer; user-select: none; }
details[open] > summary { margin-bottom: 4px; }
th, td {
    padding: 11px 14px; text-align: left; font-size: 0.9rem;
    border-bottom: 1px solid var(--border-soft);
}
tr:last-child td { border-bottom: 0; }
th {
    background: var(--bg-2); color: var(--text-mute);
    font-weight: 600; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: .06em;
}
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--bg-2); }
tbody tr.row-done { opacity: .55; }
tbody tr.row-done:hover { opacity: .85; }

/* ───── Badges ───── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75rem; font-weight: 500;
    background: var(--bg-elev); color: var(--text-dim);
    border: 1px solid var(--border);
}
.badge.ok    { color: var(--ok);    background: rgba(63,210,156,.10); border-color: rgba(63,210,156,.35); }
.badge.warn  { color: var(--warn);  background: rgba(245,180,84,.10); border-color: rgba(245,180,84,.35); }
.badge.error { color: var(--error); background: rgba(255,107,122,.10); border-color: rgba(255,107,122,.35); }
.badge.info  { color: var(--info);  background: rgba(89,182,255,.10); border-color: rgba(89,182,255,.35); }
.badge::before {
    content: ""; width: 6px; height: 6px; border-radius: 100%;
    background: currentColor;
}

/* ───── Empty state ───── */
.empty {
    text-align: center; padding: 36px 18px;
    color: var(--text-mute);
}
.empty .icon {
    width: 48px; height: 48px; margin: 0 auto 12px;
    border-radius: 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    display: grid; place-items: center;
    color: var(--text-mute);
    font-size: 1.4rem;
}

/* ───── Inbound mail box (highlight) ───── */
.inbox-pill {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(124,140,255,.10), rgba(178,117,255,.07));
    border: 1px solid rgba(124,140,255,.30);
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--text);
}
.inbox-pill .label { color: var(--text-mute); font-family: var(--font); font-size: 0.82rem; }
.inbox-pill button { padding: 6px 12px; font-size: 0.8rem; margin-left: auto; }

/* ───── Misc ───── */
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 24px 0; }
.muted { color: var(--text-mute); }
.dim   { color: var(--text-dim); }
.small { font-size: 0.85rem; }

::selection { background: rgba(124,140,255,.45); color: white; }

/* ───── Modal ───── */
.modal { position: fixed; inset: 0; z-index: 1000; display: none; }
.modal.open { display: block; animation: fade .18s ease-out; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(5, 7, 12, .65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-card {
    position: relative;
    max-width: 460px;
    width: calc(100% - 32px);
    margin: 12vh auto 0;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 26px 28px;
    animation: rise .22s cubic-bezier(.2,.8,.2,1);
}
.modal-card h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ───── Tabs ───── */
.tabs { display: flex; gap: 4px; margin: 14px 0 18px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab {
    padding: 8px 14px; color: var(--text-mute);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: 0.88rem; font-weight: 500;
    transition: background var(--t), color var(--t), border-color var(--t);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: var(--bg-2); text-decoration: none; }
.tab.active { color: var(--text); background: var(--bg-elev); border-bottom-color: var(--accent); }

button.small { padding: 4px 9px; font-size: 0.78rem; box-shadow: none; }
button[disabled] { opacity: .7; cursor: wait; transform: none !important; filter: none; }

.spin {
    display: inline-block; width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 100%;
    animation: spin .7s linear infinite;
    vertical-align: -2px;
    margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline-block; max-width: none; margin: 0; }
form.inline button { margin: 0 2px; }

.grid-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px 24px; }

.settings-group {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.settings-group h3 {
    margin: 0 0 12px;
    font-size: 0.78rem;
    color: var(--text-mute);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.settings-group label { margin: 10px 0; }
.settings-group label:first-of-type { margin-top: 0; }

.panel.collapsible {
    max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0;
    overflow: hidden; opacity: 0; border-color: transparent;
    transition: max-height var(--t), opacity var(--t), padding var(--t), margin var(--t), border-color var(--t);
}
.panel.collapsible.open {
    max-height: 1400px; padding-top: 22px; padding-bottom: 24px; margin: 18px 0; opacity: 1;
    border-color: var(--border);
}

.dest-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 18px; margin: 12px 0;
    transition: background var(--t);
}
.dest-card[open] { background: var(--bg-1); }
.dest-card summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; }
.dest-card summary::-webkit-details-marker { display: none; }
.dest-card summary::before {
    content: "›"; display: inline-block; transition: transform var(--t);
    color: var(--text-mute); font-size: 1rem;
}
.dest-card[open] summary::before { transform: rotate(90deg); }

@media (max-width: 720px) {
    main { padding: 18px 12px 60px; }
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.05rem; }

    /* Top bar: stack into rows, nav scrolls horizontally */
    .topbar {
        padding: 10px 14px; gap: 10px;
        flex-wrap: wrap;
    }
    .topbar nav {
        order: 3; width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .topbar nav::-webkit-scrollbar { display: none; }
    .topbar nav a { white-space: nowrap; flex: 0 0 auto; }
    .topbar .who { font-size: 0.78rem; gap: 8px; }
    .topbar .who .dim { display: none; } /* hide name, keep avatar+logout */

    /* Panels & spacing */
    .panel { padding: 16px 14px; }
    .panel-head { flex-wrap: wrap; gap: 8px; }
    .panel-head h2 { flex: 1 1 100%; }

    /* Cards: fewer columns, tighter */
    .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card { padding: 12px 14px; }
    .card .num { font-size: 1.7rem; }
    .card h3 { font-size: 0.72rem; }

    /* Forms become full-width and stack */
    form { max-width: none; }
    form > div[style*="flex"], form .grid-2col {
        grid-template-columns: 1fr;
    }

    /* Tables: smaller padding, smaller text, allow horizontal scroll */
    table { font-size: 0.85rem; }
    th, td { padding: 8px 10px; }
    th { font-size: 0.7rem; }

    /* Login card */
    .login-card { padding: 26px 20px; }
    .login main { padding: 0 14px; }

    /* Tabs scroll horizontally */
    .tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab { white-space: nowrap; flex: 0 0 auto; }

    /* Modal: full width near edges */
    .modal-card { margin: 8vh auto 0; padding: 22px 20px; }

    /* Install stepper compacts */
    .install ol.steps { flex-wrap: wrap; }
}

@media (max-width: 460px) {
    .cards { grid-template-columns: 1fr; }
    .topbar .logo { font-size: 0.95rem; }
    .topbar .logo .dot { width: 18px; height: 18px; }
}
