:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #697386;
    --line: #dfe4ec;
    --soft: #f3f6fa;
    --paper: #ffffff;
    --brand: #2457e6;
    --brand-dark: #1943bc;
    --brand-soft: #eaf0ff;
    --danger: #c42b3a;
    --success: #087e5b;
    --warning: #a15c00;
    --radius: 16px;
    --shadow: 0 16px 50px rgba(28, 42, 73, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #f7f9fc; }

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% -10%, rgba(36, 87, 230, .11), transparent 30rem),
        #f7f9fc;
    color: var(--ink);
    line-height: 1.5;
}

a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(223, 228, 236, .82);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(18px);
}

.header-inner {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.03em;
    text-decoration: none;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--ink);
    color: #fff;
    font-size: 17px;
    box-shadow: 0 7px 18px rgba(23, 32, 51, .18);
}

.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav > a, .nav-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #4c586e;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}
.main-nav > a:hover, .nav-button:hover { background: var(--soft); color: var(--ink); }
.main-nav form { margin: 0; }
.main-nav .nav-user { color: var(--brand); }

.page { padding-block: 46px 80px; }
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    overflow-x: auto;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    scrollbar-width: thin;
}
.breadcrumbs a { color: var(--brand); font-weight: 680; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs strong { color: var(--ink); }
.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 36px;
    margin-bottom: 28px;
}
.compact-heading { align-items: center; max-width: 820px; margin-inline: auto; }
.page-heading h1 { margin: 2px 0 6px; font-size: clamp(31px, 5vw, 46px); line-height: 1.08; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 16px; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.disk-card {
    width: min(100%, 320px);
    flex: 0 0 320px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 8px 30px rgba(28, 42, 73, .05);
}
.disk-topline { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.disk-topline span, .disk-card small { color: var(--muted); }
.disk-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.disk-summary strong { color: var(--brand); font-size: 12px; white-space: nowrap; }
progress {
    width: 100%;
    height: 8px;
    display: block;
    margin: 12px 0 8px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #e8edf5;
    accent-color: var(--brand);
}
progress::-webkit-progress-bar { background: #e8edf5; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }

.upload-panel {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--paper);
    box-shadow: var(--shadow);
}
.drop-zone {
    min-height: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    border: 2px dashed #b8c5dc;
    border-radius: 15px;
    background: linear-gradient(135deg, #f7f9ff, #f2f6ff);
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone strong { margin: 13px 0 4px; font-size: 20px; letter-spacing: -.02em; }
.drop-zone > span:not(.upload-icon) { color: var(--muted); }
.drop-zone small { margin-top: 16px; color: #8290a7; }
.upload-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: var(--brand);
    color: white;
    font-size: 27px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(36, 87, 230, .25);
}

.upload-queue:empty { display: none; }
.upload-queue { display: grid; gap: 8px; padding: 10px 3px 2px; }
.upload-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 3px 2px;
}
.upload-actions > .button { flex: 0 0 auto; }
.folder-create-form {
    min-width: 320px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.folder-create-form input[type="text"] { min-height: 42px; }
.queue-item { padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.queue-topline { display: flex; justify-content: space-between; gap: 20px; font-size: 13px; }
.queue-topline strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-topline span { color: var(--muted); white-space: nowrap; }
.queue-item small { color: var(--muted); }
.queue-item progress { margin-block: 8px 6px; }
.queue-item.is-complete { background: #e8f7f1; }
.queue-item.is-complete progress { accent-color: var(--success); }
.queue-item.is-error { background: #fff0f1; }
.queue-item.is-error .queue-topline span, .queue-item.is-error small { color: var(--danger); }

.section-heading { margin: 40px 0 14px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.directory-heading { display: grid; gap: 10px; }
.directory-navigation { min-width: 0; flex-wrap: wrap; }
.up-button { flex: 0 0 auto; white-space: nowrap; }
.count-badge { min-width: 27px; padding: 3px 8px; border-radius: 99px; background: #e9edf4; color: #59667a; font-size: 12px; font-weight: 750; text-align: center; }

.file-list, .user-list { display: grid; gap: 9px; }
.file-list.with-folders { margin-top: 16px; }
.folder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.folder-row {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    min-height: 78px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    transition: box-shadow .18s ease, border-color .18s ease;
}
.folder-row:hover { border-color: #cbd4e2; box-shadow: 0 8px 26px rgba(27, 40, 68, .055); }
.folder-symbol {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #fff4d5;
    color: #bd7b00;
    font-size: 21px;
}
.folder-primary { min-width: 0; display: grid; gap: 3px; }
.folder-primary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-primary small { color: var(--muted); font-size: 12px; }
.folder-arrow { color: #8b97aa; font-size: 25px; }
.file-row, .user-row {
    min-height: 78px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 15px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    transition: box-shadow .18s ease, border-color .18s ease;
}
.file-row:hover, .user-row:hover { border-color: #cbd4e2; box-shadow: 0 8px 26px rgba(27, 40, 68, .055); }
.file-symbol, .avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .04em;
}
.avatar { border-radius: 50%; font-size: 16px; }
.file-primary, .user-primary { min-width: 0; display: grid; gap: 4px; }
.file-name { overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 720; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: var(--brand); }
.file-meta { display: flex; flex-wrap: wrap; gap: 5px 13px; color: var(--muted); font-size: 12px; }
.file-meta span:not(:first-child)::before { content: "·"; margin-right: 13px; color: #b1bac8; }
.file-actions { display: flex; align-items: center; gap: 7px; }
.file-actions form { margin: 0; }

.button, .icon-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-weight: 720;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}
.button-primary { background: var(--brand); color: #fff; box-shadow: 0 7px 18px rgba(36, 87, 230, .18); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { border-color: var(--line); background: var(--paper); color: #49566b; }
.button-secondary:hover { border-color: #bfc9d9; background: var(--soft); }
.button-danger { background: #fff0f1; color: var(--danger); }
.button-small { min-height: 34px; padding-inline: 11px; border-radius: 9px; font-size: 12px; }
.button-wide { width: 100%; margin-top: 4px; }
.icon-button { width: 34px; min-height: 34px; padding: 0; border-color: var(--line); background: white; color: #526078; font-size: 18px; }
.icon-button.danger { color: var(--danger); }

.empty-state { min-height: 170px; display: grid; place-content: center; gap: 4px; border: 1px dashed #cdd5e2; border-radius: 15px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 17px; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.form-panel { max-width: 820px; margin-inline: auto; padding: clamp(22px, 5vw, 36px); }
.stack-form { display: grid; gap: 20px; }
.stack-form label:not(.check-label) { display: grid; gap: 7px; color: #37445a; font-size: 13px; font-weight: 700; }
.stack-form label small { color: var(--muted); font-weight: 500; }
input[type="text"], input[type="password"], select {
    width: 100%;
    min-height: 48px;
    padding: 0 13px;
    border: 1px solid #cdd5e2;
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36, 87, 230, .12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.check-label { display: flex; align-items: center; gap: 9px; color: #3e4c62; font-size: 14px; font-weight: 650; cursor: pointer; }
.check-label input { width: 18px; height: 18px; accent-color: var(--brand); }

.auth-wrap { min-height: calc(100vh - 166px); display: grid; place-items: center; }
.auth-card { width: min(100%, 450px); padding: clamp(28px, 7vw, 46px); border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, .93); box-shadow: 0 24px 70px rgba(30, 47, 79, .12); }
.auth-card h1 { margin: 5px 0 7px; font-size: 34px; letter-spacing: -.04em; }
.auth-card .muted { margin: 0 0 28px; color: var(--muted); }

.alert { max-width: 820px; margin: 0 auto 18px; padding: 13px 15px; border: 1px solid transparent; border-radius: 12px; font-size: 14px; }
.alert-error { border-color: #f4c1c6; background: #fff0f1; color: #8e1d29; }
.alert-success { border-color: #aee1ce; background: #e9f8f2; color: #086549; }
.alert-info { border-color: #bfd0fb; background: #edf3ff; color: #234aa8; }

.user-row { grid-template-columns: auto minmax(180px, 1fr) auto auto; }
.user-primary span { color: var(--muted); font-size: 12px; }
.status-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.status { padding: 4px 8px; border-radius: 99px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-active { background: #e8f7f1; color: var(--success); }
.status-off { background: #eef1f5; color: #667287; }
.status-warn { background: #fff4dc; color: var(--warning); }

.text-heading { max-width: none; }
.text-preview {
    max-height: calc(100vh - 250px);
    margin: 0;
    padding: 20px;
    overflow: auto;
    border: 1px solid #2c3547;
    border-radius: 14px;
    background: #111827;
    color: #d8e1f0;
    font: 13px/1.65 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 850px) {
    .page-heading { align-items: stretch; flex-direction: column; gap: 20px; }
    .disk-card { width: 100%; flex-basis: auto; }
    .user-row { grid-template-columns: auto 1fr auto; }
    .user-row .status-group { grid-column: 2 / 4; justify-content: flex-start; }
    .user-row .file-actions { grid-column: 2 / 4; }
    .file-row { grid-template-columns: auto minmax(0, 1fr); }
    .file-actions { grid-column: 1 / 3; justify-content: flex-end; border-top: 1px solid #edf0f5; padding-top: 10px; }
    .upload-actions { flex-wrap: wrap; }
    .folder-create-form { width: 100%; min-width: 0; margin-left: 0; }
}

@media (max-width: 620px) {
    .shell { width: min(100% - 24px, 1180px); }
    .header-inner { min-height: 62px; }
    .brand > span:last-child { display: none; }
    .brand-mark { width: 34px; height: 34px; }
    .main-nav { gap: 0; }
    .main-nav > a, .nav-button { min-height: 38px; padding: 0 8px; font-size: 12px; }
    .main-nav .nav-user { display: none; }
    .page { padding-block: 30px 54px; }
    .directory-navigation { align-items: stretch; }
    .directory-navigation .breadcrumbs { flex-basis: 100%; }
    .page-heading { margin-bottom: 22px; }
    .page-heading h1 { font-size: 33px; }
    .drop-zone { min-height: 205px; padding: 22px 14px; }
    .drop-zone strong { font-size: 18px; }
    .drop-zone small { font-size: 11px; }
    .upload-actions > .button { flex: 1; padding-inline: 10px; font-size: 13px; }
    .folder-create-form { align-items: stretch; flex-direction: column; }
    .folder-create-form .button { width: 100%; }
    .folder-list { grid-template-columns: 1fr; }
    .file-row, .user-row { padding: 11px; }
    .file-symbol, .avatar { width: 40px; height: 40px; }
    .file-meta { gap: 2px 8px; }
    .file-meta span:not(:first-child)::before { margin-right: 8px; }
    .file-actions { justify-content: stretch; overflow-x: auto; }
    .file-actions .button { flex: 1 0 auto; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions .button { flex: 1; }
    .auth-wrap { min-height: calc(100vh - 130px); }
    .auth-card { border-radius: 18px; }
    .text-preview { max-height: none; min-height: 50vh; padding: 14px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
