/* =========================================================
   Pontifexx Bridge — stijl overgenomen van PFXA-LMS
   (shadcn-achtige tokens, Inter, navy als primaire kleur,
   tan als spaarzaam accent). Light is primair, dark volgt
   de systeemvoorkeur.
   ========================================================= */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter/inter-latin-400.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter/inter-latin-ext-400.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, 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: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter/inter-latin-500.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter/inter-latin-ext-500.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, 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: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter/inter-latin-600.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter/inter-latin-ext-600.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, 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: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter/inter-latin-700.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter/inter-latin-ext-700.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --radius: 0.75rem;
  --radius-md: calc(var(--radius) - 2px);
  --radius-sm: calc(var(--radius) - 4px);

  --background: #f8fafc;
  --foreground: #020817;
  --card: #ffffff;
  --card-foreground: #020817;
  --primary: #1c4571;
  --primary-hover: #19406a;
  --primary-foreground: #f8fafc;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #f8fafc;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #2563eb;
  --brand: #d6ab93;
  --brand-foreground: #422c1c;
  --success: #3d8262;
  --success-strong: #276448;

  --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(15 23 42 / 0.06), 0 1px 2px -1px rgb(15 23 42 / 0.06);
  --shadow-md: 0 4px 8px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 12px 20px -6px rgb(15 23 42 / 0.1), 0 4px 8px -4px rgb(15 23 42 / 0.06);

  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #020817;
    --foreground: #f8fafc;
    --card: #0f172a;
    --card-foreground: #f8fafc;
    --primary: #42719f;
    --primary-hover: #4a7dad;
    --primary-foreground: #f8fafc;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --accent: #1e293b;
    --accent-foreground: #f8fafc;
    --destructive: #f87171;
    --destructive-foreground: #f8fafc;
    --border: #1e293b;
    --input: #1e293b;
    --ring: #3b82f6;
    --brand: #d6ab93;
    --brand-foreground: #1f150c;
    --success: #5fb08a;
    --success-strong: #7cc39c;
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.35), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 20px -6px rgb(0 0 0 / 0.5), 0 4px 8px -4px rgb(0 0 0 / 0.4);
  }
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--card); border-color: var(--input); box-shadow: var(--shadow-xs); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-danger { background: transparent; color: var(--destructive); }
.btn-danger:hover { background: color-mix(in srgb, var(--destructive) 10%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- Formulieren ---------- */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; line-height: 1; }
.field input {
  height: 36px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--input); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }
.form-error { color: var(--destructive); font-size: 13px; }

.select {
  height: 32px; padding: 0 30px 0 10px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1px solid var(--input); border-radius: var(--radius-md);
  font-size: 13px; box-shadow: var(--shadow-xs);
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
.select:hover { background-color: var(--accent); }

/* ---------- Login ---------- */
.auth {
  min-height: 100svh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 384px; display: flex; flex-direction: column; gap: 32px; }
.auth-logo { height: 40px; width: auto; align-self: center; }
.auth-heading { text-align: center; display: grid; gap: 8px; }
.auth-heading h1 { font-size: 20px; font-weight: 500; }
.auth-heading p { color: var(--muted-foreground); font-size: 14px; }
.auth .btn-block { margin-top: 8px; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 820px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand img { height: 30px; width: auto; display: block; }
.brand-app {
  padding-left: 12px; border-left: 1px solid var(--border);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1;
}
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 13px; color: var(--muted-foreground); }

@media (prefers-color-scheme: dark) {
  .brand img, .auth-logo { content: url('/logo-wit.svg'); }
}

/* ---------- Pagina ---------- */
.page { max-width: 820px; margin: 0 auto; padding: 40px 24px 80px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: grid; gap: 4px; }
.page-head h1 { font-size: 24px; font-weight: 600; }
.page-head p { color: var(--muted-foreground); max-width: 60ch; }

/* ---------- De grote uploadknop ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 220px; padding: 40px 24px;
  background: var(--primary); color: var(--primary-foreground);
  border: 2px solid var(--primary); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  cursor: pointer; text-align: center;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.dropzone:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: var(--shadow-lg); }
.dropzone:active { transform: scale(0.995); }
.dropzone.is-dragover {
  background: color-mix(in srgb, var(--primary) 88%, white);
  border-color: var(--brand); border-style: dashed;
  box-shadow: var(--shadow-lg), 0 0 0 4px color-mix(in srgb, var(--brand) 35%, transparent);
}
.dropzone-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin-bottom: 10px;
  border-radius: 999px;
  background: var(--brand); color: var(--brand-foreground);
}
.dropzone-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.dropzone-sub { font-size: 14px; opacity: .8; }

.upload-options {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: -12px; color: var(--muted-foreground); font-size: 13px;
}

/* ---------- Uploadwachtrij ---------- */
.upload-queue { display: flex; flex-direction: column; gap: 8px; }
.upload-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.upload-item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-status { font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.upload-item.is-error .upload-item-status { color: var(--destructive); }
.upload-item.is-done .upload-item-status { color: var(--success-strong); }
.progress { grid-column: 1 / -1; height: 4px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .2s; }
.upload-item.is-done .progress-bar { background: var(--success); }
.upload-item.is-error .progress-bar { background: var(--destructive); }

/* ---------- Bestandenlijst ---------- */
.list-card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.list-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.list-head h2 { font-size: 15px; font-weight: 600; flex: 1; }

.check {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; margin: 0; flex: none;
  border: 1px solid var(--input); border-radius: 4px;
  background: var(--card); box-shadow: var(--shadow-xs);
  display: grid; place-items: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.check:hover { border-color: var(--muted-foreground); }
.check:checked, .check:indeterminate { background: var(--primary); border-color: var(--primary); }
.check:checked::after {
  content: ''; width: 5px; height: 9px; margin-top: -2px;
  border: solid var(--primary-foreground); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check:indeterminate::after { content: ''; width: 8px; height: 2px; background: var(--primary-foreground); }

.selection-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--secondary); border-bottom: 1px solid var(--border);
}
.selection-count { font-size: 13px; font-weight: 500; }
.selection-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.file-row.is-selected { background: color-mix(in srgb, var(--primary) 5%, transparent); }

/* ---------- Delen ---------- */
.share-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--secondary); color: var(--secondary-foreground); font-size: 12px;
}
.share-chip.from { background: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand-foreground); }
@media (prefers-color-scheme: dark) {
  .share-chip.from { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
}
.share-panel {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 8px; padding: 12px 14px;
  background: var(--secondary); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.share-panel-bulk { margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-top: 0; padding: 12px 20px; }
.share-panel-title { font-size: 13px; font-weight: 500; }
.share-panel-hint { font-size: 12px; color: var(--muted-foreground); }
.share-people { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.share-person { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.share-person .check { width: 16px; height: 16px; }
.share-person.is-locked { color: var(--muted-foreground); cursor: default; }
.share-panel-actions { display: flex; gap: 6px; justify-content: flex-end; }
.list-meta { font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted-foreground); }

.file-row {
  display: grid; grid-template-columns: 16px 40px 1fr auto; gap: 4px 14px; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  transition: background-color .15s;
}
.file-row:last-child { border-bottom: 0; }
.file-row .check { grid-row: 1 / 3; }
.file-icon {
  grid-row: 1 / 3;
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--radius-sm); background: var(--secondary); color: var(--muted-foreground);
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
}
.file-icon[data-kind="image"] { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success-strong); }
.file-icon[data-kind="doc"]   { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.file-icon[data-kind="sheet"] { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success-strong); }
.file-icon[data-kind="archive"] { background: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand-foreground); }
@media (prefers-color-scheme: dark) {
  .file-icon[data-kind="archive"] { color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, transparent); }
  .file-icon[data-kind="doc"] { color: #93b7dd; }
}

.file-name {
  font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit; text-decoration: none;
}
.file-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.file-meta { grid-column: 3; font-size: 13px; color: var(--muted-foreground); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.file-meta .expires-soon { color: var(--destructive); }
.file-meta .expires-never { color: var(--success-strong); }

.file-actions { grid-column: 4; grid-row: 1 / 3; display: flex; align-items: center; gap: 4px; }
.file-actions .select { height: 32px; }
.confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-foreground); }

@media (max-width: 560px) {
  .file-row { grid-template-columns: 16px 40px 1fr; }
  .file-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-end; margin-top: 6px; }
  .selection-bar { padding: 10px 16px; }
  .topbar-inner { padding: 0 16px; }
  .brand-app { display: none; }
  .page { padding: 24px 16px 64px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  padding: 10px 16px;
  background: var(--foreground); color: var(--background);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font-size: 13px; z-index: 50;
}
.toast.is-error { background: var(--destructive); color: var(--destructive-foreground); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
