/* gate Share — design tokens + components. No build step, no framework. */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/montserrat-latin-ext-wght-normal.woff2") format("woff2-variations");
  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: "Montserrat";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/montserrat-latin-wght-normal.woff2") format("woff2-variations");
  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;
}

:root {
  --brand: #ff6400;
  --brand-hover: #eb5c00;
  --brand-text: #c24a00;      /* brand orange darkened for AA-contrast text on white */
  --brand-50: #fff5ee;
  --brand-100: #ffe6d5;
  --brand-200: #ffc9a6;

  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #6b6b75;
  --line: #e6e6ea;
  --line-strong: #d4d4d8;
  --surface: #ffffff;
  --bg: #f6f6f7;

  --success: #15803d;
  --success-bg: #ecfdf3;
  --danger: #c81e1e;
  --danger-bg: #fef2f2;
  --warning: #a15c07;
  --warning-bg: #fffbeb;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(24 24 27 / 0.04), 0 4px 16px rgb(24 24 27 / 0.04);
  --shadow-lg: 0 8px 32px rgb(24 24 27 / 0.08);
  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --on-brand: #ffffff;
  --danger-line: #f5c2c2;
  --danger-line-strong: #f0b4b4;
  --success-line: #bbe5c8;
  --warning-line: #f6dfa4;
  --neutral-bg: #f1f1f3;
  --input-hover: #b8b8c0;
  --placeholder: #a1a1aa;
  --hover-overlay: rgb(0 0 0 / .08);
  --knob: #ffffff;
  --backdrop: rgb(24 24 27 / .45);
  color-scheme: light;
}

/* ---------- Dark theme: only when chosen with the sun/moon button (default is light) ---------- */

:root[data-theme="dark"] { 
    --brand: #ff6400;
    --brand-hover: #ff7a26;
    --brand-text: #ff9a52;
    --brand-50: #2a1a10;
    --brand-100: #3b2313;
    --brand-200: #6e3a17;

    --ink: #f4f4f5;
    --ink-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #2e2e34;
    --line-strong: #44444c;
    --surface: #1c1c21;
    --bg: #121215;

    --success: #4ade80;
    --success-bg: #11281b;
    --danger: #f87171;
    --danger-bg: #2c1515;
    --warning: #fbbf24;
    --warning-bg: #2b2210;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 8px 32px rgb(0 0 0 / 0.5);

    --on-brand: #ffffff;
    --danger-line: #5b2626;
    --danger-line-strong: #7a3131;
    --success-line: #1f5134;
    --warning-line: #5a4614;
    --neutral-bg: #27272c;
    --input-hover: #5a5a63;
    --placeholder: #71717a;
    --hover-overlay: rgb(255 255 255 / .1);
    --knob: #f4f4f5;
    --backdrop: rgb(0 0 0 / .6);
    color-scheme: dark;
   }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.layout-public {
  background:
    radial-gradient(1200px 500px at 100% -10%, var(--brand-100), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, var(--brand-50), transparent 60%),
    var(--bg);
}

a { color: var(--brand-text); text-underline-offset: 2px; }
a:hover { color: var(--ink); }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}

::selection { background: var(--brand-100); }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

.main { flex: 1; padding-top: 32px; padding-bottom: 56px; }

/* ---------- Typography ---------- */

.display { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.h1 { font-size: clamp(24px, 3vw, 30px); line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
.h2, .card h2:not([class]) { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.h3 { font-size: 17px; line-height: 1.35; font-weight: 700; margin-bottom: 14px; }
.lead { font-size: 17px; color: var(--ink-2); max-width: 32em; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-text); margin-bottom: 8px; }
.accent { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.plain-list { list-style: none; margin: 0; padding: 0; }

/* ---------- Top bar ---------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.layout-public .topbar { background: transparent; border-bottom-color: transparent; position: static; }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 115px; height: auto; }
@media (max-width: 720px) { .brand img { width: 96px; } }
.brand-product { font-weight: 600; font-size: 18px; padding-left: 12px; border-left: 1px solid var(--line-strong); }

.nav { display: flex; gap: 4px; margin-right: auto; overflow-x: auto; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none;
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.nav-link:hover { background: var(--bg); color: var(--ink); }
.nav-link.is-active { background: var(--brand-50); color: var(--brand-text); }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 4px 6px 4px 4px; border-radius: 999px;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--bg); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.user-menu-panel a, .user-menu-panel .link-button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500;
}
.user-menu-panel a:hover, .user-menu-panel .link-button:hover { background: var(--bg); }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; padding-bottom: 6px; }
  .user-menu { margin-left: auto; }
  .user-name { display: none; }
  .nav { order: 3; width: 100%; margin: 0 -4px; padding-bottom: 4px; }
}

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--muted); }
.layout-public .footer { background: transparent; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 16px; }
.footer a { color: var(--muted); }

/* ---------- Cards & layout ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
@media (max-width: 520px) { .card { padding: 18px; } }
.card + .card { margin-top: 16px; }
.card-danger { border-color: var(--danger-line); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .muted { margin-top: 6px; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back { margin-bottom: 12px; font-size: 14px; }
.back a { color: var(--muted); text-decoration: none; font-weight: 600; }
.back a:hover { color: var(--ink); }

.narrow { max-width: 440px; margin: 24px auto 0; }
.narrow-wide { max-width: 640px; }

.details-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) { .details-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.details-main > .card + .card { margin-top: 16px; }

/* ---------- Auth ---------- */

.auth { display: grid; gap: 40px; align-items: center; padding-top: 24px; }
@media (min-width: 900px) { .auth { grid-template-columns: 1.15fr 1fr; padding-top: 56px; } }
.auth-intro .lead { margin-top: 18px; }
.auth-card { width: 100%; max-width: 420px; justify-self: center; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card h2 { margin-bottom: 20px; }
.auth-card .center { margin-top: 18px; }

/* ---------- Forms ---------- */

.form { display: grid; gap: 16px; }
.form-inline { display: flex; gap: 8px; }
.form-inline select { flex: 1; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.form .field { margin-bottom: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; }
.field-label .muted { font-weight: 500; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 44px; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236b6b75' stroke-width='2'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
input:hover, textarea:hover, select:hover { border-color: var(--input-hover); }
input:focus, textarea:focus, select:focus, .chip-input:focus-within {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}
::placeholder { color: var(--placeholder); }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex-shrink: 0; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.password-fields { margin-top: 14px; padding: 16px; border-radius: var(--radius-sm); background: var(--bg); display: grid; gap: 12px; }
.password-fields[hidden] { display: none; }
.password-fields .field { margin: 0; }

/* Segmented control */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; gap: 4px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; text-align: center; padding: 8px 6px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.segmented input:checked + span { background: var(--surface); color: var(--brand-text); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }

/* Chip input */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; cursor: text;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 6px; background: var(--surface); min-height: 46px;
}
.chip-input input { border: 0 !important; box-shadow: none !important; padding: 5px 6px; flex: 1; min-width: 160px; width: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  background: var(--brand-50); color: var(--ink); border: 1px solid var(--brand-100);
  border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 14px; font-weight: 500;
}
.chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-invalid { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chip-remove {
  border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; border-radius: 50%;
  font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.chip-remove:hover { background: var(--hover-overlay); color: var(--ink); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1; text-decoration: none; white-space: nowrap;
  padding: 12px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); color: var(--on-brand); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-text); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line-strong); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: var(--on-brand); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.link-button { font: inherit; background: none; border: 0; padding: 0; color: var(--brand-text); cursor: pointer; font-weight: 600; font-size: 13px; }
.link-button:hover { color: var(--ink); text-decoration: underline; }
.link-danger { color: var(--danger); }
.icon-button {
  border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.icon-button:hover { background: var(--bg); color: var(--ink); }

/* ---------- Alerts, badges, tags ---------- */

.alert { padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; font-weight: 500; border: 1px solid; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.alert ul li + li { margin-top: 4px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-expired { background: var(--neutral-bg); color: var(--muted); }
.badge-revoked { background: var(--danger-bg); color: var(--danger); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--brand-50); color: var(--brand-text); font-size: 12px; font-weight: 700; vertical-align: middle; margin-left: 4px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-right: 8px; vertical-align: middle; }
.dot-success { background: var(--success); }

/* ---------- Composer (new transfer) ---------- */

.composer { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .composer { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.composer .card + .card { margin-top: 0; }
.composer-files { min-height: 100%; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 220px; padding: 32px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--brand-200); border-radius: var(--radius); background: var(--brand-50);
  transition: background .15s, border-color .15s, transform .15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand); background: var(--brand-100); }
.dropzone.is-dragover { transform: scale(1.01); }
.dropzone:focus-within { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.dropzone-icon { width: 44px; height: 44px; fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.dropzone-title { font-weight: 700; font-size: 17px; }
.dropzone-hint { color: var(--muted); font-size: 14px; }
.dropzone .link { color: var(--brand-text); font-weight: 600; text-decoration: underline; }

.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list:empty { display: none; }
.file-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 10px 10px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.file-icon {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-text); font-size: 11px; font-weight: 800; letter-spacing: .02em; overflow: hidden;
}
.file-meta { display: grid; gap: 2px; min-width: 0; }
.file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-status { font-size: 12px; color: var(--muted); }
.file-item.is-error { border-color: var(--danger-line); background: var(--danger-bg); }
.file-item.is-error .file-status { color: var(--danger); }
.file-item.is-done .file-icon { background: var(--brand-100); }
.progress { display: block; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width .2s; }
.file-item.is-done .progress { display: none; }
.file-summary { margin-top: 12px; }

/* ---------- Transfer list ---------- */

.toolbar { display: flex; align-items: center; gap: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.tab { padding: 7px 16px; border-radius: 7px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.tab.is-active { background: var(--brand); color: var(--on-brand); }
.tab:not(.is-active):hover { background: var(--bg); color: var(--ink); }
.search { flex: 1; min-width: 220px; max-width: 420px; }
.toggle-link { font-size: 14px; font-weight: 600; margin-left: auto; }

.transfer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.transfer-row.card {
  display: grid; gap: 8px 24px; align-items: center; text-decoration: none; color: inherit; padding: 18px 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.transfer-row:hover { border-color: var(--brand-200); box-shadow: var(--shadow-lg); color: inherit; }
@media (min-width: 900px) {
  .transfer-row.card { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr) minmax(0, 1.2fr) 120px; }
}
.transfer-main { display: grid; gap: 2px; min-width: 0; }
.transfer-subject { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-recipients { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-stats, .transfer-dates { display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.stat-value { font-weight: 700; color: var(--ink); }
.transfer-row .badge { justify-self: end; }
@media (max-width: 899px) {
  .transfer-row .badge { grid-row: 1; grid-column: 2; }
  .transfer-stats, .transfer-dates { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; gap: 16px; }
}

.empty { text-align: center; padding: 56px 24px; display: grid; justify-items: center; gap: 12px; }
.empty-icon { width: 48px; height: 48px; fill: none; stroke: var(--brand); stroke-width: 1.4; stroke-linejoin: round; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 4px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tr.is-muted td { color: var(--muted); }
.table .actions-cell { text-align: right; }
.table .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; }
@media (max-width: 640px) {
  .table thead { display: none; }
  .table tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table td { display: flex; justify-content: space-between; gap: 16px; padding: 4px; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; }
  .table .actions { justify-content: flex-start; padding-top: 8px; }
  .table .actions::before { content: none; }
}

/* ---------- Download page & misc ---------- */

.download-card .file-list { margin-bottom: 20px; }
.download-card > .muted.small { margin-top: 16px; }
.message, .message-quote { white-space: pre-line; }
.message-quote { margin: 16px 0 0; padding: 14px 18px; background: var(--bg); border-left: 3px solid var(--brand); border-radius: 6px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 8px; letter-spacing: -0.03em; }
.card.center .btn { margin-top: 20px; }
.card.center .muted { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.file-list + .muted.small { margin-top: 12px; }
.badge-failed { background: var(--warning-bg); color: var(--danger); border: 1px solid var(--danger-line); }

/* ---------- Activity indicators ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.spinner {
  display: inline-block; width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--brand-100); border-top-color: var(--brand); animation: spin .8s linear infinite;
}
.spinner-lg { width: 44px; height: 44px; border-width: 4px; }

.progress-lg { height: 8px; margin-top: 8px; }
.progress-indeterminate .progress-bar { width: 40%; animation: indeterminate 1.4s ease-in-out infinite; }

.send-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: var(--backdrop); backdrop-filter: blur(2px);
}
.send-overlay[hidden] { display: none; }
.send-card {
  width: 100%; max-width: 440px; padding: 32px 28px; text-align: center; display: grid; justify-items: center; gap: 10px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.send-card .h3 { margin: 8px 0 0; }
.send-card .progress { width: 100%; }
body.is-busy { overflow: hidden; }

.send-step { min-height: 1.5em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-progress-meta { display: flex; justify-content: space-between; gap: 12px; width: 100%; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.send-progress-meta[hidden] { display: none; }
.send-progress-percent { font-weight: 700; color: var(--brand-text); white-space: nowrap; }
.send-progress-meta > span:first-child { flex: 1; min-width: 0; text-align: left; }
.send-card .btn[hidden] { display: none; }
.file-item.is-pending .progress { display: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.card-danger form { margin-top: 16px; }

/* ---------- Row action menu (three dots) ---------- */

.table-wrap-menus { overflow: visible; }  /* dropdowns must not be clipped by the scroll container */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.row-menu[open] > .row-menu-toggle { background: var(--bg); color: var(--ink); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 230px; padding: 6px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.menu-panel form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px;
  background: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); color: var(--ink); outline: none; }
.menu-item svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-item-danger, .menu-item-danger:hover { color: var(--danger); }
.menu-item-danger svg { stroke: var(--danger); }
.menu-item-danger:hover { background: var(--danger-bg); }
.menu-separator { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* ---------- Icons (see Infrastructure/Icons.cs) ---------- */

.icon {
  width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.with-icon { display: inline-flex; align-items: center; gap: 8px; }
h1.with-icon, h2.with-icon { display: flex; }
.h2.with-icon .icon { width: 24px; height: 24px; color: var(--brand); }
.h3.with-icon .icon { width: 20px; height: 20px; color: var(--brand); }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg .icon { width: 20px; height: 20px; }

/* Navigation and user menu */
.nav-link { display: inline-flex; align-items: center; gap: 8px; }
.nav-link .icon { width: 17px; height: 17px; }
.user-menu-panel a, .user-menu-panel .link-button { display: flex; align-items: center; gap: 10px; }
.user-menu-panel .icon { color: var(--muted); }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 10px; }
.alert .icon { width: 20px; height: 20px; margin-top: 1px; }

/* Transfer list */
.search { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; }
.stat { display: inline-flex; align-items: center; gap: 6px; }
.stat .icon { width: 16px; height: 16px; color: var(--muted); }
.transfer-dates .icon { width: 14px; height: 14px; }
.toggle-link .icon { width: 16px; height: 16px; }

/* Small inline icons */
.tag.with-icon { gap: 4px; }
.tag .icon { width: 13px; height: 13px; }
.back .icon { width: 16px; height: 16px; }
.switch .with-icon { gap: 6px; }
.switch .with-icon .icon { width: 16px; height: 16px; color: var(--muted); }
.center-flex { display: flex; justify-content: center; flex-wrap: wrap; }
.center-flex.with-icon { gap: 6px; }
.center-flex .icon { width: 15px; height: 15px; }

/* Large state icons (download page, error page) */
.state-icon {
  display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 14px;
  border-radius: 50%; background: var(--brand-50); color: var(--brand);
}
.state-icon .icon { width: 30px; height: 30px; stroke-width: 1.6; }
.state-icon-muted { background: var(--neutral-bg); color: var(--muted); }

/* Phones: navigation as an evenly split tab bar (icon above label), always fully visible */
@media (max-width: 720px) {
  .nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; overflow: visible; }
  .nav-link { flex-direction: column; justify-content: center; gap: 3px; padding: 7px 4px; border-radius: 10px; font-size: 12px; text-align: center; }
  .nav-link .icon { width: 20px; height: 20px; }
}

/* Destructive icon button (e.g. remove recipient) */
.icon-button-danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-button .icon { width: 18px; height: 18px; }

/* Privacy page */
.privacy-search { display: flex; gap: 10px; flex-wrap: wrap; }
.privacy-search input { flex: 1; min-width: 240px; }
.data-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; font-size: 14px; }
.data-list dt { color: var(--muted); font-weight: 600; }
.data-list dd { margin: 0; }

/* Printing (e.g. a GDPR access report): only the content */
@media print {
  .topbar, .footer, .no-print, .alert { display: none !important; }
  body, .layout-public { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .main { padding: 0; }
}
.card > h3.h3 { margin-top: 24px; }

/* ---------- Cookie information notice ---------- */

.cookie-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90; display: flex; justify-content: center; pointer-events: none; }
.cookie-notice[hidden] { display: none; }
.cookie-notice-inner {
  pointer-events: auto; display: flex; align-items: center; gap: 16px; max-width: 760px; width: 100%;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 14px; line-height: 1.5;
}
.cookie-notice-inner p { margin: 0; flex: 1; color: var(--ink-2); }
.cookie-notice-inner strong { color: var(--ink); }
.cookie-notice-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-50); color: var(--brand); flex-shrink: 0; }
.cookie-notice-icon .icon { width: 22px; height: 22px; }
@media (max-width: 600px) {
  .cookie-notice-inner { flex-wrap: wrap; }
  .cookie-notice-icon { display: none; }
  .cookie-notice-inner .btn { width: 100%; }
}
@media print { .cookie-notice { display: none !important; } }

/* Cookie page */
.prose h2 { font-size: 18px; margin: 28px 0 8px; }
.prose p, .prose ul { margin: 0 0 12px; color: var(--ink-2); }
.prose ul { padding-left: 20px; }
.prose code { font-family: var(--mono); font-size: 13px; background: var(--bg); padding: 1px 6px; border-radius: 4px; }

/* ---------- Theme toggle and logo variants ---------- */

.theme-toggle .icon { width: 20px; height: 20px; }
.layout-public .theme-toggle { margin-left: auto; }
.theme-toggle .theme-icon-dark, .theme-toggle .theme-icon-light { display: grid; place-items: center; }

/* Light (default): moon button, dark-text logo */
.theme-toggle .theme-icon-light, .brand .logo-dark { display: none; }

/* Dark, chosen manually */
:root[data-theme="dark"] .theme-toggle .theme-icon-dark, :root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-icon-light { display: grid; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }


/* Signed in: [logo] [navigation ......] [theme] [user]  */
.layout-app .theme-toggle { order: 3; }
.layout-app .user-menu { order: 4; }
@media (max-width: 720px) {
  /* first row: [logo ....] [theme] [user], second row: navigation */
  .theme-toggle { margin-left: auto; }
  .layout-app .theme-toggle { order: 1; }
  .layout-app .user-menu { order: 2; margin-left: 0; }
  .layout-app .nav { order: 3; }
}
@media print { .theme-toggle { display: none !important; } }

/* ---------- Animated sky (all pages, see Pages/Shared/_Sky.cshtml) ---------- */

:root {
  --sky-top: #cfe8ff;
  --sky-middle: #e9f4ff;
  --cloud: #ffffff;
  --cloud-opacity: .9;
}
:root[data-theme="dark"] { --sky-top: #0c1424; --sky-middle: #111827; --cloud: #cbd5e1; --cloud-opacity: .07; }

/* Fixed layer behind all content; the page background shows through below the sky. */
.sky {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-middle) 45%, var(--bg) 85%);
}
.sky-defs { position: absolute; }
.cloud {
  position: absolute; left: -30vw; height: auto; fill: var(--cloud); opacity: var(--cloud-opacity);
  filter: drop-shadow(0 6px 14px rgb(15 40 80 / .06));
  animation: cloud-drift linear infinite; will-change: transform;
}
@keyframes cloud-drift {
  from { transform: translateX(0); }
  to { transform: translateX(160vw); }
}

/* Size, height, speed and start position per cloud (negative delay = already on screen at load). */
.cloud-1 { top: 6%;  width: 260px; animation-duration: 95s;  animation-delay: -10s; --rest: 8%; }
.cloud-2 { top: 18%; width: 160px; animation-duration: 120s; animation-delay: -70s; --rest: 70%; opacity: calc(var(--cloud-opacity) * .8); }
.cloud-3 { top: 34%; width: 340px; animation-duration: 140s; animation-delay: -40s; --rest: 40%; }
.cloud-4 { top: 52%; width: 200px; animation-duration: 105s; animation-delay: -95s; --rest: 85%; opacity: calc(var(--cloud-opacity) * .7); }
.cloud-5 { top: 66%; width: 280px; animation-duration: 130s; animation-delay: -20s; --rest: 18%; opacity: calc(var(--cloud-opacity) * .8); }
.cloud-6 { top: 12%; width: 120px; animation-duration: 85s;  animation-delay: -55s; --rest: 55%; opacity: calc(var(--cloud-opacity) * .6); }
.cloud-7 { top: 80%; width: 220px; animation-duration: 115s; animation-delay: -80s; --rest: 62%; opacity: calc(var(--cloud-opacity) * .6); }

/* Reduced motion: clouds stand still at fixed positions. */
@media (prefers-reduced-motion: reduce) {
  .cloud { left: var(--rest); }
}
/* Phones: fewer, smaller clouds */
@media (max-width: 600px) {
  .cloud { max-width: 45vw; }
  .cloud-4, .cloud-6, .cloud-7 { display: none; }
}
/* Frosted cards on the sky: clouds shimmer through, text stays readable. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .main .card {
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
  }
}
@media print { .sky { display: none; } }
