:root {
    --bg: #f6f7f2;
    --surface: #ffffff;
    --surface-2: #eef7f4;
    --ink: #17252a;
    --muted: #667085;
    --line: #d8ded8;
    --teal: #0f766e;
    --teal-dark: #0b5752;
    --green: #2f855a;
    --gold: #b7791f;
    --red: #b42318;
    --blue: #315cbb;
    --shadow: 0 14px 35px rgba(23, 37, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(238, 247, 244, 0.9), rgba(246, 247, 242, 0.8) 38rem),
        var(--bg);
}

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

a:hover {
    text-decoration: underline;
}

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 4vw, 3rem);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--ink);
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 8px;
    background: var(--teal);
    color: white;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    margin-top: 0.1rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topnav a,
.link-button {
    color: var(--ink);
    border: 0;
    background: transparent;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
}

.topnav a.active,
.topnav a:hover,
.link-button:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.page-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(1.2rem, 3vw, 2.5rem) 0 4rem;
}

.hero {
    min-height: calc(100vh - 8rem);
    display: grid;
    align-content: center;
    gap: 2rem;
}

.hero-copy {
    max-width: 760px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(15, 118, 110, 0.25);
    border-radius: 999px;
    color: var(--teal-dark);
    background: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.08;
}

h1 {
    margin-top: 0.75rem;
    max-width: 820px;
    font-size: clamp(2.25rem, 8vw, 5.3rem);
}

h2 {
    font-size: 1.1rem;
}

p {
    color: var(--muted);
    line-height: 1.6;
}

.hero p {
    max-width: 680px;
    font-size: 1.08rem;
}

.hero-actions,
.heading-actions,
.row-actions,
.file-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.55rem;
    padding: 0.62rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button.primary {
    background: var(--teal);
    color: white;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
}

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

.button.secondary {
    background: white;
    color: var(--ink);
    border-color: var(--line);
}

.button.ghost {
    background: transparent;
    color: var(--blue);
    border-color: rgba(49, 92, 187, 0.25);
}

.button.danger {
    background: #fff5f3;
    color: var(--red);
    border-color: #ffd6d1;
}

.trust-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
}

.trust-strip span {
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--muted);
    font-weight: 700;
}

.notice {
    margin: 0 0 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 8px 22px rgba(23, 37, 42, 0.05);
}

.notice p {
    margin: 0;
}

.notice.success {
    border-left-color: var(--green);
}

.notice.error {
    border-left-color: var(--red);
}

.notice.info {
    border-left-color: var(--blue);
}

.secret-panel {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.section-heading h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.subtle {
    margin: 0.35rem 0 0;
}

.split-layout,
.workspace-grid {
    display: grid;
    grid-template-columns: minmax(260px, 380px) 1fr;
    gap: 1rem;
    align-items: start;
}

.workspace-grid {
    grid-template-columns: 1.2fr 0.8fr;
    margin-bottom: 1rem;
}

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

.panel.wide {
    min-width: 0;
}

form.panel,
.panel form {
    display: grid;
    gap: 0.85rem;
}

label {
    display: grid;
    gap: 0.35rem;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 2.6rem;
    padding: 0.62rem 0.72rem;
    border: 1px solid #cdd5cf;
    border-radius: 8px;
    background: white;
    color: var(--ink);
}

input:focus {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    border-color: var(--teal);
}

.empty {
    margin: 0.75rem 0 0;
}

.table-list,
.file-list {
    display: grid;
    gap: 0.7rem;
}

.client-row,
.file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfa;
}

.client-row > *,
.file-row > *,
.file-main,
.row-actions,
.file-actions {
    min-width: 0;
}

.client-row strong,
.client-row small,
.file-main small {
    display: block;
}

.client-row small,
.row-meta small,
.file-main small,
.secret-panel small {
    color: var(--muted);
}

.auth-panel {
    min-height: calc(100vh - 9rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: clamp(1rem, 5vw, 4rem);
    align-items: center;
}

.auth-panel h1 {
    font-size: clamp(2rem, 6vw, 4.2rem);
}

.drop-zone {
    min-height: 7rem;
    place-items: center;
    padding: 1rem;
    border: 1px dashed #aebbb2;
    border-radius: 8px;
    background: #fbfcfa;
    text-align: center;
    cursor: pointer;
}

.drop-zone.compact {
    min-height: 5rem;
}

.drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.drop-zone span {
    color: var(--teal-dark);
    font-weight: 800;
}

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

.progress {
    height: 0.6rem;
    overflow: hidden;
    border-radius: 999px;
    background: #dce5df;
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--gold));
    transition: width 0.2s ease;
}

.files-panel {
    margin-top: 1rem;
}

.file-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.file-kind {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--teal-dark);
    font-size: 0.76rem;
    font-weight: 800;
}

.file-name {
    display: block;
    overflow-wrap: anywhere;
    color: var(--ink);
}

.rename-details {
    position: relative;
}

.rename-details summary {
    min-height: 2.55rem;
    padding: 0.62rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 700;
}

.rename-details form {
    position: absolute;
    right: 0;
    z-index: 4;
    width: min(20rem, 78vw);
    margin-top: 0.4rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
}

.toast-region {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 40;
    display: grid;
    gap: 0.55rem;
    width: min(26rem, calc(100vw - 2rem));
}

.toast {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background: var(--ink);
    color: white;
    box-shadow: var(--shadow);
}

code {
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    background: #edf1ec;
}

@media (max-width: 820px) {
    .topbar,
    .section-heading,
    .auth-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        position: static;
    }

    .topnav,
    .heading-actions {
        justify-content: flex-start;
    }

    .auth-panel,
    .split-layout,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .client-row,
    .file-row {
        grid-template-columns: 1fr;
    }

    .row-actions,
    .file-actions {
        justify-content: flex-start;
    }

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

@media (max-width: 680px) {
    .topbar {
        gap: 0.75rem;
        padding: 0.72rem 0.9rem;
    }

    .brand {
        min-width: 0;
    }

    .brand strong {
        overflow-wrap: anywhere;
    }

    .topnav {
        width: auto;
        margin-left: auto;
    }

    .topnav a,
    .topnav .link-button {
        width: auto;
        padding: 0.55rem 0.45rem;
    }

    .page-shell {
        width: min(100% - 1rem, 1180px);
        padding-top: 1rem;
    }

    .section-heading {
        gap: 0.85rem;
        margin-bottom: 0.85rem;
    }

    .section-heading h1,
    .auth-panel h1 {
        font-size: clamp(1.7rem, 9vw, 2.35rem);
    }

    .section-heading .eyebrow {
        font-size: 0.7rem;
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions .button {
        flex: 1 1 9rem;
    }

    .workspace-grid {
        gap: 0.75rem;
    }

    .panel {
        padding: 0.85rem;
    }

    .upload-panel {
        order: 0;
    }

    .drop-zone {
        min-height: 6.2rem;
        padding: 0.85rem;
    }

    .drop-zone.compact {
        min-height: 4.7rem;
    }

    .client-row,
    .file-row {
        gap: 0.7rem;
        padding: 0.8rem;
    }

    .file-main small {
        overflow-wrap: anywhere;
    }

    .row-actions,
    .file-actions {
        width: 100%;
    }

    .row-actions > *,
    .file-actions > *,
    .file-actions .button,
    .rename-details {
        width: 100%;
    }

    .row-actions,
    .file-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .rename-details form {
        position: static;
        width: 100%;
        margin-top: 0.5rem;
        box-shadow: none;
    }

    .rename-details summary {
        width: 100%;
    }

    .file-kind {
        margin-bottom: 0.35rem;
    }

    .notice {
        padding: 0.8rem;
    }
}

@media (max-width: 520px) {
    .page-shell {
        width: min(100% - 1rem, 1180px);
    }

    .brand small,
    .row-meta {
        display: none;
    }

    .button {
        width: 100%;
    }

    .topnav a,
    .topnav .link-button {
        width: auto;
    }
}
