/* CronApp — refined utilitarian admin UI */

:root {
    --bg:          #f7f6f2;
    --surface:     #ffffff;
    --ink:         #1a1a1a;
    --ink-mute:    #6b6b6b;
    --ink-soft:    #9a9a9a;
    --line:        #e8e6e0;
    --line-soft:   #f0eee8;
    --accent:      #d94e1f;       /* warm vermillion */
    --accent-ink:  #b53e15;
    --success:     #2e7d32;
    --warn:        #e8a317;
    --danger:      #c0392b;
    --sidebar-bg:  #1f1d1a;
    --sidebar-ink: #d9d3c4;
    --sidebar-ink-mute: #8a857a;
    --shadow-sm:   0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 2px 8px rgba(0,0,0,.06);
    --radius:      4px;
    --font-sans:   'Inter', system-ui, sans-serif;
    --font-display:'Fraunces', Georgia, serif;
    --font-mono:   'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: grid;
    grid-template-columns: 240px 1fr;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent-ink); }
.link-muted { color: var(--ink-mute); }
.link-muted:hover { color: var(--accent-ink); }

/* ---- sidebar ---- */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    padding: 28px 18px;
    min-height: 100vh;
    border-right: 1px solid #0f0e0c;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 0 8px 28px;
    border-bottom: 1px solid #2c2924;
}
.brand-mark { font-size: 22px; color: var(--accent); }
.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    color: #f5efe1;
    letter-spacing: -0.01em;
}
.nav { padding-top: 16px; display: flex; flex-direction: column; }
.nav a {
    color: var(--sidebar-ink);
    padding: 8px 10px;
    border-radius: var(--radius);
    margin: 1px 0;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .12s ease, color .12s ease;
}
.nav a:hover { background: #2a2722; color: #fff; }
.nav a.active { background: #2a2722; color: #fff; }
.nav-icon {
    display: inline-flex;
    width: 18px;
    justify-content: center;
    color: var(--sidebar-ink-mute);
    font-size: 12px;
}
.nav a.active .nav-icon { color: var(--accent); }
.nav-divider {
    height: 1px;
    background: #2c2924;
    margin: 14px 6px;
}
.nav-btn {
    display: inline-block !important;
    text-align: center;
    background: var(--accent) !important;
    color: #fff !important;
    padding: 9px 12px !important;
    border-radius: var(--radius);
    font-weight: 500;
    margin: 0 4px;
}
.nav-btn:hover { background: var(--accent-ink) !important; }

/* ---- main ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 36px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.topbar-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
}
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.user-email { color: var(--ink-mute); font-family: var(--font-mono); font-size: 12.5px; }

.content { padding: 28px 36px; }

/* ---- flash ---- */
.flash {
    margin: 16px 36px 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    border: 1px solid;
}
.flash-success { background: #eef5ee; border-color: #c6dec8; color: #1f5a25; }
.flash-error   { background: #fbecea; border-color: #e8c3bf; color: #8e2a1d; }
.flash-info    { background: #f1ede4; border-color: #ddd6c2; color: #4a4232; }

/* ---- toolbar ---- */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.toolbar input[type=text],
.toolbar select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: inherit;
    font-size: 13.5px;
}
.toolbar input[type=text]:focus,
.toolbar select:focus { outline: none; border-color: var(--accent); }
.toolbar .grow { flex: 1; }

/* ---- buttons ---- */
.btn, .btn-primary, .btn-ghost, .btn-danger {
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: #f3f0e8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: transparent; border: 1px dashed var(--line); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #e8c3bf; }
.btn-danger:hover { background: #fbecea; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* ---- table ---- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
table.jobs {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.jobs th {
    text-align: left;
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-mute);
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #fcfbf6;
}
table.jobs td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
table.jobs tr:hover td { background: #fcfbf6; }
table.jobs tr:last-child td { border-bottom: none; }

.col-id   { font-family: var(--font-mono); color: var(--ink-mute); }
.col-name { font-weight: 500; }
.col-time { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-mute); }
.col-url  { font-family: var(--font-mono); font-size: 12.5px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* Status pill / counters */
.pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    font-family: var(--font-mono);
}
.pill-success { background: #e6f1e6; color: #1f5a25; }
.pill-failure { background: #fbecea; color: #8e2a1d; }
.pill-warn    { background: #fdf3dc; color: #7a5b0b; }
.pill-mute    { background: #f0eee8; color: var(--ink-mute); }

/* Toggle */
.toggle {
    width: 36px; height: 20px; background: #d9d4c5; border-radius: 999px;
    display: inline-flex; align-items: center; padding: 2px; cursor: pointer;
    transition: background .15s;
    border: none;
}
.toggle .knob {
    width: 16px; height: 16px; background: #fff; border-radius: 50%;
    transform: translateX(0);
    transition: transform .15s;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.toggle.on { background: var(--success); }
.toggle.on .knob { transform: translateX(16px); }

/* ---- form ---- */
.form-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 880px;
}
.form-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line-soft);
    align-items: start;
}
.form-row:last-child { border-bottom: none; }
.form-label {
    font-weight: 500;
    font-size: 13.5px;
    padding-top: 8px;
}
.form-label .hint {
    display: block;
    font-weight: 400;
    color: var(--ink-mute);
    font-size: 12.5px;
    margin-top: 2px;
}
.form-field input[type=text],
.form-field input[type=email],
.form-field input[type=password],
.form-field input[type=number],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: inherit;
    font-size: 13.5px;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { outline: none; border-color: var(--accent); }
.form-field textarea { font-family: var(--font-mono); font-size: 12.5px; min-height: 100px; }
.form-field .row-cron {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.form-field .row-cron input {
    font-family: var(--font-mono);
    text-align: center;
}
.form-field .row-inline { display: flex; gap: 10px; align-items: center; }
.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding-top: 20px; border-top: 1px solid var(--line); margin-top: 12px;
}
.checkbox-row { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 4px; }
.checkbox-row label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13.5px;
}

/* ---- auth pages ---- */
body.auth { display: block; background: var(--bg); }
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 36px 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-md);
}
.auth-card h1 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 30px;
    letter-spacing: -0.015em;
}
.auth-card p.tag { margin: 0 0 24px; color: var(--ink-mute); font-size: 13.5px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card input {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-card .btn-primary { justify-content: center; height: 42px; font-size: 14px; }
.auth-card .alt {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-mute);
}

/* ---- detail / executions ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 26px;
}
.card h3 {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--ink-mute); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: 12.5px; }

table.exec {
    width: 100%; border-collapse: collapse; font-size: 12.5px;
    font-family: var(--font-mono);
}
table.exec th, table.exec td {
    padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left;
}
table.exec th { font-weight: 600; color: var(--ink-mute); background: #fcfbf6; font-size: 11px; text-transform: uppercase; }

/* ---- API keys ---- */
.api-key-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 16px;
}
.api-key-row .key-label { font-weight: 500; }
.api-key-row .key-prefix { font-family: var(--font-mono); color: var(--ink-mute); font-size: 12.5px; }
.api-key-callout {
    background: #fdf6e7;
    border: 1px solid #e6cf8d;
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 24px;
}
.api-key-callout .key {
    font-family: var(--font-mono);
    background: #fff;
    border: 1px solid #e6cf8d;
    padding: 8px 10px;
    border-radius: var(--radius);
    word-break: break-all;
    margin-top: 8px;
    display: block;
}

/* ---- docs ---- */
.docs h2 {
    font-family: var(--font-display);
    font-weight: 700;
    margin: 28px 0 8px;
    font-size: 22px;
    letter-spacing: -0.01em;
}
.docs h3 { margin: 22px 0 6px; font-size: 16px; }
.docs code, .docs pre {
    font-family: var(--font-mono); font-size: 12.5px;
}
.docs pre {
    background: #1f1d1a;
    color: #ede5d0;
    padding: 14px 18px;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.55;
}
.docs code.inline {
    background: #f1ede4;
    padding: 2px 6px;
    border-radius: 3px;
}
.docs table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 10px 0; }
.docs th, .docs td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }

.pagination {
    margin-top: 14px; display: flex; justify-content: space-between; align-items: center;
    color: var(--ink-mute); font-size: 12.5px;
}
.pagination a { padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
