:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #edf4ec;
    --line: #dbe4da;
    --text: #203028;
    --muted: #6b7a72;
    --primary: #2f7d32;
    --primary-strong: #23492f;
    --accent: #4f8f5f;
    --accent-soft: #e8f4ea;
    --warning: #b48a2c;
    --shadow: 0 14px 28px rgba(22, 37, 25, .07);
    --radius: 10px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1720;
    --surface: #151f2c;
    --surface-soft: #102620;
    --line: #243447;
    --text: #edf4fb;
    --muted: #a3b0c1;
    --primary: #66a5e8;
    --primary-strong: #a8d0ff;
    --accent: #32c997;
    --accent-soft: #12382e;
    --shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Inter, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    letter-spacing: 0;
}

.auth-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(17, 58, 35, .96), rgba(47, 125, 50, .90)),
        radial-gradient(circle at 75% 18%, rgba(230, 178, 46, .18), transparent 28%),
        var(--primary-strong);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-brand img {
    width: 54px;
    height: 54px;
    padding: 6px;
    border-radius: var(--radius);
    background: #fff;
}

.brand-logo-login {
    object-fit: contain;
    object-position: center;
}

.auth-brand strong,
.auth-brand span {
    display: block;
}

.auth-brand span,
.auth-heading p,
.auth-form label span {
    color: var(--muted);
}

.auth-heading {
    margin-bottom: 22px;
}

.auth-heading p {
    margin-top: 10px;
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0 12px;
    outline: none;
}

.auth-form small {
    color: #b42318;
}

.auth-check {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-content: start;
}

.auth-check input {
    width: 16px;
    height: 16px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: 92px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 24px 16px;
    background: linear-gradient(180deg, #16361a 0%, #204924 100%);
    color: #f4faf4;
    box-shadow: 2px 0 18px rgba(22, 37, 25, .10);
    overflow-y: auto;
}

body.sidebar-collapsed .sidebar {
    padding-inline: 10px;
}

body.sidebar-collapsed .brand div,
body.sidebar-collapsed .nav-item span:not(.nav-icon),
body.sidebar-collapsed .sidebar-footer div {
    display: none;
}

body.sidebar-collapsed .brand {
    justify-content: center;
    padding-inline: 0;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-inline: 0;
}

body.sidebar-collapsed .nav-item.active::before {
    display: none;
}

body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
}

/* Mobile sidebar overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 99;
}

body.sidebar-open .overlay {
    display: block;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    padding-bottom: 18px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    padding: 6px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
}

.brand strong,
.brand span,
.sidebar-footer strong,
.sidebar-footer span {
    display: block;
}

.brand span,
.sidebar-footer span {
    margin-top: 3px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    font-weight: 500;
}

.brand strong {
    font-size: 16px;
    font-weight: 700;
}

.nav-list {
    display: grid;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .78);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .10);
    color: #fff;
    transform: translateX(2px);
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.nav-item.active {
    font-weight: 700;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #8ebf88;
    border-radius: 0 10px 10px 0;
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: #dceee0;
    background: rgba(255, 255, 255, .05);
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #7ed38d;
    box-shadow: 0 0 0 4px rgba(126, 211, 141, .16);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.workspace {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: space-between;
    min-height: 84px;
    padding: 16px 30px;
    border-bottom: 1px solid #dbe4da;
    border-top: 1px solid #edf2f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
    color: #111827;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}

.topbar-intro {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.sidebar-toggle {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(47, 73, 55, .14);
    border-radius: 15px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f7faf8 100%);
    display: inline-grid;
    place-items: center;
    gap: 4px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.sidebar-toggle:hover {
    border-color: rgba(47, 125, 50, .24);
    background: linear-gradient(180deg, #ffffff 0%, #eef7f0 100%);
    box-shadow: 0 16px 30px rgba(15, 23, 42, .11), inset 0 1px 0 rgba(255, 255, 255, .95);
    transform: translateY(-1px);
}

.sidebar-toggle.is-active {
    border-color: rgba(47, 125, 50, .28);
    background: linear-gradient(135deg, #22492f 0%, #2f7d32 100%);
    box-shadow: 0 14px 28px rgba(47, 125, 50, .20), inset 0 1px 0 rgba(255, 255, 255, .14);
}

.sidebar-toggle.is-active span {
    background: #ffffff;
}

.sidebar-toggle span {
    width: 20px;
    height: 2.5px;
    border-radius: 999px;
    background: #384b3e;
    display: block;
    transition: background .18s ease, width .18s ease;
}

.sidebar-toggle span:nth-child(2) {
    width: 16px;
}

.sidebar-toggle:hover span:nth-child(2) {
    width: 20px;
}

.topbar-title {
    min-width: 0;
}

.topbar-title span {
    display: block;
    color: #6e7784;
    font-size: 13px;
    font-weight: 700;
}

.topbar-title h1 {
    margin: 2px 0 3px;
    color: #111827;
    font-size: clamp(20px, 1.8vw, 28px);
    line-height: 1.18;
    letter-spacing: -.015em;
}

.topbar-title small {
    color: #738091;
    font-size: 13px;
    line-height: 1.45;
}

.topbar,
.topbar a,
.topbar button,
.topbar input,
.user-chip strong,
.user-chip small {
    color: inherit;
}

.global-search {
    width: min(680px, 100%);
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid #d8e1ec;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 8px 18px rgba(15, 23, 42, .04);
}

.global-search span {
    color: #6b7786;
    font-weight: 600;
}

.global-search input::placeholder {
    color: #9aa5b2;
}

.global-search input,
.filter-bar input,
.filter-bar select,
.archive-form input,
.archive-form select,
.form-grid textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0 12px;
    outline: none;
}

.form-grid textarea {
    min-height: auto;
    padding: 12px;
    line-height: 1.55;
    resize: vertical;
}

.global-search input {
    border: 0;
    padding: 0;
    color: #0f172a;
}

.global-search input:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.archive-form input:focus,
.archive-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-quick-actions .primary-button,
.topbar-quick-actions .secondary-button {
    min-height: 38px;
    padding-inline: 14px;
    white-space: nowrap;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid #d5dee8;
    border-radius: 14px;
    color: #334155;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(15, 23, 42, .05);
}

.icon-button:hover {
    background: #f2f5f9;
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

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

.user-chip > span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #647c34, #8a9b43);
    color: #fff;
    font-weight: 800;
}

.user-chip strong {
    font-size: 14px;
}

.user-chip small {
    font-size: 12px;
    opacity: .88;
}

.user-chip strong,
.user-chip small {
    display: block;
}

.user-chip small {
    margin-top: 2px;
    color: #758191;
}

.icon-button,
.ghost-button {
    border-color: #d5dee8;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.icon-button:hover {
    background: #f2f5f9;
}

.ghost-button {
    color: #fff;
    border-color: rgba(24, 64, 38, .18);
    background: linear-gradient(135deg, #16361a 0%, #22492f 100%);
    box-shadow: 0 10px 20px rgba(22, 54, 26, .16);
}

.ghost-button:hover {
    background: linear-gradient(135deg, #102712 0%, #1d3e28 100%);
    box-shadow: 0 14px 26px rgba(22, 54, 26, .22);
}

.global-search input::placeholder {
    color: rgba(255, 255, 255, .84);
}

.global-search span {
    color: rgba(255, 255, 255, .88);
}

.content {
    padding: 30px 36px 42px;
    background: linear-gradient(180deg, #f5f7fb 0%, #f7fafc 100%);
}

.breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 26px;
    font-size: 14px;
    color: var(--muted);
}

.breadcrumb-bar a {
    color: #3d6f47;
    font-weight: 600;
}

.breadcrumb-bar span:last-child {
    color: #9aa3b2;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 30px;
}

.dashboard-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 28px;
    border: 1px solid rgba(32, 48, 40, .06);
    border-radius: 18px;
    background:
        radial-gradient(circle at 88% 18%, rgba(245, 158, 11, .18), transparent 24%),
        linear-gradient(135deg, #ffffff 0%, #f3faf4 100%);
    box-shadow: 0 12px 28px rgba(22, 37, 25, .06);
}

.dashboard-hero h1 {
    max-width: 760px;
    font-size: clamp(30px, 3.2vw, 44px);
}

.dashboard-hero p {
    max-width: 760px;
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.7;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    margin-top: 6px;
    font-size: 28px;
    line-height: 1.2;
}

h2 {
    font-size: 17px;
}

.primary-button,
.secondary-button,
.ghost-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.primary-button {
    background: linear-gradient(135deg, #4f8f5f, #3e7f54);
    color: #fff;
    box-shadow: 0 12px 22px rgba(61, 124, 58, .16);
}

.secondary-button {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

.ghost-button {
    min-height: 34px;
    color: #fff;
    background: transparent;
    border-color: rgba(255, 255, 255, .24);
}

.text-link,
.icon-link {
    color: var(--primary);
    font-weight: 700;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    min-height: 146px;
    display: grid;
    align-content: space-between;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, .14), 0 8px 16px rgba(15, 23, 42, .08);
    padding: 20px 22px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle at 100% 0, rgba(255, 255, 255, .20), transparent 72%);
    pointer-events: none;
}

.stat-card::after {
    content: "";
    display: none;
}

.stat-card:hover {
    box-shadow: 0 22px 42px rgba(15, 23, 42, .16), 0 8px 18px rgba(15, 23, 42, .10);
    transform: translateY(-2px);
}

.stat-card span,
.stat-card small {
    color: rgba(255, 255, 255, .92);
    display: block;
    position: relative;
    z-index: 1;
}

.stat-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    min-height: 66px;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.stat-card span {
    max-width: 170px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.12;
}

.stat-card strong {
    display: block;
    margin: 2px 0 4px;
    font-size: clamp(32px, 2.8vw, 42px);
    line-height: 1;
    color: #fff;
    position: relative;
    z-index: 1;
}

.stat-card small {
    max-width: 210px;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 600;
}

.stat-icon {
    justify-self: end;
    width: clamp(50px, 4.4vw, 60px);
    height: clamp(50px, 4.4vw, 60px);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 20px;
    background: rgba(255, 255, 255, .16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 12px 22px rgba(0, 0, 0, .08);
    backdrop-filter: blur(8px);
}

.stat-icon svg {
    display: block;
    width: clamp(22px, 2vw, 26px);
    height: clamp(22px, 2vw, 26px);
    transform: translateY(7px);
    fill: rgba(255, 255, 255, .92);
}

.stat-card:nth-child(1) {
    background: linear-gradient(135deg, #4a90e2 0%, #2f80ed 100%);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #39c46f 0%, #2fbf71 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #ef6767 0%, #ef3f45 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #ffc342 0%, #f6a600 100%);
}

.stat-card:nth-child(1) span,
.stat-card:nth-child(1) small,
.stat-card:nth-child(1) strong,
.stat-card:nth-child(1) .stat-icon svg,
.stat-card:nth-child(2) span,
.stat-card:nth-child(2) small,
.stat-card:nth-child(2) strong,
.stat-card:nth-child(2) .stat-icon svg,
.stat-card:nth-child(3) span,
.stat-card:nth-child(3) small,
.stat-card:nth-child(3) strong,
.stat-card:nth-child(3) .stat-icon svg,
.stat-card:nth-child(4) span,
.stat-card:nth-child(4) small,
.stat-card:nth-child(4) strong {
    color: #fff;
}

.stat-card:nth-child(4) .stat-icon svg {
    fill: rgba(255, 255, 255, .92);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.admin-overview-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr);
}

.insight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-work-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
}

.panel {
    background: var(--surface);
    border: 1px solid rgba(32, 48, 40, .06);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(22, 37, 25, .05);
    padding: 24px;
    transition: all 0.2s ease;
}

.panel:hover {
    border-color: rgba(47, 125, 50, .12);
    box-shadow: 0 14px 30px rgba(22, 37, 25, .08);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(32, 48, 40, .06);
}

.panel-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -.01em;
}

.panel-title::before {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 7px;
    background: linear-gradient(135deg, rgba(79, 143, 95, .14), rgba(79, 143, 95, .28));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 4px 10px rgba(62, 127, 84, .10);
}

.panel-header p {
    color: #667085;
    line-height: 1.55;
    max-width: 42rem;
}

.chart-panel canvas {
    width: 100%;
    max-height: 320px;
}

.chart-panel {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.drive-tree {
    display: grid;
    gap: 8px;
}

.drive-health-panel {
    display: flex;
    flex-direction: column;
}

.drive-health {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.drive-health div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid rgba(32, 48, 40, .06);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
}

.drive-health span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.drive-health strong {
    color: var(--text);
}

.drive-health-panel .secondary-button {
    margin-top: auto;
}

.metric-list {
    display: grid;
    gap: 14px;
}

.metric-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
}

.metric-row strong,
.metric-row span,
.metric-row b {
    display: block;
}

.metric-row strong {
    color: var(--text);
}

.metric-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.metric-row b {
    color: var(--primary);
}

.metric-bar {
    grid-column: 1 / -1;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf4ec;
}

.metric-bar span {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f8f5f, #8ebf88);
}

.metric-bar.full span {
    background: linear-gradient(90deg, #3b82f6, #22c55e);
}

.year-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.year-stack div {
    min-height: 82px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 14px;
    border: 1px solid rgba(32, 48, 40, .06);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
}

.year-stack span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.year-stack strong {
    color: var(--text);
    font-size: 26px;
}

.service-row {
    align-items: center;
}

.service-row small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    line-height: 1.35;
}

.activity-feed {
    display: grid;
    gap: 14px;
}

.activity-feed div {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 8px 12px;
    align-items: start;
}

.activity-feed div > span {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 999px;
    background: #4f8f5f;
    box-shadow: 0 0 0 4px rgba(79, 143, 95, .12);
}

.activity-feed p,
.activity-feed small {
    grid-column: 2;
}

.activity-feed p {
    margin: 0;
    color: var(--text);
    line-height: 1.45;
}

.activity-feed small {
    color: var(--muted);
}

.activity-feed .empty-mini {
    min-height: 128px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.6;
}

.empty-mini {
    min-height: 90px;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #fbfdfb;
    padding: 16px 18px;
    line-height: 1.5;
}

.tree-row {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
    font-size: 13px;
    transition: all .18s ease;
}

.tree-row:not(.muted):hover {
    transform: translateX(2px);
    background: color-mix(in srgb, var(--surface-soft) 70%, #ffffff);
}

.tree-row.root {
    color: #fff;
    background: linear-gradient(135deg, #2f5f3a, #23492f);
}

.tree-row.muted {
    color: var(--muted);
    background: transparent;
    border: 1px dashed var(--line);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(32, 48, 40, .08);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.data-table tbody tr:hover {
    background: rgba(79, 143, 95, .04);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #eef7f0 0%, #e6f3e9 100%);
    color: #3e7f54;
    font-size: 12px;
    font-weight: 800;
}

.empty-state {
    height: 180px;
    color: var(--muted);
    text-align: center;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px 180px 150px auto;
    gap: 10px;
    margin-bottom: 16px;
}

.archive-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .75fr);
    gap: 16px;
}

.preview-panel {
    min-height: 640px;
}

.preview-panel iframe {
    width: 100%;
    height: 560px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.pagination-shell {
    margin-top: 16px;
    color: var(--muted);
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.form-grid label.wide {
    grid-column: 1 / -1;
}

.setting-logo-preview {
    width: 88px;
    height: 88px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    padding: 10px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.setting-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

input[readonly] {
    background: #f8fafc;
    color: #64748b;
    border-style: dashed;
}

.upload-zone {
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.upload-zone small {
    color: var(--muted);
    font-weight: 500;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.upload-guidance h2 {
    margin-bottom: 16px;
}

.flash-message {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
}

.error-message {
    border-color: rgba(180, 35, 24, .22);
    background: #fff1f0;
    color: #b42318;
}

.setting-drive-panel {
    margin-bottom: 24px;
}

.portal-bottom-panel {
    margin: 24px 0;
}

.portal-bottom-form code {
    color: #3e7f54;
    font-weight: 800;
}

.connection-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.connection-badge.is-connected {
    background: #e8f4ea;
    color: #2f7d32;
}

.connection-badge.is-pending {
    background: #fff7e5;
    color: #9a6700;
}

.drive-setting-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .75fr);
    gap: 22px;
}

.setting-help,
.field-error {
    font-size: 12px;
    line-height: 1.5;
}

.setting-help {
    color: #6b7280;
}

.field-error {
    color: #b42318;
}

.drive-status-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #fbfdfb 0%, #f4faf5 100%);
}

.drive-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(32, 48, 40, .06);
}

.drive-status-row span,
.drive-status-path span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.drive-status-row strong {
    color: var(--text);
}

.drive-status-path {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
}

.drive-status-card .secondary-button {
    width: 100%;
}

.gallery-management {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.gallery-thumb {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    transition: box-shadow 0.2s;
}

.gallery-thumb:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.gallery-thumb > div:last-child {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline div {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    align-items: start;
}

.timeline strong {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
}

.timeline span {
    color: var(--muted);
    line-height: 1.5;
}

.management-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.management-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-list {
    display: grid;
    gap: 8px;
}

.list-row {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.list-row strong {
    color: var(--text);
}

.list-row span {
    color: var(--muted);
    text-align: right;
}

.service-filter {
    grid-template-columns: 220px auto;
    justify-content: start;
}

code {
    color: var(--primary);
    white-space: normal;
    word-break: break-word;
}

.drive-mini-meta {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    padding: 14px;
    border: 1px dashed rgba(47, 125, 50, .18);
    border-radius: 14px;
    background: rgba(255, 255, 255, .62);
}

.drive-mini-meta span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.drive-mini-meta strong {
    color: var(--text);
    word-break: break-word;
}

.admin-security-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
}

.security-check-list,
.admin-action-list {
    display: grid;
    gap: 10px;
}

.security-check-list div {
    min-height: 48px;
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(32, 48, 40, .07);
    background: #fbfdfb;
}

.security-check-list span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 900;
}

.security-check-list .is-ok span {
    color: #236b36;
    background: #e8f4ea;
}

.security-check-list .is-warning span {
    color: #9a6700;
    background: #fff7e5;
}

.security-check-list strong {
    color: var(--text);
    line-height: 1.4;
}

.admin-action-list a {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    border: 1px solid rgba(32, 48, 40, .08);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #f8fbf8 100%);
    color: var(--text);
    font-weight: 800;
}

.admin-action-list a::after {
    content: ">";
    color: var(--primary);
}

.drive-setup-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.drive-setup-strip div {
    min-height: 84px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(32, 48, 40, .08);
    border-radius: 14px;
    background: #fff;
}

.drive-setup-strip span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #9a6700;
    background: #fff7e5;
    font-size: 12px;
    font-weight: 900;
}

.drive-setup-strip strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
}

.drive-setup-strip .is-done {
    border-color: rgba(47, 125, 50, .20);
    background: linear-gradient(180deg, #ffffff 0%, #eef8f0 100%);
}

.drive-setup-strip .is-done span {
    color: #fff;
    background: #2f7d32;
}

.drive-vault-card {
    border-color: rgba(47, 125, 50, .14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}

/* Tablet landscape - 2 column stat grid */
@media (max-width: 1180px) and (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .admin-overview-grid,
    .insight-grid,
    .admin-work-grid,
    .management-grid,
    .management-grid.two,
    .archive-workbench,
    .form-layout {
        grid-template-columns: 1fr;
    }

    .drive-setting-grid {
        grid-template-columns: 1fr;
    }

    .drive-setup-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet portrait (768px+) - Start hiding sidebar */
@media (max-width: 1023px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        width: 280px;
        height: 100vh;
        border-radius: 0;
        background: linear-gradient(180deg, #16361a 0%, #204924 100%);
    }

    body.sidebar-open .sidebar {
        display: flex;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-item {
        font-size: 13px;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .admin-overview-grid,
    .insight-grid,
    .admin-work-grid,
    .management-grid,
    .management-grid.two,
    .archive-workbench,
    .form-layout {
        grid-template-columns: 1fr;
    }

    .drive-setting-grid {
        grid-template-columns: 1fr;
    }

    .drive-setup-strip,
    .admin-security-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 24px;
    }
}

/* Mobile landscape / Large phone (480px - 768px) - 1 column stat grid */
@media (max-width: 767px) and (min-width: 480px) {
    .filter-bar,
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .stat-card {
        min-height: 138px;
        padding: 18px;
        border-radius: 16px;
    }

    .stat-card strong {
        font-size: 34px;
    }

    .stat-card small {
        font-size: 13px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .content {
        padding: 16px;
    }

    .topbar {
        padding: 14px 16px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .topbar-quick-actions {
        width: 100%;
        order: 4;
        justify-content: flex-start;
    }

    .dashboard-hero {
        align-items: stretch;
        flex-direction: column;
        padding: 18px;
    }

    .quick-actions {
        justify-content: flex-start;
    }

    .page-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 15px;
    }

    .global-search {
        width: 100%;
        order: 3;
    }

    .global-search input {
        padding: 0 10px;
    }

    .icon-button {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .topbar-actions {
        gap: 8px;
        width: 100%;
        justify-content: flex-start;
    }

    table {
        font-size: 13px;
    }

    .panel {
        padding: 16px;
    }

    .chart-panel {
        min-height: 280px;
    }

    /* Auth page responsive - tablet/large phone */
    .auth-shell {
        padding: 24px;
    }

    .auth-card {
        width: min(440px, 100%);
        padding: 24px;
    }
}

/* Mobile phone (< 480px) - Full mobile optimization */
@media (max-width: 479px) {
    html {
        font-size: 14px;
    }

    .app-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        width: 100%;
        max-width: 280px;
        height: 100vh;
        border-radius: 0;
        background: linear-gradient(180deg, #16361a 0%, #204924 100%);
        box-shadow: 4px 0 16px rgba(0, 0, 0, .3);
        overflow-y: auto;
    }

    body.sidebar-open .sidebar {
        display: flex;
    }

    body.sidebar-open .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 99;
    }

    .brand {
        padding: 12px 8px;
        padding-bottom: 16px;
        gap: 10px;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
    }

    .brand strong {
        font-size: 14px;
    }

    .brand span {
        font-size: 11px;
    }

    .nav-list {
        gap: 2px;
    }

    .nav-item {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .nav-item span:last-child,
    .sidebar-footer,
    .user-chip div {
        display: none;
    }

    .workspace {
        display: flex;
        flex-direction: column;
    }

    .topbar {
        padding: 12px 14px;
        gap: 10px;
        flex-wrap: wrap;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        min-height: 52px;
    }

    .topbar-brand-section,
    .page-heading {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .topbar-brand-section button {
        flex-shrink: 0;
    }

    .global-search {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .global-search input {
        padding: 0 8px;
        font-size: 13px;
        min-height: 36px;
    }

    .topbar-actions {
        gap: 6px;
        flex-wrap: wrap;
        width: auto;
    }

    .topbar-quick-actions {
        order: 4;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .topbar-quick-actions .primary-button,
    .topbar-quick-actions .secondary-button {
        width: 100%;
    }

    .icon-button {
        width: 36px;
        height: 36px;
        font-size: 12px;
        border-width: 1px;
        padding: 0;
    }

    .topbar-actions .theme-toggle {
        display: none;
    }

    .user-menu {
        display: none;
    }

    .content {
        padding: 12px;
        flex: 1;
    }

    h1 {
        font-size: 18px;
        margin-top: 4px;
    }

    h2 {
        font-size: 14px;
    }

    p {
        font-size: 13px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card {
        min-height: 132px;
        padding: 18px;
        border-radius: 16px;
    }

    .stat-card-head {
        min-height: 44px;
        margin-bottom: 10px;
    }

    .stat-card strong {
        font-size: 34px;
        margin: 0 0 4px;
    }

    .stat-card span {
        max-width: 140px;
        font-size: 11px;
    }

    .stat-icon {
        width: 46px;
        height: 46px;
        border-radius: 15px;
    }

    .stat-icon svg {
        width: 19px;
        height: 19px;
    }

    .stat-card small {
        max-width: 190px;
        font-size: 13px;
        line-height: 1.3;
    }

    .dashboard-grid,
    .admin-overview-grid,
    .insight-grid,
    .admin-work-grid,
    .management-grid,
    .management-grid.two,
    .archive-workbench,
    .form-layout,
    .filter-bar,
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .panel {
        padding: 14px;
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .drive-setup-strip,
    .admin-security-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .drive-setup-strip div {
        min-height: auto;
        padding: 14px;
    }

    .dashboard-hero {
        padding: 16px;
        border-radius: 12px;
    }

    .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .panel-header {
        margin-bottom: 12px;
    }

    .panel-header h3 {
        font-size: 14px;
        margin: 0;
    }

    .chart-panel {
        min-height: 240px;
    }

    .chart-panel canvas {
        max-width: 100%;
    }

    table {
        font-size: 12px;
    }

    table td,
    table th {
        padding: 8px 6px;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    input,
    select,
    textarea {
        min-height: 42px;
        padding: 0 10px;
        font-size: 14px;
    }

    textarea {
        padding: 10px;
    }

    .primary-button,
    .secondary-button,
    .ghost-button {
        width: 100%;
        min-height: 40px;
        font-size: 13px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .flash-message {
        margin-bottom: 12px;
        padding: 12px;
        font-size: 13px;
    }

    /* Auth page mobile optimization */
    .auth-shell {
        padding: 16px;
    }

    .auth-card {
        width: 100%;
        padding: 20px;
        border-radius: 14px;
    }

    .auth-brand {
        gap: 10px;
        margin-bottom: 24px;
    }

    .auth-brand img {
        width: 48px;
        height: 48px;
        padding: 5px;
    }

    .auth-brand strong {
        font-size: 15px;
    }

    .auth-brand span {
        font-size: 12px;
    }

    .auth-heading {
        margin-bottom: 18px;
    }

    .auth-heading span.eyebrow {
        font-size: 11px;
    }

    .auth-heading h1 {
        font-size: 20px;
        margin-top: 6px;
    }

    .auth-heading p {
        font-size: 13px;
        margin-top: 8px;
    }

    .auth-form {
        gap: 12px;
    }

    .auth-form label {
        gap: 6px;
    }

    .auth-form label span {
        font-size: 13px;
    }

    .auth-form input[type="email"],
    .auth-form input[type="password"] {
        min-height: 42px;
        font-size: 14px;
    }

    .auth-check {
        margin-bottom: 4px;
    }

    .auth-check span {
        font-size: 13px;
    }

    .primary-button {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    .text-link {
        display: block;
        text-align: center;
        font-size: 13px;
        margin-top: 8px;
    }
}
