:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-muted: #eef2f7;
    --text: #182033;
    --muted: #647084;
    --line: #dfe5ef;
    --primary: #0f766e;
    --primary-strong: #0b5f59;
    --danger: #b42318;
    --danger-bg: #fee4e2;
    --warning-bg: #fff4d6;
    --warning-line: #f5c84c;
    --shadow: 0 12px 30px rgba(20, 31, 56, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

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

a:hover {
    text-decoration: underline;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 650;
}

label input,
label select,
label textarea {
    color: var(--text);
    font-weight: 450;
}

code {
    border-radius: 6px;
    background: var(--surface-muted);
    padding: 2px 5px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    letter-spacing: 0;
}

.logout-form {
    margin: 0;
}

.app-shell {
    width: min(1500px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.login-shell {
    display: grid;
    min-height: calc(100vh - 64px);
    place-items: center;
    padding: 24px;
}

.login-panel {
    display: grid;
    gap: 26px;
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-panel h1,
.hero-band h1,
.panel h2 {
    margin: 0;
}

.login-panel h1 {
    font-size: 34px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.flash-stack {
    position: fixed;
    top: 76px;
    right: 18px;
    z-index: 20;
    display: grid;
    gap: 10px;
    width: min(460px, calc(100vw - 36px));
}

.flash,
.notice {
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.flash-success {
    border-color: #9bd5c4;
    background: #ecfdf5;
}

.flash-error {
    border-color: #f1aaa4;
    background: #fff1f0;
}

.notice {
    margin-bottom: 18px;
}

.notice-warning {
    border-color: var(--warning-line);
    background: var(--warning-bg);
}

.hero-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.hero-band h1 {
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    color: var(--muted);
}

.stats-grid,
.workspace-grid,
.two-column {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stat,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.stat span,
.panel-heading p,
.detail-list dt,
.share-list small,
.usage-list span {
    color: var(--muted);
}

.stat strong {
    font-size: 24px;
}

.workspace-grid {
    grid-template-columns: minmax(0, 1fr) 390px;
    align-items: start;
}

.main-column,
.side-column,
.stack {
    display: grid;
    gap: 16px;
}

.two-column {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
}

.panel {
    padding: 18px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-heading p {
    margin: 4px 0 0;
}

.search-form,
.inline-form,
.button-row,
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-form {
    width: min(680px, 100%);
}

.search-form input {
    min-width: 220px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.button-primary {
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-strong);
}

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

.button-danger {
    border-color: #f1aaa4;
    background: var(--danger-bg);
    color: var(--danger);
}

.object-table {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.object-row {
    display: grid;
    grid-template-columns: 34px minmax(220px, 1fr) minmax(86px, 0.35fr) minmax(105px, 0.45fr) minmax(142px, 0.55fr) minmax(88px, 0.35fr);
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.object-row:last-child {
    border-bottom: 0;
}

.object-row:hover {
    background: #f8fbfc;
    text-decoration: none;
}

.object-head {
    min-height: 42px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.object-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.object-row strong,
.object-row small {
    display: block;
    overflow-wrap: anywhere;
}

.object-row small {
    margin-top: 4px;
    color: var(--muted);
    font-weight: 500;
}

.folder-row {
    background: #fbfefd;
}

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

.bulk-actions {
    justify-content: flex-end;
    margin-top: 12px;
}

.code-textarea {
    min-height: 300px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.detail-key {
    overflow-wrap: anywhere;
    border-radius: 8px;
    background: var(--surface-muted);
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.detail-list {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 0;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.pill {
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
}

.share-list,
.usage-list,
.billing-grid {
    display: grid;
    gap: 12px;
}

.billing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.billing-grid div {
    display: grid;
    gap: 4px;
    border-radius: 8px;
    background: var(--surface-muted);
    padding: 12px;
}

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

.share-list article,
.usage-list div {
    display: grid;
    gap: 6px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.share-list article:first-child,
.usage-list div:first-child {
    border-top: 0;
    padding-top: 0;
}

.share-list input {
    font-size: 12px;
}

@media (max-width: 1100px) {
    .workspace-grid,
    .stats-grid,
    .two-column {
        grid-template-columns: 1fr;
    }

    .side-column {
        order: -1;
    }
}

@media (max-width: 760px) {
    .topbar,
    .hero-band,
    .panel-heading,
    .search-form,
    .inline-form,
    .button-row,
    .bulk-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        position: static;
        gap: 12px;
        padding: 14px;
    }

    .app-shell {
        width: min(100% - 20px, 1500px);
        margin-top: 12px;
    }

    .hero-band {
        padding: 18px;
    }

    .search-form {
        width: 100%;
    }

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

    .object-row {
        grid-template-columns: 30px minmax(180px, 1fr) 86px 105px 142px 88px;
        min-width: 760px;
    }
}
