/* SherDore Shield — hand-written, dependency-free stylesheet.
   No build step, no CDN, no framework. Swap for a Tailwind/Vite
   pipeline later if/when a Node toolchain is set up on the VPS — this
   file is intentionally simple to make that swap low-risk. */

:root {
    --bg: #0d1117;
    --bg-elevated: #161b22;
    --bg-hover: #1c2129;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #2f81f7;
    --accent-hover: #4c94ff;
    --green: #3fb950;
    --yellow: #d29922;
    --red: #f85149;
    --radius: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 15px;
}

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

h1, h2, h3 { font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; color: var(--text-muted); }

/* --- Layout shell --- */
/* Brand lockup is a real PNG (dark ink on transparent, pulled from
   accounts.sherdore.com's own asset, same as its login page) — it isn't
   recolorable via CSS the way the old inline-SVG lockup was. Rather than
   float it on a badge over a dark bar, the topbar itself takes the
   light, warm background the mark was actually designed against
   (matches sherdore.com's own header), with its own dark text/border
   tokens — the rest of the page stays on the dark --bg/--text theme. */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid #e8ddc9;
    background: #fdfaf6;
}
.topbar .brand { display: flex; align-items: center; }
.brand-mark { height: 24px; width: auto; display: block; }
.topbar nav a { margin-left: 20px; color: #57534e; font-size: 14px; }
.topbar nav a:hover { color: #1c1917; text-decoration: none; }
.topbar-user { color: #57534e; font-size: 14px; }

.account-menu {
    position: relative;
    display: inline-block;
    margin-left: 20px;
    vertical-align: middle;
}
.account-menu summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { background: var(--bg-hover); }
.account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.account-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 200px;
    padding: 6px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.account-menu-dropdown a,
.account-menu-dropdown button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 9px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.account-menu-dropdown a:hover,
.account-menu-dropdown button:hover {
    background: var(--bg-hover);
    text-decoration: none;
}
.account-menu-dropdown .divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--border);
}

.shell {
    display: flex;
    min-height: calc(100vh - 53px);
}
.sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: 20px 0;
}
.sidebar a {
    display: block;
    padding: 8px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.sidebar a:hover, .sidebar a.active {
    color: var(--text);
    background: var(--bg-hover);
    text-decoration: none;
}
.sidebar .section-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.main { flex: 1; padding: 32px; max-width: 1100px; }

/* --- Cards --- */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* A <details class="card"> with <summary class="card-header"> — same
   look as a plain card, but the whole body collapses. The marker
   triangle browsers put on <summary> is suppressed in favor of
   .card-toggle-arrow, which is positioned wherever it's placed inside
   the header (right side, after any header controls) and flips on
   [open] via CSS only, no JS. */
summary.card-header { cursor: pointer; list-style: none; }
summary.card-header::-webkit-details-marker { display: none; }
.card-toggle-arrow {
    display: inline-block;
    color: var(--text-muted);
    transition: transform .15s ease;
}
details[open] > summary .card-toggle-arrow { transform: rotate(180deg); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* --- Buttons & forms --- */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); }

label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], select, textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 14px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.error { color: var(--red); font-size: 13px; margin: -10px 0 12px; }
.help-text { font-size: 12px; color: var(--text-muted); margin-top: -8px; margin-bottom: 12px; }

/* --- Badges / status --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-green { background: rgba(63,185,80,0.15); color: var(--green); }
.badge-yellow { background: rgba(210,153,34,0.15); color: var(--yellow); }
.badge-red { background: rgba(248,81,73,0.15); color: var(--red); }
.badge-gray { background: rgba(139,148,158,0.15); color: var(--text-muted); }

/* --- Table --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* --- Guest / marketing pages --- */
.guest-shell { min-height: 100vh; display: flex; flex-direction: column; }
.hero {
    text-align: center;
    padding: 100px 24px 60px;
    max-width: 720px;
    margin: 0 auto;
}
.hero h1 { font-size: 42px; margin-bottom: 16px; }
.hero p { font-size: 18px; margin-bottom: 32px; }
.hero .btn { padding: 12px 28px; font-size: 15px; margin: 0 6px; }

.auth-box {
    max-width: 380px;
    margin: 80px auto;
    padding: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.auth-box h1 { font-size: 22px; text-align: center; margin-bottom: 24px; }

.features {
    max-width: 960px;
    margin: 0 auto;
    padding: 56px 24px;
}
.features:first-of-type { padding-top: 20px; }
.features:last-of-type { padding-bottom: 100px; }
.section-heading { text-align: center; max-width: 620px; margin: 0 auto 28px; }
.section-heading h2 { font-size: 26px; margin-bottom: 8px; }
.section-heading p { font-size: 15px; }

.guest-flash {
    max-width: 520px;
    margin: 20px auto -10px;
    padding: 10px 16px;
    border: 1px solid var(--green);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    text-align: center;
}
.guest-flash.is-error { border-color: var(--red); }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }

/* --- Portal dashboard --- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }

.stat { margin-bottom: 0; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.stat-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stat-good .stat-value { color: var(--green); }
.stat-bad .stat-value { color: var(--red); }

.meter { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.is-full > span { background: var(--yellow); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 96px; margin-top: 8px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.bar .ok, .bar .bad { display: block; border-radius: 2px; min-height: 0; }
.bar .ok { background: var(--green); }
.bar .bad { background: var(--red); }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; font-size: 10px; color: var(--text-muted); }
.bar-labels span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.steps li:last-child { border-bottom: none; }
.steps li::before { content: counter(step); flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--bg-hover); border: 1px solid var(--border); color: var(--text); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.steps strong { color: var(--text); }

.muted { color: var(--text-muted); }
.row-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { display: inline; margin: 0; }
/* In a table, keep the cell a real table-cell (flex would break the row borders). */
td.row-actions { display: table-cell; text-align: right; white-space: nowrap; }
td.row-actions > a, td.row-actions > form { margin-left: 14px; }
.link-button { background: none; border: none; padding: 0; color: var(--red); cursor: pointer; font: inherit; font-size: 14px; }
.link-button:hover { text-decoration: underline; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters > div { min-width: 180px; }
.pagination-wrap { margin-top: 16px; font-size: 14px; }
.pagination-wrap svg { width: 16px; height: 16px; }
.pagination-wrap nav > div:first-child { display: none; }

/* --- Site footer --- */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 20px 0;
}
.site-footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.site-footer-copy { color: var(--text-muted); font-size: 13px; }
.site-footer-social { display: flex; gap: 16px; }
.site-footer-social a { color: var(--text-muted); display: inline-flex; }
.site-footer-social a:hover { color: var(--text); }
.site-footer-social svg { width: 18px; height: 18px; }
