:root {
    --bg: #fbfbfd;
    --surface: #ffffff;
    --fg: #1d1d1f;
    --fg-secondary: #6e6e73;
    --fg-tertiary: #86868b;
    --gray-50: #f5f5f7;
    --gray-100: #e8e8ed;
    --gray-200: #d2d2d7;
    --hairline: rgba(0, 0, 0, 0.08);
    --hairline-strong: rgba(0, 0, 0, 0.14);
    --accent: #1d1d1f;
    --accent-hover: #000000;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 980px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 6px 20px rgba(0, 0, 0, 0.04);
    --nav-height: 52px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--fg);
    text-decoration: none;
}

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.015em;
    margin: 0 0 8px;
}

h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

p {
    color: var(--fg-secondary);
    margin: 0 0 8px;
}

/* ---------- Nav ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 24px;
    background: rgba(251, 251, 253, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--hairline);
}

.topbar .brand {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--fg);
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.topbar nav a,
.topbar nav button,
.topbar nav summary {
    font-size: 13px;
    color: var(--fg-secondary);
    transition: color 0.15s ease;
}

.topbar nav a:hover,
.topbar nav button:hover,
.topbar nav summary:hover {
    color: var(--fg);
}

.topbar .nav-divider {
    width: 1px;
    height: 16px;
    background: var(--hairline-strong);
}

.topbar .nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--surface);
    font-size: 10px;
    font-weight: 600;
}

/* ---------- Nav dropdowns ---------- */

.dropdown {
    position: relative;
}

.dropdown > summary {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    list-style: none;
}

.dropdown > summary::-webkit-details-marker {
    display: none;
}

.dropdown > summary::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.dropdown[open] > summary::after {
    transform: rotate(225deg);
    margin-top: 3px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 6px;
    z-index: 20;
}

.dropdown-menu .dropdown-heading {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-tertiary);
}

.dropdown-menu a,
.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--fg);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--gray-50);
    color: var(--fg);
}

/* ---------- Layout ---------- */

main {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

main > .card,
main > form > .card {
    margin-bottom: 20px;
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 28px;
}

/* ---------- Auth screens ---------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    padding: 24px;
}

.auth-shell .card {
    width: 100%;
    max-width: 380px;
}

/* ---------- Forms ---------- */

form .field {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--fg);
    font-size: 15px;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: var(--surface);
    box-shadow: 0 0 0 2px var(--fg);
}

select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--fg);
    font-size: 15px;
}

/* ---------- Buttons ---------- */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--surface);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

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

button:active,
.btn:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: var(--gray-50);
    color: var(--fg);
}

.btn-secondary:hover {
    background: var(--gray-100);
}

/* ---------- Feedback ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    border-left: 3px solid var(--fg-tertiary);
    margin-bottom: 18px;
    font-size: 14px;
    color: var(--fg);
}

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--hairline);
}

th {
    color: var(--fg-tertiary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- Misc ---------- */

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gray-100);
    font-size: 12px;
    font-weight: 500;
    color: var(--fg-secondary);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spread {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.muted {
    color: var(--fg-tertiary);
}

.module-tile {
    display: block;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--fg);
    font-weight: 500;
    transition: background 0.15s ease;
}

.module-tile:hover {
    background: var(--gray-100);
}

.btn-block {
    display: flex;
    width: 100%;
}

.divider-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: var(--fg-tertiary);
    font-size: 13px;
}

.divider-label::before,
.divider-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hairline);
}

.auth-shell .brand-heading {
    font-size: 22px;
    text-align: center;
    margin-bottom: 24px;
}
