:root {
    --orange: #ff6600;
    --orange-dark: #dc5300;
    --orange-soft: #fff2e9;
    --charcoal: #333333;
    --charcoal-2: #444444;
    --ink: #272727;
    --muted: #777777;
    --line: #e8e5e2;
    --paper: #ffffff;
    --canvas: #f4f2ef;
    --success: #287a50;
    --danger: #b53b30;
    --shadow: 0 18px 55px rgba(51, 51, 51, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "Trebuchet MS", Trebuchet, Arial, sans-serif;
    line-height: 1.55;
}

button,
input,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

button,
summary,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(255, 102, 0, 0.35);
    outline-offset: 2px;
}

.eyebrow {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.eyebrow.orange {
    color: var(--orange);
}

.login-page {
    display: grid;
    place-items: center;
    padding: 28px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 102, 0, 0.24), transparent 34%),
        linear-gradient(135deg, #242424 0 45%, #333333 45% 100%);
}

.login-shell {
    width: min(100%, 1040px);
    min-height: 620px;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    overflow: hidden;
    border-radius: 6px;
    background: var(--paper);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 64px;
    overflow: hidden;
    color: white;
    background:
        linear-gradient(155deg, rgba(255, 102, 0, 0.98), rgba(220, 83, 0, 0.96)),
        var(--orange);
}

.brand-panel::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    right: -190px;
    bottom: -180px;
    border: 80px solid rgba(255, 255, 255, 0.09);
    border-radius: 50%;
}

.brand-mark,
.mini-mark {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    color: white;
    background: var(--charcoal);
}

.brand-mark {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    font-size: 35px;
    box-shadow: 0 10px 30px rgba(51, 51, 51, 0.24);
}

.brand-panel h1 {
    max-width: 390px;
    margin: 0;
    font-size: clamp(42px, 5.5vw, 60px);
    font-weight: 400;
    line-height: 0.92;
    letter-spacing: -0.055em;
}

.brand-panel h1 span {
    color: var(--charcoal);
    font-weight: 700;
}

.brand-copy {
    max-width: 400px;
    margin: 28px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 17px;
}

.sound-lines {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: end;
    gap: 8px;
    height: 44px;
}

.sound-lines i {
    display: block;
    width: 4px;
    border-radius: 4px;
    background: var(--charcoal);
}

.sound-lines i:nth-child(1) { height: 15px; }
.sound-lines i:nth-child(2) { height: 31px; }
.sound-lines i:nth-child(3) { height: 44px; }
.sound-lines i:nth-child(4) { height: 25px; }
.sound-lines i:nth-child(5) { height: 11px; }

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 72px 64px;
}

.login-card h2 {
    margin: 0;
    color: var(--charcoal);
    font-size: 32px;
    line-height: 1.15;
}

.subtle {
    margin: 14px 0 28px;
    color: var(--muted);
}

.mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 34px;
    color: var(--charcoal);
    font-size: 20px;
    font-weight: 700;
}

.mini-mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--charcoal);
    background: var(--orange);
    font-size: 19px;
}

.login-form {
    display: grid;
    gap: 10px;
}

label {
    color: var(--charcoal);
    font-size: 13px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid #d7d3cf;
    border-radius: 4px;
    color: var(--ink);
    background: white;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input {
    height: 46px;
    padding: 0 13px;
}

textarea {
    min-height: 86px;
    padding: 10px 13px;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.11);
    outline: none;
}

.login-form .button {
    margin-top: 14px;
}

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 9px 18px;
    border: 0;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

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

.button-primary {
    color: white;
    background: var(--orange);
}

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

.button-secondary {
    border: 1px solid #d9d4cf;
    color: var(--charcoal);
    background: white;
}

.button-secondary:hover {
    border-color: var(--orange);
    color: var(--orange);
}

.button-wide {
    width: 100%;
}

.button-small {
    min-height: 34px;
    padding: 6px 11px;
    color: white;
    background: var(--charcoal);
    font-size: 13px;
}

.security-note {
    margin: 30px 0 0;
    color: #999;
    font-size: 12px;
    text-align: center;
}

.security-note span {
    color: var(--success);
}

.alert {
    margin: 0 0 18px;
    padding: 12px 15px;
    border-left: 4px solid;
    border-radius: 3px;
    font-size: 14px;
}

.alert-error {
    border-color: var(--danger);
    color: #7d2b24;
    background: #fff0ee;
}

.alert-success {
    border-color: var(--success);
    color: #1f6541;
    background: #edf8f2;
}

.topbar {
    position: sticky;
    z-index: 50;
    top: 0;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    color: white;
    background: var(--charcoal);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

.top-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    font-size: 19px;
}

.top-brand b {
    color: var(--orange);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}

.role-pill,
.read-only-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--orange);
    background: rgba(255, 102, 0, 0.14);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.user-name {
    color: #ddd;
    font-size: 13px;
}

.logout-button {
    padding: 7px 10px;
    border: 1px solid #666;
    border-radius: 3px;
    color: white;
    background: transparent;
    cursor: pointer;
}

.logout-button:hover {
    border-color: var(--orange);
    color: var(--orange);
}

.portal-layout {
    min-height: calc(100vh - 66px);
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
    padding: 34px 20px;
    border-right: 1px solid #dedbd7;
    background: #ece9e5;
}

.sidebar-label {
    margin: 0 12px 12px;
    color: #8a8580;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
    padding: 12px;
    border-radius: 4px;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    color: var(--charcoal);
    background: white;
    box-shadow: 0 5px 18px rgba(51, 51, 51, 0.06);
}

.nav-item.active {
    box-shadow: inset 3px 0 0 var(--orange), 0 5px 18px rgba(51, 51, 51, 0.06);
}

.nav-item b,
.nav-item small {
    display: block;
}

.nav-item b {
    font-size: 14px;
}

.nav-item small {
    margin-top: 1px;
    color: #8b8783;
    font-size: 11px;
}

.folder-dot {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 2px;
}

.orange-dot { background: var(--orange); }
.dark-dot { background: var(--charcoal); }

.access-card {
    display: flex;
    gap: 11px;
    margin-top: 34px;
    padding: 16px;
    border: 1px solid #ddd4ca;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.48);
}

.access-card.board-card {
    border-color: #f0c4a7;
    background: var(--orange-soft);
}

.access-card b {
    font-size: 12px;
}

.access-card p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.access-icon {
    color: var(--orange);
    font-size: 16px;
}

.content {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 44px clamp(24px, 5vw, 74px) 70px;
}

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

.content-heading h1 {
    margin: 7px 0 4px;
    color: var(--charcoal);
    font-size: clamp(30px, 4vw, 42px);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.content-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #8a8580;
    font-size: 12px;
}

.breadcrumbs a {
    color: var(--orange);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

details > summary {
    list-style: none;
}

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

.create-menu,
.row-menu {
    position: relative;
}

.row-menu > summary {
    touch-action: manipulation;
    user-select: none;
}

.create-popover,
.row-popover {
    position: absolute;
    z-index: 30;
    right: 0;
    top: calc(100% + 8px);
    width: min(350px, calc(100vw - 40px));
    padding: 18px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--orange);
    border-radius: 3px;
    background: white;
    box-shadow: var(--shadow);
}

.create-popover form + form {
    margin-top: 17px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.create-popover label,
.row-popover label {
    display: block;
    margin-bottom: 6px;
}

.create-popover input,
.create-popover textarea {
    margin-bottom: 8px;
}

.inline-form {
    display: flex;
    gap: 6px;
}

.inline-form button {
    padding: 0 11px;
    border: 0;
    border-radius: 3px;
    color: white;
    background: var(--charcoal);
    cursor: pointer;
}

.upload-zone {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    padding: 22px;
    border: 1px dashed #c9c1b8;
    border-left: 4px solid var(--orange);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.64);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone.is-dragover {
    border-color: var(--orange);
    background: var(--orange-soft);
}

.upload-zone label {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
}

.upload-zone label b,
.upload-zone label small {
    display: block;
}

.upload-zone label small {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 400;
}

.upload-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.upload-icon {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: white;
    background: var(--orange);
    font-size: 24px;
}

.file-card {
    border: 1px solid #e0dcd8;
    border-radius: 4px;
    background: white;
    box-shadow: 0 12px 35px rgba(51, 51, 51, 0.07);
}

.file-card-head {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
}

.file-card-head h2 {
    margin: 0;
    font-size: 14px;
}

.read-only-badge {
    min-height: 24px;
}

.back-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-bottom: 1px solid var(--line);
    color: var(--orange);
    text-decoration: none;
    font-size: 12px;
}

.file-row {
    min-height: 68px;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px 100px 100px;
    align-items: center;
    gap: 14px;
    padding: 10px 22px;
    border-bottom: 1px solid var(--line);
}

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

.file-row:not(.table-head):hover {
    background: #fbfaf8;
}

.file-row.table-head {
    min-height: 39px;
    color: #908a84;
    background: #faf9f7;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.file-name-cell {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.file-name-cell > div {
    min-width: 0;
}

.file-name-cell a,
.file-name-cell small {
    display: block;
}

.file-name-cell a {
    overflow: hidden;
    color: var(--charcoal);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name-cell a:hover {
    color: var(--orange);
}

.file-name-cell small {
    margin-top: 1px;
    color: #9a958f;
    font-size: 10px;
}

.file-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 3px;
    font-size: 18px;
}

.folder-icon {
    color: var(--orange);
    background: var(--orange-soft);
}

.document-icon {
    color: var(--charcoal);
    background: #eeeae6;
}

.meta-cell {
    color: #837e78;
    font-size: 12px;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.icon-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #dfdbd6;
    border-radius: 3px;
    color: #6f6963;
    background: white;
    text-decoration: none;
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--orange);
    color: var(--orange);
}

.icon-button.download {
    color: var(--orange);
}

.row-popover {
    width: min(360px, calc(100vw - 40px));
    padding: 14px;
}

.row-popover textarea {
    margin: 8px 0;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.edit-text-details {
    margin: 13px 0;
    padding: 11px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.edit-text-details > summary {
    color: var(--orange);
    font-size: 13px;
    cursor: pointer;
}

.danger-action {
    padding: 7px 0;
    border: 0;
    color: var(--danger);
    background: transparent;
    cursor: pointer;
}

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

.empty-state > span {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin: 0 auto 15px;
    border: 1px solid #ded8d1;
    color: var(--orange);
    background: var(--orange-soft);
    font-size: 28px;
}

.empty-state h3 {
    margin: 0 0 5px;
    color: var(--charcoal);
    font-size: 16px;
}

.empty-state p {
    margin: 0;
    font-size: 13px;
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        max-width: 560px;
        min-height: 0;
    }

    .brand-panel {
        display: none;
    }

    .mobile-brand {
        display: flex;
    }

    .portal-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: flex;
        gap: 8px;
        padding: 12px 20px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid #dedbd7;
    }

    .sidebar-label,
    .access-card {
        display: none;
    }

    .nav-item {
        min-width: 190px;
        margin: 0;
    }

    .file-row {
        grid-template-columns: minmax(200px, 1fr) 120px 85px 86px;
    }
}

@media (max-width: 680px) {
    .login-page {
        padding: 14px;
        background: var(--charcoal);
    }

    .login-card {
        padding: 42px 28px;
    }

    .login-card h2 {
        font-size: 27px;
    }

    .topbar {
        height: auto;
        min-height: 66px;
        padding: 10px 16px;
    }

    .top-brand {
        font-size: 15px;
    }

    .top-brand b,
    .user-name,
    .role-pill {
        display: none;
    }

    .content {
        padding: 28px 14px 50px;
    }

    .content-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .create-menu > summary {
        width: 100%;
    }

    .create-popover {
        right: auto;
        left: 0;
    }

    .upload-zone {
        grid-template-columns: 1fr;
    }

    .upload-zone .button {
        width: 100%;
    }

    .file-row.table-head,
    .meta-cell {
        display: none;
    }

    .file-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 11px 13px;
    }

    .file-card-head {
        padding: 0 14px;
    }

    .back-row {
        padding-inline: 14px;
    }

    .row-popover {
        position: fixed;
        top: 78px;
        right: 14px;
        left: 14px;
        width: auto;
    }
}
