:root {
  color-scheme: light;
  --orange: #bd5013;
  --orange-dark: #9c3d0a;
  --orange-soft: #fff0e5;
  --ink: #252626;
  --muted: #777b7b;
  --line: #e8e9e7;
  --canvas: #f5f6f4;
  --surface: #fff;
  --shadow: 0 16px 44px rgb(37 38 38 / 7%);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--canvas); }
a { color: inherit; }
header { position: sticky; z-index: 5; top: 0; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 22px; padding: 0 max(calc((100vw - 1120px) / 2), 28px); border-bottom: 1px solid rgb(232 233 231 / 85%); background: rgb(255 255 255 / 90%); backdrop-filter: blur(18px); }
header .brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font: 800 20px/1 'Manrope', sans-serif; letter-spacing: -.7px; text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #ff9a4f, var(--orange-dark)); box-shadow: 0 6px 14px rgb(244 119 33 / 28%); }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
nav a { padding: 10px 13px; border-radius: 10px; color: #626666; font-size: 14px; font-weight: 600; text-decoration: none; transition: color .18s, background .18s; }
nav a:hover, nav a:focus-visible { color: var(--orange-dark); background: var(--orange-soft); }
main { width: min(1120px, 100%); margin: 42px auto 84px; padding: 0 28px; }
h1, h2, h3 { font-family: 'Manrope', 'DM Sans', sans-serif; letter-spacing: -.045em; }
h1 { margin: 0 0 24px; font-size: clamp(30px, 4vw, 42px); line-height: 1.12; }
h2 { margin: 0 0 18px; font-size: 20px; }
.card { position: relative; margin: 18px 0; padding: clamp(22px, 4vw, 34px); overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 5px 20px rgb(37 38 38 / 3%); }
.card > h2 { display: flex; align-items: center; gap: 10px; }
.card > h2::before { width: 4px; height: 22px; border-radius: 8px; background: var(--orange); content: ''; }
.card:has(.upload-form) { border-color: #f9d5bd; background: radial-gradient(ellipse at 100% 0%, #fff1e6 0, transparent 44%), #fff; }
.upload-form { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: center; }
.dropzone { grid-column: 1 / -1; display: grid; min-height: 174px; place-items: center; padding: 24px; border: 1.5px dashed #efb68f; border-radius: 16px; background: rgb(255 255 255 / 74%); text-align: center; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.dropzone:hover, .dropzone.is-dragover { transform: translateY(-2px); border-color: var(--orange); background: #fff8f2; }
.dropzone-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 11px; place-items: center; border-radius: 15px; color: var(--orange-dark); background: var(--orange-soft); }
.dropzone strong { display: block; font-size: 15px; }
.dropzone span { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
input, select, button { font: inherit; }
input:not([type=checkbox]):not([type=file]), select { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid #dcdfdc; border-radius: 10px; outline: none; background: #fff; transition: border-color .18s, box-shadow .18s; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--orange); box-shadow: 0 0 0 4px rgb(244 119 33 / 13%); }
input[type=file] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
button, .btn { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; color: #fff; background: var(--orange); box-shadow: 0 5px 12px rgb(244 119 33 / 16%); font-size: 14px; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; transition: transform .16s, background .16s, box-shadow .16s; }
button:hover, .btn:hover { transform: translateY(-1px); background: var(--orange-dark); box-shadow: 0 8px 18px rgb(244 119 33 / 23%); }
button:focus-visible, .btn:focus-visible { outline: 3px solid rgb(244 119 33 / 32%); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; transform: none; }
button.secondary, .btn.secondary { color: var(--ink); border-color: var(--line); background: #fff; box-shadow: none; }
button.danger { color: #a93030; border-color: #f0d4d2; background: #fff7f6; box-shadow: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row > * { flex: 1 1 130px; }
label { color: #4f5353; font-size: 14px; font-weight: 600; }
form label input { margin-top: 6px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { color: #818585; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
td, th { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fffdfa; }
.muted { color: var(--muted); }
.flash { margin: 0 0 18px; padding: 14px 17px; border: 1px solid #f3d2b9; border-radius: 12px; color: #8b4618; background: #fff5ed; }
.inline { display: inline-flex; }
.inline button { margin-left: 6px; }
.small { font-size: 13px; }
.break { overflow-wrap: anywhere; }
.file-meta { color: var(--muted); font-size: 13px; }
.empty-state { padding: 26px 12px; color: var(--muted); text-align: center; }
.auth-card { width: min(510px, 100%); margin: 5vh auto 0; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 24px; }
.page-heading h1 { margin-bottom: 9px; }
.eyebrow { margin: 0 0 8px; color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.project-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 14px; align-items: end; }
.project-form label { display: grid; gap: 6px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px; margin-top: 20px; }
.project-card { position: relative; min-width: 0; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, #fff 45%, #fff8f2); box-shadow: 0 5px 20px rgb(37 38 38 / 3%); }
.project-symbol { display: grid; width: 42px; height: 42px; margin-bottom: 20px; place-items: center; border-radius: 13px; color: var(--orange-dark); background: var(--orange-soft); font-size: 22px; }
.project-card h2 { margin: 0; overflow-wrap: anywhere; }
.project-description { min-height: 42px; font-size: 14px; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.project-card form { text-align: right; }
.project-card form button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.project-select { min-width: 220px; }
.project-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 30px 2px 8px; }
.project-strip > div { display: grid; gap: 3px; }
.project-strip strong { font: 700 19px 'Manrope', sans-serif; }
.project-strip > a, .text-link { color: var(--orange-dark); font-size: 13px; font-weight: 700; text-decoration: none; }
.files-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.files-heading h2 { margin-bottom: 18px; }
.type-badge { display: inline-block; max-width: 180px; padding: 5px 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; color: #676c6b; background: #f8f9f8; font: 11px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.actions-cell { white-space: nowrap; }
.profile-card { max-width: 820px; margin: 0 auto; padding: clamp(24px, 5vw, 48px); }
.password-card { margin-top: 20px; }
.password-card > div { margin-bottom: 22px; }
.password-card h2 { margin-bottom: 8px; }
.password-card form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.password-card form label { display: grid; gap: 7px; }
.password-card form button { align-self: end; justify-self: start; }
.profile-photo { display: flex; align-items: center; gap: 25px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.profile-photo > img { width: 116px; height: 116px; flex: 0 0 auto; border: 5px solid #fff; border-radius: 50%; background: var(--orange-soft); box-shadow: 0 0 0 1px var(--line), 0 10px 24px rgb(37 38 38 / 8%); object-fit: cover; }
.upload-avatar { display: inline-flex; min-height: 40px; align-items: center; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.upload-avatar:hover { border-color: var(--orange); color: var(--orange-dark); }
.upload-avatar input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.remove-avatar { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 12px; }
.profile-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; padding-top: 28px; }
.profile-fields > label { display: grid; align-content: start; gap: 7px; }
.profile-fields .details-field { grid-column: 1 / -1; }
textarea { width: 100%; min-height: 130px; resize: vertical; padding: 12px 13px; border: 1px solid #dcdfdc; border-radius: 10px; outline: none; font: inherit; transition: border-color .18s, box-shadow .18s; }
textarea:focus-visible { border-color: var(--orange); box-shadow: 0 0 0 4px rgb(244 119 33 / 13%); }
.profile-actions { display: flex; justify-content: flex-end; margin-top: 25px; }
.pending-email { grid-column: 1 / -1; margin: -8px 0 0; padding: 12px 14px; border-radius: 10px; color: #8b4618; background: #fff5ed; font-size: 13px; }
.pending-email label { display: block; margin-top: 7px; }
.profile-nav { display: inline-flex; align-items: center; gap: 8px; }
.profile-nav img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.login-links { display: flex; justify-content: flex-end; margin: -3px 0 16px; }
.forgot-link { color: var(--orange-dark); font-size: 13px; font-weight: 700; text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }
.auth-card form > label { display: block; margin: 14px 0; }
.auth-card form > button { width: 100%; margin-top: 10px; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 32px)); padding: 14px 18px; transform: translateY(18px); border-radius: 13px; color: #fff; background: #282b2a; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.is-loading { opacity: .7; pointer-events: none; }
@media (max-width: 720px) {
  header { min-height: 68px; padding: 0 18px; }
  header .brand { font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; }
  nav { justify-content: flex-end; gap: 0; }
  nav a { padding: 9px 8px; font-size: 12px; }
  main { margin-top: 28px; padding: 0 16px; }
  .card { border-radius: 16px; }
  .upload-form { grid-template-columns: 1fr; }
  .upload-form > button { width: 100%; }
  .project-form { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 900px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .profile-fields { grid-template-columns: 1fr; }
  .profile-fields .details-field, .pending-email { grid-column: auto; }
  .profile-photo { align-items: flex-start; flex-direction: column; gap: 16px; }
  .password-card form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.brand-logo { display: block; width: min(270px, 42vw); height: auto; }
.installer { min-height: 100vh; background: radial-gradient(ellipse at 88% 4%, #ffe7d6 0, transparent 35%), var(--canvas); }
.installer-main { width: min(900px, 100%); margin: 0 auto; padding: 36px 24px 60px; }
.installer-brand { margin: 0 0 20px; }
.installer-brand img { width: min(300px, 78vw); height: auto; }
.installer-main > .card { padding: clamp(22px, 5vw, 44px); }
.installer-main h1 { margin-bottom: 12px; }
.install-form { display: grid; gap: 20px; margin-top: 25px; }
.install-form fieldset { min-width: 0; margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; }
.install-form legend { padding: 0 8px; color: var(--ink); font: 700 16px 'Manrope', sans-serif; }
.install-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.install-grid label { display: grid; align-content: start; gap: 6px; }
.install-grid .wide { grid-column: 1 / -1; }
.install-grid small { color: var(--muted); font-weight: 400; }
.install-form details { padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fbfbfa; }
.install-form summary { color: var(--orange-dark); font-weight: 700; cursor: pointer; }
.install-form details fieldset { margin-top: 18px; }
.installer-foot { color: var(--muted); font-size: 13px; text-align: center; }
@media (max-width: 600px) { .installer-main { padding: 22px 15px 40px; } .install-grid { grid-template-columns: 1fr; } .install-grid .wide { grid-column: auto; } .install-form fieldset { padding: 14px; } }

/* Per-account color themes */
body[data-theme="blue"] { --orange: #2866a0; --orange-dark: #1e4f80; --orange-soft: #e9f2fb; }
body[data-theme="black"] { --orange: #353a3d; --orange-dark: #202426; --orange-soft: #e9ebeb; }
body[data-theme="green"] { --orange: #28714c; --orange-dark: #205d3d; --orange-soft: #e8f4ed; }
body[data-theme="blue"] .brand-mark, body[data-theme="black"] .brand-mark, body[data-theme="green"] .brand-mark { background: linear-gradient(145deg, color-mix(in srgb, var(--orange) 72%, white), var(--orange-dark)); box-shadow: 0 6px 14px color-mix(in srgb, var(--orange) 28%, transparent); }
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; margin: 18px 0 20px; }
.theme-option { position: relative; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 10px; min-height: 62px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .18s, transform .18s, box-shadow .18s; }
.theme-option:hover { transform: translateY(-1px); }
.theme-option:has(input:checked) { border-color: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 16%, transparent); }
.theme-option input[type="radio"] { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; border: 0; background: transparent; opacity: 0; }
.theme-option input[type="radio"]:focus-visible + .theme-preview { outline: 3px solid var(--orange); outline-offset: 3px; }
.theme-preview { display: block; width: 42px; height: 38px; border: 1px solid rgb(120 120 120 / 22%); border-radius: 9px; background: linear-gradient(90deg, #e7e9e8 0 55%, var(--preview-accent) 55%); }
.theme-orange { --preview-accent: #bd5013; }
.theme-blue { --preview-accent: #2866a0; }
.theme-black { --preview-accent: #292d2f; }
.theme-green { --preview-accent: #28714c; }
.theme-dark { --preview-accent: #b94e12; background: linear-gradient(90deg, #252a2c 0 55%, #b94e12 55%); }
.theme-toggle-form { margin: 0; }
.theme-toggle-button { min-height: 38px; padding: 8px 11px; border-radius: 9px; }
.mode-toggle-label { display: inline-flex; align-items: center; gap: 10px; margin: 8px 0 16px; }
.mode-toggle-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orange); }

/* Dark mode */
body[data-mode="dark"] { color-scheme: dark; --ink: #edf0f1; --muted: #a3abad; --line: #394144; --canvas: #171b1d; --surface: #22282a; --orange: #b94e12; --orange-dark: #ffad75; --orange-soft: #3a2b21; --shadow: 0 16px 44px rgb(0 0 0 / 32%); }
body[data-mode="dark"] header { border-color: var(--line); background: rgb(30 35 37 / 94%); }
body[data-mode="dark"] nav a, body[data-mode="dark"] label { color: #d3d8da; }
body[data-mode="dark"] .card, body[data-mode="dark"] .project-card { border-color: var(--line); background: var(--surface); box-shadow: 0 5px 20px rgb(0 0 0 / 12%); }
body[data-mode="dark"] .card:has(.upload-form) { border-color: #554033; background: radial-gradient(ellipse at 100% 0%, #33271f 0, transparent 48%), var(--surface); }
body[data-mode="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), body[data-mode="dark"] select, body[data-mode="dark"] textarea { color: var(--ink); border-color: var(--line); background: #191e20; }
body[data-mode="dark"] .dropzone { border-color: #73543f; background: rgb(28 33 35 / 82%); }
body[data-mode="dark"] .dropzone:hover, body[data-mode="dark"] .dropzone.is-dragover { background: #30251e; }
body[data-mode="dark"] button.secondary, body[data-mode="dark"] .btn.secondary, body[data-mode="dark"] .upload-avatar { color: var(--ink); border-color: var(--line); background: #2b3234; }
body[data-mode="dark"] button.danger { color: #ffaaa3; border-color: #653b39; background: #332323; }
body[data-mode="dark"] tr:hover td { background: #2a3032; }
body[data-mode="dark"] .type-badge { color: #c1c8ca; border-color: var(--line); background: #2a3032; }
body[data-mode="dark"] .pending-email, body[data-mode="dark"] .flash { color: #ffd0ac; border-color: #60442f; background: #30271f; }
body[data-mode="dark"] .install-form details { background: var(--surface); }
body[data-mode="dark"] .theme-option { color: var(--ink); border-color: var(--line); background: #191e20; }
@media (max-width: 600px) { .theme-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .theme-toggle-button span { display: none; } }

/* Owner-only analytics dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.stat-card { position: relative; display: grid; align-content: start; gap: 8px; min-height: 158px; padding: 22px; overflow: hidden; }
.stat-card .eyebrow { margin: 4px 0 0; }
.stat-card strong { color: var(--ink); font: 800 clamp(28px, 3vw, 38px)/1.1 'Manrope', sans-serif; letter-spacing: -1.2px; }
.stat-card .muted { font-size: 13px; }
.stat-card progress { width: 100%; height: 8px; margin-top: 4px; accent-color: var(--orange); }
.stat-icon { position: absolute; top: 18px; right: 20px; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--orange-dark); background: var(--orange-soft); font-size: 20px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.dashboard-grid > .card { min-width: 0; padding: clamp(18px, 2.5vw, 26px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.card-heading h2 { margin: 3px 0; }
.card-heading .eyebrow { margin: 0; }
.chart-line { display: block; width: 100%; height: auto; margin: 12px 0 4px; overflow: visible; }
.chart-axis { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 6; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #f47721; }
.chart-legend .legend-failure { background: #d64b45; }
.chart-legend .legend-users { background: #367a57; }
.role-list { display: grid; gap: 2px; margin: 16px 0; }
.role-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.role-list > div:last-child { border-bottom: 0; }
.role-list strong { font-variant-numeric: tabular-nums; }
.event-log-card { margin: 18px 0 48px; padding: clamp(18px, 2.5vw, 26px); }
.event-log-card .table-wrap { overflow-x: auto; }
.event-log-card table { min-width: 980px; }
.event-log-card code { font-size: 12px; overflow-wrap: anywhere; }
.event-log-card details summary { color: var(--orange-dark); cursor: pointer; font-weight: 700; }
.event-meta { max-width: 380px; max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.pagination { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.file-filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(130px, 1fr)) auto auto; align-items: end; gap: 12px; margin: 4px 0 20px; }
.file-filters label { display: grid; gap: 6px; }
.file-filters .search-field { min-width: 0; }
.preview-trigger { min-height: 32px; padding: 5px 9px; margin-right: 8px; color: var(--ink); border-color: var(--line); background: var(--surface); box-shadow: none; font-size: 12px; }
.preview-dialog { width: min(900px, calc(100vw - 28px)); max-width: 900px; max-height: min(90vh, 900px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--surface); box-shadow: 0 28px 90px rgb(0 0 0 / 35%); }
.preview-dialog::backdrop { background: rgb(18 22 24 / 76%); backdrop-filter: blur(4px); }
.preview-dialog header { position: static; min-height: 56px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.preview-dialog h2 { min-width: 0; margin: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.preview-dialog figure { display: grid; max-height: calc(90vh - 58px); place-items: center; margin: 0; padding: 14px; overflow: auto; }
.preview-dialog img { display: block; max-width: 100%; max-height: calc(90vh - 100px); object-fit: contain; }
.storage-quota { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -4px 0 18px; color: var(--muted); font-size: 13px; }
.storage-quota progress { width: min(240px, 38vw); height: 8px; accent-color: var(--orange); vertical-align: middle; }
@media (max-width: 900px) { .file-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .file-filters { grid-template-columns: 1fr; } .preview-trigger { margin: 0 5px 5px 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
body[data-mode="dark"] .preview-dialog header { border-color: var(--line); background: var(--surface); }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .stats-grid { grid-template-columns: 1fr; } .stat-card { min-height: 138px; } .card-heading { align-items: flex-start; flex-direction: column; gap: 4px; } }
body[data-mode="dark"] .chart-line polyline { filter: drop-shadow(0 0 3px rgb(255 255 255 / 16%)); }
/* Dateiportal-Erweiterungen */
.file-comment { padding: 1rem 0; border-bottom: 1px solid var(--line, #e2e5e8); }
.file-comment p { margin: 0 0 .45rem; white-space: normal; overflow-wrap: anywhere; }
.file-comment small, output[data-upload-status] { color: var(--muted, #69727b); }
.upload-form progress[data-upload-progress] { width: 100%; min-height: .8rem; accent-color: var(--accent, #f47721); }
.upload-form [data-upload-cancel] { justify-self: start; }
.actions-cell { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.actions-cell form { margin: 0; }

/* Mobile: navigation, touch targets and dense tables remain usable at 320px. */
@media (max-width: 720px) {
  header {
    position: sticky;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 4px;
    min-height: auto;
    padding: 10px 16px 0;
  }
  header .brand { min-height: 40px; }
  header .brand-logo { width: min(210px, 62vw); }
  header nav {
    width: calc(100% + 32px);
    min-width: 0;
    margin: 0 -16px;
    padding: 3px 12px 9px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  header nav > a { flex: 0 0 auto; min-height: 44px; padding: 12px 10px; font-size: 13px; white-space: nowrap; }
  header nav .theme-toggle-form { flex: 0 0 auto; }
  header nav .theme-toggle-button { min-width: 44px; min-height: 44px; }
  header nav .profile-nav img { width: 28px; height: 28px; }
  main { width: 100%; margin: 24px auto 56px; padding: 0 14px; }
  .card { padding: 20px 17px; }
  .page-heading { gap: 12px; margin-bottom: 18px; }
  .page-heading h1 { overflow-wrap: anywhere; }
  .page-heading > .actions-cell { width: 100%; }
  .dropzone { min-height: 150px; padding: 18px 12px; }
  .project-select { min-width: 0; }
  .project-strip { align-items: flex-start; flex-direction: column; }
  .project-form { grid-template-columns: minmax(0, 1fr); }
  .project-form > button { width: 100%; }
  .project-card { padding: 19px; }
  .project-card form { text-align: left; }
  .profile-card { padding: 22px 17px; }
  .profile-actions > button, .password-card form button { width: 100%; }
  .password-card form { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
  .card:has(> table) { overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
  table { min-width: 740px; }
  .event-log-card table { min-width: 940px; }
  td, th { padding: 12px 10px; }
  .actions-cell { min-width: 180px; white-space: normal; }
  .actions-cell .btn, .actions-cell button { min-height: 42px; }
  .row { align-items: stretch; }
  .row > * { flex-basis: 100%; min-width: 0; }
  .file-filters { grid-template-columns: minmax(0, 1fr); }
  .file-filters > button, .file-filters > .btn { width: 100%; }
  .bulk-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .bulk-toolbar > * { width: 100%; min-width: 0; }
  .storage-quota { align-items: stretch; flex-direction: column; }
  .storage-quota progress { width: 100%; }
  .pagination { align-items: center; flex-wrap: wrap; }
  .pagination .btn { flex: 1 1 120px; }
  .preview-dialog { width: calc(100vw - 16px); max-height: 92dvh; border-radius: 13px; }
  .preview-dialog figure { max-height: calc(92dvh - 58px); padding: 8px; }
  .preview-dialog img { max-height: calc(92dvh - 90px); }
}

@media (max-width: 480px) {
  h1 { font-size: clamp(27px, 8vw, 34px); }
  h2 { font-size: 18px; }
  main { padding-inline: 10px; }
  header { padding-inline: 12px; }
  header nav { width: calc(100% + 24px); margin-inline: -12px; }
  .card { border-radius: 14px; }
  .auth-card { margin-top: 3vh; }
  .profile-photo > img { width: 92px; height: 92px; }
  .profile-photo { padding-bottom: 20px; }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-legend { gap: 10px; }
  .theme-options { grid-template-columns: minmax(0, 1fr); }
  .installer-main { padding: 18px 10px 32px; }
  .install-form fieldset { padding: 12px; }
  input:not([type=checkbox]):not([type=file]), select, textarea { font-size: 16px; }
  button, .btn { min-height: 44px; }
}

@media (max-width: 360px) {
  header .brand-logo { width: min(185px, 60vw); }
  .card { padding-inline: 13px; }
  .dropzone strong { font-size: 14px; }
  .project-card { padding: 16px; }
}

/* Off-screen registration trap for automated form submissions. */
.form-honeypot{position:absolute!important;left:-10000px!important;top:auto!important;width:1px!important;height:1px!important;overflow:hidden!important}
