/* ThinSweep -- "Classic" theme: refined light admin console. */

:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-alt: #fafafb;
    --border: #e5e7eb;
    --text: #1c1e21;
    --muted-text: #6b7280;
    --accent: #0e7c86;
    --accent-hover: #0b6169;
    --accent-soft: #e5f2f2;
    --danger: #c0392b;
    --danger-soft: #fbeae8;
    --success: #1f8a4c;
    --success-soft: #e6f5ec;
    --warn: #b8790a;
    --warn-soft: #fbf1de;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 32, 0.05), 0 2px 8px rgba(16, 24, 32, 0.04);

    --sidebar-bg: #15191d;
    --sidebar-text: #edeef0;
    --sidebar-muted: #9aa1ab;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(14, 124, 134, 0.28);
    --sidebar-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; margin-top: 1.25rem; }

p { line-height: 1.5; }

a { color: var(--accent); }

/* -- Shell: sidebar + topbar + content -------------------------------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 224px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.85rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.5rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-icon { height: 1.4em; width: 1.4em; }

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.side-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.side-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.side-nav a.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    border-left-color: var(--accent);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.topbar-user { font-size: 0.85rem; color: var(--muted-text); }

.theme-toggle, .logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--muted-text);
    border: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    margin: 0;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
}

.theme-toggle svg, .logout-btn svg { width: 15px; height: 15px; }

.theme-toggle:hover, .logout-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.logout-form { margin: 0; }

main {
    max-width: 920px;
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem 1.75rem 3rem;
}

.unauth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.unauth-main .card { width: 100%; max-width: 380px; }

/* -- Cards / tables / forms -------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th, td {
    text-align: left;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

th {
    background: var(--surface-alt);
    font-weight: 600;
    color: var(--muted-text);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

th a { color: var(--text); text-decoration: none; font-weight: 600; }
th a:hover { color: var(--accent); }

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-alt); }

a.row-link { color: var(--text); text-decoration: none; font-weight: 600; }
a.row-link:hover { color: var(--accent); }

label {
    display: block;
    margin: 0.85rem 0 0.3rem;
    font-size: 0.83rem;
    font-weight: 600;
    color: #444;
}

input[type="text"], input[type="url"], input[type="email"], input[type="password"], input[type="file"],
select, textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: var(--radius-sm);
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

textarea {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    min-height: 100px;
    font-size: 0.83rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.checkbox-row label { margin: 0; }

.actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.actions-row form { margin: 0; }
.actions-row button { margin: 0; }

.filter-bar { margin-bottom: 1.25rem; }
.filter-bar select { width: auto; }

button, .button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    margin-right: 0.5rem;
}

button:hover, .button:hover { background: var(--accent-hover); }

button.danger { background: var(--danger); }
button.danger:hover { background: #a5301f; }

.status-ok { color: var(--success); font-weight: 600; }
.status-stale { color: var(--danger); font-weight: 600; }

.muted { color: var(--muted-text); font-size: 0.85rem; }

.error {
    background: var(--danger-soft);
    border: 1px solid #f0c2ba;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: #eee;
    font-size: 0.76rem;
    font-weight: 600;
}

.pill-success { background: var(--success-soft); color: var(--success); }
.pill-failed { background: var(--danger-soft); color: var(--danger); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }

/* -- Policy example widget --------------------------------------------- */

.policy-examples { margin-top: 0.5rem; }
.policy-examples select { margin-bottom: 0.35rem; }

/* -- Tabs (Releases / Artifacts) ---------------------------------------- */

.tab-buttons {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.tab-button {
    background: transparent;
    color: var(--muted-text);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin: 0 0 -1px;
    padding: 0.6rem 0.25rem;
    margin-right: 1.5rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.tab-button:hover { background: transparent; color: var(--text); }

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel[hidden] { display: none; }
