/* ---------- Schrift: Source Sans 3 (selbst-gehostet, DSGVO-konform, kein CDN) ----------
   Optisch nahezu identischer, frei lizenzierter Verwandter von Myriad Pro (beide von Adobe).
   itms.com selbst hostet Myriad Pro (lizenzpflichtig) – darum hier die freie Alternative. */
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 300; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-300-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 300; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-ext-300-normal.woff2") format("woff2");
    unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-ext-400-normal.woff2") format("woff2");
    unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-ext-600-normal.woff2") format("woff2");
    unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("/assets/fonts/source-sans-3-latin-ext-700-normal.woff2") format("woff2");
    unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
    /* ITMS-Markenblau (von itms.com) – als Skala, damit Buttontext WCAG-AA-Kontrast erreicht */
    --brand-50:  #eef6fd;
    --brand-100: #d8ebfb;
    --brand-300: #8cc4ef;
    --brand-500: #59a6e8;  /* ITMS-Signalblau – Logo & Akzent */
    --brand-600: #2f8fd8;
    --brand-700: #1d6fb5;  /* Button-/Linkfläche – weißer Text ≈ 5:1 */
    --brand-800: #155a96;

    --black: #20262e;      /* kühles Near-Black für Text/Überschriften */
    --gray-900: #2b323b;
    --gray-700: #4a5159;
    --gray-500: #767d87;   /* ITMS-Grau */
    --gray-400: #a7aeb7;
    --gray-300: #c7ccd2;
    --border: #e3e7ec;
    --border-soft: #eef1f4;
    --gray-100: #f3f5f8;
    --white: #ffffff;
    --accent: var(--brand-500);
    --green-bg: #ecfdf3; --green-fg: #15803d;
    --blue-bg: #eaf4fd; --blue-fg: #1d6fb5;
    --purple-bg: #f5f3ff; --purple-fg: #7c3aed;
    --amber-bg: #fffbeb; --amber-fg: #b45309;
    --red: #dc2626; --red-bg: #fef2f2; --red-border: #fee2e2;
    --radius: 16px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }

/* Das hidden-Attribut muss Klassen mit display:flex/grid zuverlässig schlagen. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--black);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
}

body.centered, body.share { background: var(--gray-100); }
body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; word-break: break-all; }
::selection { background: var(--brand-500); color: #fff; }

/* ---------- Topbar ---------- */
.topbar { background: var(--white); border-top: 3px solid var(--brand-500); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1000px; margin: 0 auto; height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 20px; }
.topbar-inner.narrow { max-width: 680px; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo.lg { height: 38px; }
.brand-sub { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gray-500); border-left: 1px solid var(--border); padding-left: 12px; }
.brand-sub.spaced { border: 0; padding: 0; margin-top: 10px; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { font-size: 14px; color: var(--gray-500); padding: 6px 12px; border-radius: var(--radius-sm); }
.topnav a:hover { color: var(--black); background: var(--gray-100); }
.topnav a.is-active { color: var(--black); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-name { font-size: 13px; color: var(--gray-500); }

/* ---------- Layout ---------- */
.page { min-height: calc(100vh - 110px); padding: 36px 20px; }
.wrap { max-width: 1000px; margin: 0 auto; }
.wrap-narrow { max-width: 640px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.page-head h1 { font-size: 22px; font-weight: 600; margin: 0; }
.appfoot { text-align: center; padding: 20px; font-size: 12px; color: var(--gray-400); }
.muted { color: var(--gray-500); margin: 4px 0 0; font-size: 14px; }
.muted-light { color: var(--gray-400); font-size: 13px; }
.back { display: inline-block; font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }
.back:hover { color: var(--black); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.card.no-pad { padding: 0; overflow: hidden; }
.card.center { text-align: center; }
.card-title { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.center .card-title { margin-top: 8px; }

/* ---------- Forms ---------- */
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 10px; }
.field { display: block; }
.field > label, .field-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-700); margin-bottom: 8px; }
input[type=text], input[type=email], input[type=password], input[type=date], select {
    width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
    border: 1px solid #e0e0e0; border-radius: var(--radius-sm); background: #fff; color: var(--black);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(89,166,232,.20); }
.inline { display: inline; }
.inline-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.inline-row input[type=text], .inline-row input[type=date] { width: auto; flex: 1; min-width: 160px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--gray-700); font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-700); }
.hint { font-size: 12px; color: var(--gray-500); margin: 8px 0 0; }
.alert { font-size: 13px; color: var(--red); background: var(--red-bg); border: 1px solid var(--red-border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 14px; font-weight: 500; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-700); color: #fff; }
.btn-primary:hover { background: var(--brand-800); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: #e0e0e0; color: var(--gray-700); }
.btn-ghost:hover { border-color: var(--gray-400); }
.btn-danger { background: #fff; border-color: var(--red-border); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-text { background: none; border: 0; padding: 0; font-family: inherit; font-size: 13px; color: var(--gray-500); cursor: pointer; }
.btn-text:hover { color: var(--black); }
.btn-text.small { font-size: 12px; }
.btn-text.danger { color: var(--red); }
.btn-row { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.link { color: var(--brand-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Combo / Dropdown ---------- */
.combo { position: relative; }
.combo-list { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: #fff; border: 1px solid #e0e0e0; border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,.08); z-index: 20; max-height: 220px; overflow-y: auto; }
.combo-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; font-size: 14px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.combo-list button:hover { background: var(--gray-100); }
.combo-empty { padding: 10px 12px; font-size: 14px; color: var(--gray-500); }

/* ---------- Dropzone / Files ---------- */
.dropzone { border: 2px dashed #e0e0e0; border-radius: var(--radius-sm); padding: 32px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone p { margin: 0; color: var(--gray-500); font-size: 14px; }
.dropzone p + p { margin-top: 4px; }
.dropzone.drag { border-color: var(--brand-500); background: var(--brand-50); }
.file-list { list-style: none; margin: 12px 0 0; padding: 0; }
.file-list li { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px; border-radius: 8px; font-size: 14px; gap: 12px; }
.file-list li:hover { background: var(--gray-100); }
.file-list.detail li { border-bottom: 1px solid var(--border-soft); border-radius: 0; }
.file-list.detail li:last-child { border-bottom: 0; }
.file-info, .file-links { display: flex; align-items: center; gap: 12px; }
.file-name { font-weight: 500; }
.file-name + .muted-light { margin-left: 0; }
.file-remove { color: var(--gray-300); cursor: pointer; background: none; border: 0; font-size: 13px; }
.file-remove:hover { color: var(--black); }

/* ---------- Collapsible ---------- */
.collapsible { padding: 0; overflow: hidden; }
.collapsible-head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; background: none; border: 0; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.collapsible-head:hover { background: #fafafa; }
.collapsible-body { padding: 4px 22px 22px; border-top: 1px solid var(--border-soft); }
.collapsible-body .field + .field { margin-top: 18px; }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; padding: 6px 13px; border-radius: var(--radius-sm); border: 1px solid #e0e0e0; background: #fff; color: var(--gray-700); cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--gray-400); }
.chip.is-active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }

/* ---------- Rows (dashboard) ---------- */
.row { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; transition: border-color .15s; }
.row:hover { border-color: var(--gray-300); }
.row-link { cursor: pointer; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--gray-500); margin-top: 3px; }
.row-date { text-align: right; font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.row-actions { display: flex; gap: 8px; }
@media (max-width: 720px) {
    .row { flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; }
    .row-date { display: none; }
    .row-main { flex: 1 1 100%; order: 1; }
    .row-actions { order: 2; flex: 1 1 100%; }
    .row-actions .btn { flex: 1; }
}

/* ---------- Badges ---------- */
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.st-done { background: var(--green-bg); color: var(--green-fg); }
.st-shared { background: var(--blue-bg); color: var(--blue-fg); }
.st-downloaded { background: var(--purple-bg); color: var(--purple-fg); }
.st-expiring { background: var(--amber-bg); color: var(--amber-fg); }
.st-expired { background: var(--gray-100); color: var(--gray-500); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--gray-400); }
.empty-title { font-size: 18px; color: var(--gray-500); margin: 0 0 6px; }

/* ---------- Linkbox ---------- */
.linkbox { background: var(--gray-100); border-radius: var(--radius-sm); padding: 16px; text-align: left; }
.linkbox-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-700); margin-bottom: 8px; }
.linkbox-row { display: flex; align-items: center; gap: 10px; }
.linkbox-row code { flex: 1; }

/* ---------- Misc ---------- */
.success-mark { width: 48px; height: 48px; border-radius: 999px; background: var(--green-bg); color: var(--green-fg); display: flex; align-items: center; justify-content: center; font-size: 24px; margin: 0 auto 8px; }
.big-icon { font-size: 32px; margin-bottom: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--gray-500); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); }
.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-soft); gap: 12px; }
.user-list li:last-child { border-bottom: 0; }
.user-list .file-name + .muted-light { display: block; margin-top: 2px; }
.danger-zone { border-color: var(--red-border); }
.mt { margin-top: 18px; }

/* ---------- Auth ---------- */
.auth { width: 100%; max-width: 380px; padding: 20px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 36px; }
.auth-logo .brand-sub { padding-left: 14px; }
.auth-card { box-shadow: 0 4px 24px rgba(0,0,0,.04); }
.auth-foot { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 22px; }

/* ---------- Share ---------- */
.share-main { display: flex; align-items: center; justify-content: center; padding: 48px 16px; min-height: calc(100vh - 60px); }
.share-box { width: 100%; max-width: 520px; }
.small { font-size: 13px; }
.share-head { padding: 22px; border-bottom: 1px solid var(--border-soft); }
.share-files { list-style: none; margin: 0; padding: 0; }
.share-files li { display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--border-soft); }
.share-files li:last-child { border-bottom: 0; }
.thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--gray-100); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-icon { font-size: 20px; }
.thumb.zoomable { cursor: zoom-in; transition: transform .12s ease, box-shadow .12s ease; }
.thumb.zoomable:hover { transform: scale(1.08); box-shadow: 0 3px 12px rgba(32,38,46,.20); }

/* ---------- Lightbox (Bild-Vorschau vergrößern) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 40px; background: rgba(20,26,34,.84); }
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); box-shadow: 0 24px 80px rgba(0,0,0,.5); background: #fff; }
.lightbox-close { position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 999px; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox-close:hover { background: rgba(255,255,255,.30); }
.share-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-file-info .file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-zip { padding: 18px 22px; border-top: 1px solid var(--border-soft); }
.share-foot { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 22px; }
