/* Domain Command Center — Brand: mark gerngroß
 * Primary  #c8ac65 (gold)
 * Dark     #433f3d (warm brown-black)
 */
*, *::before, *::after { box-sizing: border-box; }

:root {
    color-scheme: light;
    --gold:        #c8ac65;
    --gold-deep:   #b1944b;
    --gold-soft:   #ddc88b;
    --ink:         #433f3d;
    --ink-soft:    #5b5754;

    --bg:          #faf8f3;
    --surface:     #ffffff;
    --surface-2:   #f3efe6;
    --border:      #e5dfd1;
    --border-soft: #efeadd;
    --text:        var(--ink);
    --muted:       #807a73;

    --primary:        var(--gold);
    --primary-hover:  var(--gold-deep);
    --on-primary:     #2a2521;

    --danger:  #b04a3b;
    --warn:    #c08a2a;
    --ok:      #5b8a4f;
    --bot:     #a09a8d;

    --shadow:    0 1px 2px rgba(67, 63, 61, .04), 0 2px 6px rgba(67, 63, 61, .06);
    --shadow-lg: 0 4px 16px rgba(67, 63, 61, .08);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg:          #2a2725;
    --surface:     #353230;
    --surface-2:   #403c39;
    --border:      #4a4541;
    --border-soft: #3d3936;
    --text:        #ebe4d3;
    --muted:       #9a9389;

    --primary-hover:  var(--gold-soft);
    --on-primary:     #1a1815;

    --danger:  #d77260;
    --warn:    #e2a946;
    --ok:      #8bb87c;
    --bot:     #807a72;

    --shadow:    0 1px 2px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, .35);
}

html, body { margin: 0; padding: 0; }
html { background: var(--bg); }

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .75rem; font-weight: 600; line-height: 1.25; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
.mt { margin-top: 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.center { text-align: center; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .875em;
    background: var(--surface-2);
    color: var(--text);
    padding: 1px 5px;
    border-radius: 3px;
}
pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--surface-2);
    color: var(--text);
    padding: .75rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: .8125rem;
}

/* Topbar */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 60px;
    flex-shrink: 0;
}
.brand { display: flex; align-items: baseline; gap: .625rem; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -.015em;
}
.brand-mark::after {
    content: "·";
    margin-left: .5rem;
    color: var(--border);
    font-weight: 400;
}
.brand-name {
    font-size: .9375rem;
    font-weight: 500;
    color: var(--text);
}

.topnav { display: flex; gap: .25rem; flex: 1; }
.topnav a {
    padding: .375rem .8rem;
    color: var(--muted);
    border-radius: 6px;
    font-weight: 500;
    transition: background-color .15s, color .15s;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav a.active { background: rgba(200, 172, 101, .15); color: var(--primary); }
[data-theme="dark"] .topnav a.active { background: rgba(200, 172, 101, .18); color: var(--gold-soft); }

.topbar-user { display: flex; align-items: center; gap: 1rem; }
.user-name { color: var(--muted); font-size: .8125rem; }

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, color .15s, border-color .15s;
    font-family: inherit;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Main container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}
main.container { flex: 1; }

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1rem 0;
    margin-top: 2rem;
    color: var(--muted);
    font-size: .8125rem;
}
.footer .container { display: flex; justify-content: space-between; padding: 0 1.5rem; }

/* Page head */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0; }

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .875rem 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: .25rem; }
.filter-group label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filter-group input, .filter-group select { min-width: 140px; }
.filter-meta { margin-left: auto; align-self: center; }

/* Forms */
form label {
    display: block;
    margin-bottom: .875rem;
    font-weight: 500;
    color: var(--text);
}
form label small { display: block; font-weight: 400; margin-top: .25rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input:not([type]), select, textarea {
    width: 100%;
    padding: .5rem .625rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    margin-top: .25rem;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(200, 172, 101, .25);
}
label.checkbox { font-weight: 400; display: flex; align-items: center; gap: .5rem; }
label.checkbox input { width: auto; margin: 0; }
.form-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

/* Buttons */
.btn, button.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-link {
    color: var(--primary);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    font-family: inherit;
    padding: 0;
}
.btn-link:hover { text-decoration: underline; color: var(--primary-hover); }
.btn-link.warn { color: var(--warn); }
.btn-link.danger { color: var(--danger); }
.btn-link.small { font-size: .8125rem; }
.btn-link[disabled] { color: var(--muted); cursor: not-allowed; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.stat-val { font-size: 1.5rem; font-weight: 600; color: var(--text); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: .625rem .75rem; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.data-table th { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table.compact th, .data-table.compact td { padding: .375rem .625rem; font-size: .8125rem; }
.data-table .ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .row-actions { display: flex; gap: .75rem; }

/* Pills */
.pill {
    display: inline-block;
    padding: .125rem .5rem;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--surface-2);
    color: var(--muted);
}
.pill.mode-redirect { background: rgba(200, 172, 101, .2); color: var(--gold-deep); }
[data-theme="dark"] .pill.mode-redirect { color: var(--gold-soft); }
.pill.mode-parking  { background: rgba(192, 138, 42, .2); color: var(--warn); }
.pill.mode-pixel    { background: rgba(91, 138, 79, .2); color: var(--ok); }
.pill.ok       { background: rgba(91, 138, 79, .18); color: var(--ok); }
.pill.inactive { background: rgba(176, 74, 59, .18); color: var(--danger); }
.pill.bot      { background: var(--surface-2); color: var(--bot); }

/* Alerts */
.alert {
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: .875rem;
    border: 1px solid;
}
.alert.info  { background: rgba(200, 172, 101, .1);  color: var(--gold-deep); border-color: rgba(200, 172, 101, .3); }
[data-theme="dark"] .alert.info { color: var(--gold-soft); }
.alert.ok    { background: rgba(91, 138, 79, .1);    color: var(--ok);     border-color: rgba(91, 138, 79, .3); }
.alert.warn  { background: rgba(192, 138, 42, .1);   color: var(--warn);   border-color: rgba(192, 138, 42, .3); }
.alert.error { background: rgba(176, 74, 59, .1);    color: var(--danger); border-color: rgba(176, 74, 59, .3); }

/* Cron table in setup */
.cron-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.cron-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.cron-table code { word-break: break-all; }

/* Token display */
.token-display {
    word-break: break-all;
    background: var(--surface-2);
    color: var(--text);
    padding: .625rem;
    border-radius: 6px;
    font-size: .75rem;
    margin: 0;
}

/* Cron list on System page */
.cron-list { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0; }
.cron-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 3fr auto;
    gap: 1rem;
    align-items: center;
    padding: .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
}
.cron-meta .cron-time { font-weight: 600; color: var(--text); }
.cron-url-wrap { display: flex; gap: .5rem; align-items: center; }
.cron-url {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .75rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: .5rem;
    margin: 0;
    border-radius: 4px;
}
.copy-btn { white-space: nowrap; }
.copy-btn.ok { background: rgba(91, 138, 79, .15); color: var(--ok); border-color: rgba(91, 138, 79, .4); }
@media (max-width: 800px) {
    .cron-row { grid-template-columns: 1fr; }
}

/* Inline forms (e.g., on groups page) */
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input[name="name"] { width: auto; min-width: 14rem; margin: 0; }
.inline-form.compact input[name="name"] { min-width: 12rem; }

/* Chart canvas */
.card canvas { max-height: 280px; }

/* Grid 2 cols / 3 cols */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Breakdown charts (analytics extension) */
.bar-list { display: flex; flex-direction: column; gap: .375rem; }
.bar-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .75rem;
    align-items: center;
    padding: .25rem 0;
}
.bar-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-flag { font-size: 1rem; line-height: 1; }
.bar-track {
    position: relative;
    flex: 1;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
}
.bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--primary);
    border-radius: 4px;
}
.bar-row .num {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: .8125rem;
    min-width: 3.5rem;
    text-align: right;
}
.bar-row .label-text { flex: 1; min-width: 6rem; }

.warn   { color: var(--warn); }
.danger { color: var(--danger); }
