:root {
    --ink: #17211b;
    --muted: #667168;
    --paper: #f6f7f3;
    --surface: #ffffff;
    --line: #dfe4dd;
    --green: #175c42;
    --green-dark: #0e422f;
    --lime: #d8f56a;
    --peach: #ffad84;
    --danger: #a63030;
    --danger-soft: #fff0ed;
    --success-soft: #e7f7ee;
    --shadow: 0 18px 50px rgba(30, 48, 37, 0.09);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 11px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--paper);
    color: var(--ink);
}

button,
input {
    font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(23, 92, 66, 0.25);
    outline-offset: 3px;
}

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

.eyebrow {
    margin: 0 0 8px;
    color: var(--green);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand-mark {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 17px;
    background: var(--green);
    color: var(--lime);
    font-size: 1.3rem;
    font-weight: 900;
    transform: rotate(-3deg);
}

.brand-mark-small {
    width: 39px;
    height: 39px;
    border-radius: 12px;
    font-size: 1rem;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

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

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

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

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

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

.button-ghost {
    border-color: var(--line);
    background: transparent;
    color: var(--ink);
}

.button-danger {
    border-color: #efc8c2;
    background: var(--danger-soft);
    color: var(--danger);
}

.button-wide {
    width: 100%;
}

.alert {
    padding: 14px 17px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-weight: 650;
    line-height: 1.5;
}

.alert-success {
    border-color: #b8dfc8;
    background: var(--success-soft);
    color: #175436;
}

.alert-error {
    border-color: #efc8c2;
    background: var(--danger-soft);
    color: #842828;
}

/* Connexion */
.login-page {
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        radial-gradient(circle at 10% 15%, rgba(216, 245, 106, 0.18), transparent 27%),
        radial-gradient(circle at 90% 85%, rgba(255, 173, 132, 0.16), transparent 30%),
        var(--paper);
}

.login-shell {
    display: grid;
    width: min(1040px, 100%);
    min-height: 650px;
    grid-template-columns: minmax(0, 0.9fr) minmax(440px, 1.1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 34px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-shell-simple {
    width: min(470px, 100%);
    min-height: 0;
    grid-template-columns: 1fr;
}

.login-shell-simple .login-panel {
    min-height: 500px;
}

.login-shell-simple .login-panel h1 {
    margin-bottom: 34px;
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(38px, 7vw, 74px);
}

.login-panel .brand-mark {
    margin-bottom: 34px;
}

.login-panel h1 {
    max-width: 430px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.25rem, 5vw, 3.55rem);
    font-weight: 500;
    letter-spacing: -0.05em;
    line-height: 0.98;
}

.login-intro {
    max-width: 410px;
    margin: 20px 0 28px;
    color: var(--muted);
    line-height: 1.65;
}

.login-panel .alert {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.83rem;
    font-weight: 750;
}

.password-row {
    position: relative;
    margin-bottom: 14px;
}

.password-row input {
    width: 100%;
    height: 52px;
    padding: 0 90px 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfcfa;
    color: var(--ink);
}

.password-row input:focus {
    border-color: var(--green);
    background: #fff;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--green);
    cursor: pointer;
    font-weight: 750;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.login-footnote {
    margin: 25px 0 0;
    color: #8b948d;
    font-size: 0.78rem;
    text-align: center;
}

.login-visual {
    position: relative;
    min-height: 100%;
    overflow: hidden;
    background: var(--green);
    color: #fff;
}

.login-visual::after {
    position: absolute;
    inset: auto -80px -120px auto;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--lime);
    content: "";
    opacity: 0.9;
}

.login-visual p {
    position: absolute;
    right: 48px;
    bottom: 47px;
    z-index: 2;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.4rem);
    letter-spacing: -0.04em;
    line-height: 1.02;
    text-align: right;
}

.login-visual strong {
    color: var(--lime);
    font-weight: 500;
}

.visual-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.orbit-one {
    top: -80px;
    left: -130px;
    width: 520px;
    height: 520px;
}

.orbit-two {
    top: 40px;
    left: -30px;
    width: 330px;
    height: 330px;
}

.visual-card {
    position: absolute;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 20px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.visual-card-image {
    top: 88px;
    left: 55px;
    width: 185px;
    height: 145px;
    background: var(--peach);
    color: #612919;
    transform: rotate(-8deg);
}

.visual-card-video {
    top: 168px;
    right: 58px;
    width: 210px;
    height: 150px;
    background: #f5f0dc;
    color: var(--green);
    transform: rotate(6deg);
}

.visual-card-pdf {
    top: 305px;
    left: 95px;
    width: 140px;
    height: 110px;
    background: var(--lime);
    color: var(--green);
    transform: rotate(2deg);
}

/* Bibliothèque */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    padding: 12px clamp(20px, 5vw, 72px);
    border-bottom: 1px solid rgba(223, 228, 221, 0.9);
    background: rgba(246, 247, 243, 0.92);
    backdrop-filter: blur(16px);
}

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

.page-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.page-shell {
    width: min(1420px, calc(100% - 40px));
    margin: 0 auto;
    padding: clamp(38px, 6vw, 78px) 0 80px;
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    padding: 0 2px 42px;
}

.hero h1 {
    max-width: 820px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.7rem, 6vw, 5.8rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.95;
}

.hero > div > p:last-child {
    max-width: 650px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.04rem;
    line-height: 1.6;
}

.summary {
    display: flex;
    flex: 0 0 auto;
    gap: 9px;
    margin: 0;
}

.summary div {
    min-width: 118px;
    padding: 17px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.summary dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary dd {
    margin: 5px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    font-weight: 600;
}

.page-shell > .alert {
    margin-bottom: 16px;
}

.upload-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 22px 26px;
    border-radius: var(--radius-lg);
    background: var(--green);
    color: #fff;
    box-shadow: 0 14px 40px rgba(23, 92, 66, 0.14);
}

.upload-copy {
    display: flex;
    min-width: 290px;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 15px;
    background: var(--lime);
    color: var(--green);
    font-size: 1.55rem;
    font-weight: 900;
}

.upload-copy h2 {
    margin: 0;
    font-size: 1.02rem;
}

.upload-copy p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.upload-form {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 8px;
}

.file-picker {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 17px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 750;
}

.file-picker:hover {
    background: rgba(255, 255, 255, 0.16);
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.upload-form .button-primary {
    background: var(--lime);
    color: var(--green-dark);
}

.selected-files {
    grid-column: 1 / -1;
    margin: 2px 8px 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.77rem;
    text-align: right;
}

.selected-files.is-warning {
    color: #ffd2bf;
}

.library-section {
    padding-top: 58px;
}

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

.section-heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 500;
    letter-spacing: -0.04em;
}

.search-field input {
    width: min(280px, 34vw);
    height: 44px;
    padding: 0 17px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 19px;
}

.media-card {
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 21px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    box-shadow: 0 5px 17px rgba(31, 46, 37, 0.03);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.media-card:hover {
    border-color: #bec9bf;
    box-shadow: 0 16px 35px rgba(31, 46, 37, 0.09);
    transform: translateY(-3px);
}

.media-preview {
    position: relative;
    display: grid;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    place-items: center;
    background: #e9ece6;
}

.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease;
}

.media-card:hover .media-preview img,
.media-card:hover .media-preview video {
    transform: scale(1.025);
}

.media-preview-pdf {
    background: #ffebe3;
}

.file-glyph {
    display: grid;
    width: 78px;
    height: 98px;
    place-items: center;
    border-radius: 10px 18px 10px 10px;
    background: var(--surface);
    color: #ad4532;
    box-shadow: 0 13px 25px rgba(99, 43, 32, 0.11);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.play-badge {
    position: absolute;
    display: grid;
    width: 45px;
    height: 45px;
    place-items: center;
    padding-left: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--green);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.17);
    font-size: 0.8rem;
}

.type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    background: rgba(20, 31, 24, 0.68);
    color: #fff;
    font-size: 0.61rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.media-card-copy {
    display: block;
    padding: 15px 16px 17px;
}

.media-card-copy strong,
.media-card-copy > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-card-copy strong {
    font-size: 0.91rem;
}

.media-card-copy > span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.72rem;
}

.empty-state,
.no-results {
    padding: 72px 25px;
    border: 1px dashed #cbd2ca;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.45);
    text-align: center;
}

.empty-state h3 {
    margin: 24px 0 6px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.8rem;
    font-weight: 500;
}

.empty-state p,
.no-results {
    color: var(--muted);
}

.empty-stack {
    position: relative;
    width: 75px;
    height: 60px;
    margin: 0 auto;
}

.empty-stack span {
    position: absolute;
    display: block;
    width: 58px;
    height: 44px;
    border: 2px solid var(--green);
    border-radius: 9px;
    background: var(--lime);
}

.empty-stack span:nth-child(1) { left: 0; top: 12px; transform: rotate(-8deg); }
.empty-stack span:nth-child(2) { right: 0; top: 6px; transform: rotate(7deg); background: var(--peach); }
.empty-stack span:nth-child(3) { left: 9px; top: 0; background: #fff; transform: rotate(0); }

.media-dialog {
    width: min(960px, calc(100% - 34px));
    max-height: calc(100vh - 34px);
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 26px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 30px 90px rgba(9, 24, 16, 0.32);
}

.media-dialog::backdrop {
    background: rgba(13, 27, 19, 0.72);
    backdrop-filter: blur(5px);
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 4;
    display: grid;
    width: 39px;
    height: 39px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: rgba(25, 35, 29, 0.72);
    color: #fff;
    cursor: pointer;
    font-size: 1.55rem;
    line-height: 1;
}

.dialog-layout {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.75fr);
}

.dialog-preview {
    display: grid;
    height: min(62vh, 520px);
    min-height: 360px;
    max-height: 520px;
    overflow: hidden;
    place-items: center;
    background: #18231d;
}

.dialog-preview img,
.dialog-preview video,
.dialog-preview iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    border: 0;
}

.dialog-preview img,
.dialog-preview video {
    object-fit: contain;
}

.dialog-preview-video {
    background: #080b09;
}

.dialog-preview-pdf {
    height: min(68vh, 600px);
    min-height: 440px;
    max-height: 600px;
    background: #e9edea;
}

.dialog-preview-file {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
}

.dialog-details {
    display: flex;
    min-width: 0;
    max-height: 600px;
    overflow-y: auto;
    flex-direction: column;
    padding: 38px 28px 28px;
}

.dialog-details h2 {
    margin: 0;
    overflow-wrap: anywhere;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.75rem, 3vw, 2.6rem);
    font-weight: 500;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.metadata {
    margin: 30px 0;
    border-top: 1px solid var(--line);
}

.metadata div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.metadata dt {
    color: var(--muted);
    font-size: 0.8rem;
}

.metadata dd {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 750;
    text-align: right;
}

.share-field {
    margin-top: 0;
}

.share-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 800;
}

.share-field > div {
    display: flex;
    gap: 7px;
}

.share-field input {
    min-width: 0;
    flex: 1;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--paper);
    color: var(--muted);
    font-size: 0.76rem;
}

.share-field p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 0;
    padding-top: 24px;
}

.copy-helper {
    position: fixed;
    top: -1000px;
    left: -1000px;
    opacity: 0;
}

[hidden] {
    display: none !important;
}

/* Vue interne compacte */
.page-shell-compact {
    padding-top: 30px;
}

.upload-panel-compact {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: none;
}

.upload-form-compact {
    display: block;
    width: 100%;
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-form-compact .file-picker {
    border-color: var(--line);
    background: var(--paper);
    color: var(--ink);
}

.upload-form-compact .file-picker:hover {
    background: #edf0eb;
}

.upload-form-compact .button-primary {
    background: var(--green);
    color: #fff;
}

.upload-form-compact .selected-files {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: left;
}

.upload-form-compact .selected-files.is-warning {
    color: var(--danger);
}

.upload-selection,
.upload-progress,
.upload-result {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.selected-file-list {
    display: grid;
    max-height: 190px;
    gap: 7px;
    margin: 11px 0 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.selected-file-list li {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--paper);
    color: var(--muted);
    font-size: 0.74rem;
}

.selected-file-list li > span:first-child {
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-list li > span:last-child {
    flex: 0 0 auto;
}

.selected-file-list li.is-invalid {
    background: var(--danger-soft);
    color: var(--danger);
}

.selected-file-more {
    justify-content: center !important;
    font-weight: 750;
}

.upload-progress-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 0.78rem;
}

.upload-progress-copy strong {
    color: var(--green);
}

.progress-track {
    display: block;
    width: 100%;
    height: 9px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    -webkit-appearance: none;
    appearance: none;
    background: #e4e8e2;
}

.progress-track::-webkit-progress-bar {
    border-radius: 999px;
    background: #e4e8e2;
}

.progress-track::-webkit-progress-value {
    border-radius: 999px;
    background: var(--green);
    transition: width 180ms ease;
}

.progress-track::-moz-progress-bar {
    border-radius: 999px;
    background: var(--green);
}

.upload-result {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.45;
}

.upload-result.is-error {
    color: var(--danger);
}

.upload-result.is-success {
    color: var(--green);
}

.button-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: upload-spin 700ms linear infinite;
}

.upload-form[aria-busy="true"] .file-picker {
    pointer-events: none;
    opacity: 0.55;
}

@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

.library-section-compact {
    padding-top: 26px;
}

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

.media-count {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 750;
}

.empty-state-compact {
    padding: 46px 20px;
}

.empty-state-compact p {
    margin: 0;
}

.embed-mode .topbar {
    position: static;
    min-height: 62px;
    padding: 10px 18px;
    background: var(--surface);
}

.embed-mode .page-shell {
    width: min(100% - 28px, 1420px);
    padding-top: 18px;
    padding-bottom: 28px;
}

@media (max-width: 1080px) {
    .media-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .upload-panel {
        align-items: flex-start;
    }

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

@media (max-width: 820px) {
    .login-page {
        padding: 16px;
    }

    .login-shell {
        min-height: 0;
        grid-template-columns: 1fr;
    }

    .login-panel {
        padding: 45px 32px;
    }

    .login-visual {
        display: none;
    }

    .hero {
        display: block;
    }

    .summary {
        margin-top: 30px;
    }

    .upload-panel {
        display: block;
    }

    .upload-form {
        margin-top: 20px;
    }

    .selected-files {
        text-align: left;
    }

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

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

    .dialog-preview {
        height: min(48vh, 420px);
        min-height: 260px;
        max-height: 420px;
    }

    .dialog-preview-pdf {
        height: min(58vh, 520px);
        min-height: 380px;
        max-height: 520px;
    }

    .dialog-preview img,
    .dialog-preview video,
    .dialog-preview iframe {
        min-height: 0;
        max-height: 100%;
    }

    .dialog-details {
        max-height: none;
        overflow: visible;
        padding: 33px 24px 25px;
    }
}

@media (max-width: 540px) {
    .topbar {
        min-height: 66px;
        padding: 10px 16px;
    }

    .brand:not(.page-title) > span:last-child {
        display: none;
    }

    .button-ghost {
        min-height: 40px;
        padding: 9px 13px;
    }

    .page-shell {
        width: min(100% - 28px, 1420px);
        padding-top: 38px;
    }

    .hero h1 {
        font-size: clamp(2.65rem, 15vw, 4.2rem);
    }

    .summary {
        width: 100%;
    }

    .summary div {
        min-width: 0;
        flex: 1;
        padding: 14px 15px;
    }

    .upload-panel {
        padding: 21px;
        border-radius: 22px;
    }

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

    .upload-form-compact {
        display: block;
    }

    .upload-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .upload-form .button,
    .file-picker {
        width: 100%;
    }

    .selected-files {
        grid-column: auto;
        margin-left: 0;
    }

    .upload-form-compact .selected-files {
        margin: 0;
        text-align: left;
    }

    .section-heading {
        display: block;
    }

    .search-field {
        display: block;
        margin-top: 16px;
    }

    .search-field input {
        width: 100%;
    }

    .media-grid {
        grid-template-columns: 1fr;
    }

    .media-preview {
        aspect-ratio: 16 / 10;
    }

    .media-dialog {
        width: calc(100% - 16px);
        max-height: calc(100vh - 16px);
        border-radius: 20px;
    }

    .dialog-preview {
        min-height: 220px;
    }

    .dialog-preview-pdf {
        min-height: 340px;
    }

    .dialog-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dialog-actions .button,
    .dialog-actions form,
    .dialog-actions form .button {
        width: 100%;
    }

    .share-field > div {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
