/* Tivoli Secure Transfer - built on the Tivoli brand tokens (tivoli.css) */
:root {
  --bg: var(--tivoli-gold-light-100);
  --surface: #fff;
  --ink: var(--tivoli-gold-dark-60);
  --ink-strong: var(--tivoli-gold-dark-80);
  --muted: var(--tivoli-gold-dark-40);
  --rule: var(--tivoli-gold-light-60);
  --rule-strong: var(--tivoli-gold-light-40);
  --gold: var(--tivoli-gold);
  --side: var(--tivoli-gold-dark-60);
  --ok: var(--tivoli-green-dark-20);   --ok-bg: var(--tivoli-green-light-100);
  --warn: var(--tivoli-gold-dark-40);  --warn-bg: var(--tivoli-gold-light-80);
  --bad: var(--tivoli-red-dark-20);    --bad-bg: var(--tivoli-red-light-100);
  --info: var(--tivoli-blue-dark-40);  --info-bg: var(--tivoli-blue-light-100);
  --radius: 6px;
  --side-w: 268px;
  --pad: clamp(16px, 3vw, 40px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--tivoli-font-body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3 { margin: 0; color: var(--ink); }
h1 { font: 900 clamp(32px, 4.2vw, 52px)/1.04 var(--tivoli-font-display); letter-spacing: -.005em; }
h2 { font: 900 clamp(22px, 2.4vw, 30px)/1.1 var(--tivoli-font-display); }
h3 { font: 700 15px/1.2 var(--tivoli-font-label); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
p { margin: 0 0 .8em; }
a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--ink-strong); }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .86em; background: var(--tivoli-gold-light-80); padding: .1em .4em; border-radius: 4px; }
small, .small { font-size: 14px; }
.muted { color: var(--muted); }
.label, .kicker { font: 700 13px/1.2 var(--tivoli-font-label); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--tivoli-gold-light-40); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--radius);
  font: 700 15px/1 var(--tivoli-font-label); text-transform: uppercase; letter-spacing: .1em; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--gold); color: var(--tivoli-gold-dark-80); }
.btn-primary:hover { background: var(--tivoli-gold-light-20); color: var(--tivoli-gold-dark-80); }
.btn-dark { background: var(--tivoli-gold-dark-60); color: #fff; }
.btn-dark:hover { background: var(--tivoli-gold-dark-80); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--tivoli-gold-dark-20); color: var(--ink); }
.btn-ghost:hover { background: var(--tivoli-gold-light-80); }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--tivoli-red-dark-40); border-color: var(--tivoli-red-dark-40); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; border-radius: 50%; background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-icon:hover { background: var(--tivoli-gold-light-80); color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; cursor: pointer; }

/* ---------- form controls ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; align-content: start; }
.field > label, .field > .label { font: 700 13px/1 var(--tivoli-font-label); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; background: #fff; color: var(--ink-strong); border: 1px solid var(--rule-strong); border-radius: var(--radius); font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(188,159,109,.28); }
input::placeholder { color: var(--tivoli-gold-light-20); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 180px; }
.grid2 { display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-items: start; }
.grid2.lists { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid2 > .check { margin: 26px 0 16px !important; min-height: 44px; align-items: center; }
.field > textarea { min-height: 96px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--tivoli-gold-dark-40); margin-top: 3px; flex: none; }
.hint { font-size: 14px; color: var(--muted); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font: 700 12px/1 var(--tivoli-font-label); text-transform: uppercase; letter-spacing: .1em; background: var(--tivoli-gold-light-80); color: var(--muted); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--tivoli-green-light-80); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--tivoli-gold-light-60); }
.chip.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--tivoli-red-light-80); }
.chip.info { background: var(--info-bg); color: var(--info); border: 1px solid var(--tivoli-blue-light-80); }
.chip.dark { background: var(--tivoli-gold-dark-60); color: var(--tivoli-gold-light-40); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-hero { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 56px 40px 48px; color: #fff; text-align: center; overflow: hidden;
  background-color: var(--tivoli-gold-dark-60); }
.harlequin { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='90'%3E%3Crect width='60' height='90' fill='%234B402C'/%3E%3Cpolygon points='30,0 60,45 30,90 0,45' fill='%2355492F'/%3E%3C/svg%3E"); background-size: 60px 90px; }
.harlequin-light { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='60'%3E%3Crect width='40' height='60' fill='%23F8F5F0'/%3E%3Cpolygon points='20,0 40,30 20,60 0,30' fill='%23F2ECE2'/%3E%3C/svg%3E"); background-size: 40px 60px; }
.login-hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(75,64,44,.0) 0%, rgba(38,32,22,.55) 100%); pointer-events: none; }
.login-hero > * { position: relative; z-index: 1; }
.login-hero .logo { width: min(240px, 52vw); }
.login-hero h1 { color: #fff; max-width: 14ch; margin: 0 auto 18px; font-size: clamp(38px, 5vw, 66px); }
.login-hero p { color: var(--tivoli-gold-light-60); max-width: 36ch; margin: 0 auto; font-size: 19px; }
.login-hero .payoff { width: 190px; opacity: .95; }
.login-panel { display: grid; place-items: center; padding: 40px var(--pad); background: var(--bg); }
.login-card { width: min(440px, 100%); }
.login-card h2 { margin: 6px 0 22px; }
.sep { display: flex; align-items: center; gap: 14px; margin: 26px 0; color: var(--muted); font: 700 12px/1 var(--tivoli-font-label); letter-spacing: .14em; text-transform: uppercase; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: var(--rule-strong); }
.ms-btn { width: 100%; min-height: 52px; font-size: 16px; }
.ms-logo { width: 20px; height: 20px; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 2px; }
.ms-logo i { background: var(--tivoli-gold-dark-80); opacity: .85; }
.assure { margin-top: 28px; display: flex; gap: 10px; flex-wrap: wrap; }
.err { background: var(--bad-bg); color: var(--tivoli-red-dark-40); border: 1px solid var(--tivoli-red-light-80); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 15px; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--tivoli-gold-light-60); display: flex; flex-direction: column; overflow-y: auto; z-index: 30; }
.side .brand { padding: 30px 24px 22px; text-align: center; border-bottom: 1px solid rgba(215,197,168,.14); }
.side .brand img { width: 128px; display: block; margin: 0 auto 10px; }
.side .brand .app { font: 700 12px/1 var(--tivoli-font-label); letter-spacing: .26em; text-transform: uppercase; color: var(--tivoli-gold-light-20); }
.nav { padding: 14px 12px; display: grid; gap: 2px; }
.nav h4 { margin: 18px 12px 6px; font: 700 12px/1 var(--tivoli-font-label); letter-spacing: .2em; text-transform: uppercase; color: var(--tivoli-gold-dark-20); }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); text-decoration: none; color: var(--tivoli-gold-light-60); font: 700 15px/1.1 var(--tivoli-font-label); letter-spacing: .1em; text-transform: uppercase; border-left: 3px solid transparent; transition: background .15s, color .15s; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(215,197,168,.09); color: #fff; }
.nav a.active { background: rgba(188,159,109,.17); color: #fff; border-left-color: var(--gold); }
.nav a.active svg { color: var(--gold); opacity: 1; }
.nav a .count { margin-left: auto; font-size: 12px; background: rgba(215,197,168,.16); border-radius: 10px; padding: 3px 8px; letter-spacing: .04em; }
.nav .ws-link { font-size: 14px; letter-spacing: .06em; padding: 8px 12px; }
.side .who { margin-top: auto; padding: 16px 18px 18px; border-top: 1px solid rgba(215,197,168,.14); display: flex; gap: 12px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--tivoli-gold-dark-80); display: grid; place-items: center; font: 700 15px/1 var(--tivoli-font-label); letter-spacing: .04em; flex: none; }
.who .nm { min-width: 0; flex: 1; }
.who .nm b { display: block; font: 600 15px/1.25 var(--tivoli-font-body); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .nm span { display: block; font-size: 13px; color: var(--tivoli-gold-light-20); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .btn-icon { color: var(--tivoli-gold-light-40); }
.who .btn-icon:hover { background: rgba(215,197,168,.14); color: #fff; }
.topbar { display: none; }
.main { min-width: 0; padding: clamp(20px, 3vw, 44px) var(--pad) 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--rule-strong); position: relative; }
.page-head::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 72px; height: 3px; background: var(--gold); }
.page-head .kicker { margin-bottom: 10px; }
.page-head .sub { color: var(--muted); margin: 10px 0 0; max-width: 62ch; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- cards, metrics ---------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 22px; }
.card + .card, .stack > * + * { margin-top: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.metrics { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 22px; }
.metric { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 20px 16px; position: relative; overflow: hidden; }
.metric::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--rule-strong); }
.metric.ok::before { background: var(--tivoli-green); } .metric.warn::before { background: var(--gold); } .metric.bad::before { background: var(--tivoli-red); } .metric.info::before { background: var(--tivoli-blue); }
.metric .v { font: 900 38px/1 var(--tivoli-font-display); color: var(--ink-strong); margin: 10px 0 6px; letter-spacing: -.01em; }
.metric .v small { font: 700 15px/1 var(--tivoli-font-label); letter-spacing: .08em; color: var(--muted); margin-left: 4px; text-transform: uppercase; }
.metric .d { font-size: 14px; color: var(--muted); }
.metric .label { display: block; min-height: 2.7em; line-height: 1.3; }   /* titles of one or two lines: the numbers below stay on one line across the row */
.metric .d { min-height: 2.9em; }
.cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.bar { height: 8px; background: var(--tivoli-gold-light-80); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.bar.warn > i { background: var(--tivoli-gold-dark-20); } .bar.bad > i { background: var(--tivoli-red); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font: 700 11px var(--tivoli-font-label); letter-spacing: .08em; fill: var(--muted); text-transform: uppercase; }
.score { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.ring { width: 132px; height: 132px; }
.ring text { font: 900 34px var(--tivoli-font-display); fill: var(--ink-strong); }
.ring .sm { font: 700 11px var(--tivoli-font-label); letter-spacing: .16em; fill: var(--muted); text-transform: uppercase; }

/* ---------- tables / lists ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 700 12px/1 var(--tivoli-font-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; font-size: 16px; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--tivoli-gold-light-100); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; font-size: 14px; color: var(--muted); }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h2 { font-size: 24px; margin-bottom: 8px; color: var(--ink); }
.empty .diamond { width: 72px; height: 108px; margin: 0 auto 18px; opacity: .9; }

/* file browser */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font: 700 14px/1 var(--tivoli-font-label); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 6px 4px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep-c { color: var(--rule-strong); }
.crumbs b { color: var(--ink); padding: 6px 4px; }
.files { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 150px 96px 130px 44px; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--rule); transition: background .12s; }
.frow:last-child { border-bottom: 0; }
.frow.head { padding-top: 12px; padding-bottom: 12px; font: 700 12px/1 var(--tivoli-font-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); background: var(--tivoli-gold-light-100); }
.frow:not(.head):hover { background: var(--tivoli-gold-light-100); }
.fname { display: flex; align-items: center; gap: 14px; min-width: 0; text-align: left; background: none; border: 0; font: inherit; color: var(--ink-strong); cursor: pointer; padding: 0; }
.fname .ic { width: 38px; height: 38px; border-radius: 8px; background: var(--tivoli-gold-light-80); color: var(--tivoli-gold-dark-40); display: grid; place-items: center; flex: none; }
.fname .ic svg { width: 21px; height: 21px; }
.fname.folder .ic { background: var(--tivoli-gold-dark-60); color: var(--gold); }
.fname .t { min-width: 0; }
.fname .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname .t span { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.fcell { font-size: 15px; color: var(--muted); }
.dropzone { position: relative; }
.dropzone.drag::after { content: 'Drop to upload'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(248,245,240,.92); border: 2px dashed var(--gold); border-radius: 8px; font: 900 30px var(--tivoli-font-display); color: var(--ink); z-index: 5; }
.menu { position: absolute; z-index: 60; min-width: 210px; background: #fff; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 6px; box-shadow: 0 8px 28px rgba(38,32,22,.14); }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 5px; font: 600 15px var(--tivoli-font-body); color: var(--ink); cursor: pointer; text-align: left; }
.menu button svg { width: 18px; height: 18px; color: var(--muted); }
.menu button:hover { background: var(--tivoli-gold-light-80); }
.menu button.danger { color: var(--bad); } .menu button.danger svg { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 5px 0; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--bg); color: var(--ink); box-shadow: 0 24px 80px rgba(19,16,11,.35); }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(38,32,22,.55); backdrop-filter: blur(2px); }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 26px 28px 8px; }
.dlg-head h2 { font-size: 28px; }
.dlg-body { padding: 8px 28px 6px; overflow-y: auto; max-height: calc(100vh - 220px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 28px 24px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule-strong); margin: 0 0 20px; }
.tabs button { background: none; border: 0; padding: 12px 16px; font: 700 14px/1 var(--tivoli-font-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink-strong); border-bottom-color: var(--gold); }
.tabs button:hover { color: var(--ink); }
.list { display: grid; gap: 0; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.list > div { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.list > div:last-child { border-bottom: 0; }
.list .who2 { flex: 1; min-width: 0; }
.list .who2 b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list .who2 span { font-size: 14px; color: var(--muted); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--tivoli-gold-light-80); border: 1px solid var(--tivoli-gold-light-60); font-size: 15px; margin-bottom: 18px; }
.callout svg { width: 20px; height: 20px; flex: none; color: var(--tivoli-gold-dark-40); margin-top: 2px; }
.callout.ok { background: var(--ok-bg); border-color: var(--tivoli-green-light-80); } .callout.ok svg { color: var(--ok); }
.callout.bad { background: var(--bad-bg); border-color: var(--tivoli-red-light-80); } .callout.bad svg { color: var(--bad); }
.secret { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px dashed var(--tivoli-gold-dark-20); border-radius: var(--radius); padding: 10px 12px; }
.secret code { flex: 1; background: none; padding: 0; word-break: break-all; font-size: 14px; }

/* ---------- upload tray ---------- */
.tray { position: fixed; right: 20px; bottom: 20px; width: min(400px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--rule-strong); border-radius: 10px; box-shadow: 0 14px 50px rgba(38,32,22,.22); z-index: 70; overflow: hidden; }
.tray header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--tivoli-gold-dark-60); color: #fff; font: 700 14px var(--tivoli-font-label); letter-spacing: .14em; text-transform: uppercase; }
.tray header button { background: none; border: 0; color: var(--tivoli-gold-light-40); cursor: pointer; font: inherit; letter-spacing: .1em; }
.tray .items { max-height: 300px; overflow-y: auto; }
.tray .it { padding: 12px 16px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.tray .it .nm { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tray .it .nm b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray .it .nm span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tray .it.fail .bar > i { background: var(--tivoli-red); }
.tray .it.done .bar > i { background: var(--tivoli-green); }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(460px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--tivoli-gold-dark-60); color: #fff; border-left: 4px solid var(--gold); border-radius: 6px; padding: 12px 16px; font-size: 16px; box-shadow: 0 10px 34px rgba(38,32,22,.3); animation: tin .22s ease-out; pointer-events: auto; }
.toast.bad { border-left-color: var(--tivoli-red); background: var(--tivoli-red-dark-60); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- public page ---------- */
.public { min-height: 100vh; background: var(--bg); }
.public .band { background: var(--tivoli-gold-dark-60); padding: 34px 20px 30px; text-align: center; }
.public .band img { width: 132px; }
.public .wrap { width: min(900px, 100% - 32px); margin: 32px auto 60px; position: relative; }
.public .card { padding: clamp(18px, 3vw, 34px); box-shadow: 0 10px 40px rgba(75,64,44,.08); }
.dropbox { border: 2px dashed var(--tivoli-gold-light-20); border-radius: 10px; padding: 40px 20px; text-align: center; background: var(--tivoli-gold-light-100); cursor: pointer; transition: background .15s, border-color .15s; }
.dropbox:hover, .dropbox.drag { background: var(--tivoli-gold-light-80); border-color: var(--gold); }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; align-items: baseline; }
.kv dt { font: 700 12px/1.4 var(--tivoli-font-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.checks { display: grid; gap: 10px; }
.chk { display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; }
.chk .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; margin-top: 2px; }
.chk .dot svg { width: 14px; height: 14px; }
.chk.pass .dot { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); }
.chk.warn .dot { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--tivoli-gold-dark-20); }
.chk.fail .dot { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }
.chk b { display: block; font-weight: 600; }
.chk .d { font-size: 15px; color: var(--muted); }
.chk .fix { font-size: 14px; color: var(--warn); margin-top: 4px; }
.area { margin: 26px 0 10px; }
.json { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--tivoli-gold-light-100); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--tivoli-gold-light-60); border-top-color: var(--gold); animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--tivoli-gold-light-80), var(--tivoli-gold-light-100), var(--tivoli-gold-light-80)); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 6px; height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1180px) {
  .frow { grid-template-columns: minmax(0, 1fr) 130px 84px 44px; }
  .frow .c-mod { display: none; }
}
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 36px 24px 40px; min-height: 280px; gap: 24px; }
  .login-hero h1 { font-size: 36px; } .login-hero .payoff { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .25s ease; box-shadow: none; }
  body.nav-open .side { transform: none; box-shadow: 0 0 80px rgba(0,0,0,.5); }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(38,32,22,.5); z-index: 20; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 15; padding: 8px 14px; background: var(--side); color: #fff; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar img { height: 34px; }
  .topbar .btn-icon { color: var(--tivoli-gold-light-40); }
  .topbar .btn-icon:hover { background: rgba(215,197,168,.14); color: #fff; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .frow { grid-template-columns: minmax(0, 1fr) 40px; row-gap: 4px; padding: 12px 14px; }
  .frow.head { display: none; }
  .frow .c-exp, .frow .c-size, .frow .c-mod { display: none; }
  .fname .t span.m { display: flex; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metric { padding: 14px; } .metric .v { font-size: 30px; }
  .score { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .dlg-head, .dlg-body, .dlg-foot { padding-left: 18px; padding-right: 18px; }
  .page-head { margin-bottom: 20px; }
  .actions .btn { flex: 1; }
  .tray { right: 8px; left: 8px; bottom: 8px; width: auto; }
  .chk { grid-template-columns: 28px 1fr; } .chk > :last-child { grid-column: 2; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 10px; }
}
@media (min-width: 721px) { .fname .t span.m { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .topbar, .actions, .tray { display: none !important; } .shell { display: block; } }

.toggles { display: grid; gap: 2px 28px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--rule); }
.toggles .check { margin: 0 0 10px !important; }

/* containment: nothing may push the page wider than the viewport */
.card, .metric, .stack > *, .cols > * { min-width: 0; }
.list > div > select { max-width: 46%; }
.list .who2 b, .list .who2 span { overflow: hidden; text-overflow: ellipsis; }
.list .who2 span { display: block; white-space: nowrap; }
.list { grid-template-columns: minmax(0, 1fr); }
.list > div > * { min-width: 0; }
.bar-row { justify-content: space-between; margin-bottom: 14px; }
.bar-row .crumbs { margin: 0; }
.frow.head > * { line-height: 1; }
.dlg-head { align-items: center; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none' stroke='%23736246' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
select[disabled] { opacity: .6; cursor: not-allowed; }
.savebar { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 24px calc(var(--pad) * -1) -80px; padding: 14px var(--pad); background: rgba(248,245,240,.96); border-top: 1px solid var(--rule-strong); backdrop-filter: blur(6px); }
.savebar .hint { flex: 1 1 260px; }
@media (max-width: 720px) { .savebar .btn { width: 100%; } }

.ban-form { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule); }
@media (max-width: 1100px) { .ban-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ban-form .btn { grid-column: 1 / -1; } }
@media (max-width: 720px) { .ban-form { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .ban-form input:nth-child(3) { grid-column: 1 / -1; } }
/* fields in a grid share label / input / hint rows, so inputs line up even when a label wraps */
.grid2 { gap: 18px 20px; }
.grid2 > .field { grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; margin-bottom: 0; }

/* equal-height cards with actions pinned to the bottom */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; align-items: stretch; }
.cards > .card { display: flex; flex-direction: column; margin: 0; }
.cards > .card .card-actions { margin-top: auto; }
.cards > .card p.hint { margin-bottom: 18px !important; }
.cols > .card, .cols > .stack, .grid2 > .card, .cards > .card { margin-top: 0 !important; }

/* ---- typography polish: larger small-text, better wrapping ---- */
p, li, dd, .hint, .sub, .muted, .callout, td, .who2 span { text-wrap: pretty; }
h1, h2, h3, .empty h2 { text-wrap: balance; }
.label, .kicker { font-size: 14px; letter-spacing: .15em; }
.chip { height: 26px; padding: 0 12px; font-size: 13px; letter-spacing: .1em; }
.chip svg { width: 14px; height: 14px; }
th { font-size: 13px; padding: 13px 14px; }
.hint, small, .small, .list .who2 span, td .sub, .metric .d, .fname .t span { font-size: 15px; line-height: 1.45; }
.field > label, .field > .label { font-size: 14px; letter-spacing: .13em; }
.btn-sm { font-size: 14px; }
.crumbs { font-size: 15px; }
.frow.head, .kv dt { font-size: 13px; }
.nav h4 { font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 14px 18px; margin: 4px 0 22px; padding: 16px 0 0; border-top: 1px solid var(--rule); }
.stats dt { font: 700 13px/1.2 var(--tivoli-font-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 6px 0 0; font-weight: 600; font-size: 17px; line-height: 1.25; color: var(--ink-strong); }
.cards > .card .bar { margin-top: auto; margin-bottom: 0; }
.cards > .card .stats { margin-top: 18px; }
.cards > .card .card-actions { margin-top: 0; }
.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats > div:first-child { grid-column: 1 / -1; }

/* ---- faded harlequin background (see bg.js) ---- */
.bg-diamonds { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-diamonds i { position: absolute; display: block; width: var(--w); aspect-ratio: 2 / 3; background: var(--c); opacity: var(--o);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); will-change: transform, opacity;
  animation: dm-drift var(--t) ease-in-out var(--dl) infinite alternate, dm-breathe var(--b) ease-in-out var(--dl) infinite alternate; }
.bg-diamonds i.twin::after { content: ''; position: absolute; inset: 24% 24%; background: #fff; opacity: .55; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
@keyframes dm-drift { from { transform: translate(0, 0); } to { transform: translate(var(--dx), calc(var(--dy) * -1)); } }
@keyframes dm-breathe { from { opacity: calc(var(--o) * .45); } to { opacity: var(--o); } }
#app { position: relative; z-index: 1; }
.login-panel, .public { background: transparent !important; }
.main { background: transparent; }
@media (max-width: 720px) { .bg-diamonds i:nth-child(even) { display: none; } }
@media (prefers-reduced-motion: reduce) { .bg-diamonds i { animation: none !important; } }
@media print { .bg-diamonds { display: none; } }

/* ---- readable chips: strong text colours on tinted backgrounds, never inherited from the surrounding row ---- */
.fname .t > span:not(.chip) { color: var(--muted); }
.fname .t span.chip { font-size: 13px; line-height: 1; }
.chip { color: var(--tivoli-gold-dark-60); background: var(--tivoli-gold-light-80); border: 1px solid var(--tivoli-gold-light-60); }
.chip.ok { color: var(--tivoli-green-dark-40); background: #E9F0EF; border-color: var(--tivoli-green-light-60); }
.chip.warn { color: var(--tivoli-gold-dark-60); background: #F3E8D2; border-color: var(--tivoli-gold-light-20); }
.chip.bad { color: var(--tivoli-red-dark-40); background: #F4E4E4; border-color: var(--tivoli-red-light-40); }
.chip.info { color: var(--tivoli-blue-dark-60); background: #E4ECF1; border-color: var(--tivoli-blue-light-40); }
.chip.dark { color: #fff; background: var(--tivoli-gold-dark-60); border-color: var(--tivoli-gold-dark-60); }
.chip svg { color: inherit; stroke: currentColor; }
.fname .t span.chip { display: inline-flex; }

.pw-rules { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.pw-rules li { position: relative; padding-left: 26px; font-size: 15px; color: var(--muted); }
.pw-rules li::before { content: ''; position: absolute; left: 2px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--tivoli-gold-light-20); }
.pw-rules li.met { color: var(--tivoli-green-dark-40); }
.pw-rules li.met::before { background: var(--tivoli-green-dark-20); border-color: var(--tivoli-green-dark-20); box-shadow: inset 0 0 0 2px #fff; }
.ok-text { color: var(--tivoli-green-dark-40) !important; } .bad-text { color: var(--tivoli-red-dark-40) !important; }
.check.opt { padding: 14px 16px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: #fff; align-items: center; }
.check.opt:has(input:checked) { border-color: var(--gold); background: var(--tivoli-gold-light-100); }
.check.opt input { margin-top: 0; }

/* ---- form labels: sentence case in the text face, much easier to read than small condensed capitals ---- */
.field > label, .field > .label { font-family: var(--tivoli-font-body, 'Source Serif 4', Georgia, serif); font-weight: 600; font-size: 16px; line-height: 1.35; letter-spacing: 0; text-transform: none; color: var(--ink-strong); }

/* ---- side navigation: readable sentence case instead of small condensed capitals ---- */
.nav a { font-family: var(--tivoli-font-body, 'Source Serif 4', Georgia, serif); font-weight: 600; font-size: 16px; line-height: 1.25; letter-spacing: 0; text-transform: none; color: var(--tivoli-gold-light-60); }
.nav a:hover, .nav a.active { color: #fff; }
.nav .ws-link { font-size: 15px; letter-spacing: 0; }
.nav h4 { font-family: var(--tivoli-font-body, 'Source Serif 4', Georgia, serif); font-weight: 600; font-size: 13px; letter-spacing: .12em; color: var(--tivoli-gold-light-20); }

/* ---- one readable text system across the whole app ----
   The condensed label face in small capitals was hard to read everywhere. UI labels, buttons, tabs, chips, table headers,
   breadcrumbs, metric captions and chart text now use the body serif in sentence case; display headings keep the brand face. */
:root { --tivoli-font-label: var(--tivoli-font-body, 'Source Serif 4', Georgia, serif); }
h3, .label, .kicker, .btn, .chip, .sep, .avatar, .metric .v small, th, .crumbs, .frow.head, .tabs button, .tray header, .kv dt, .stats dt, .tray header * {
  text-transform: none; letter-spacing: 0; font-weight: 600; }
h3 { font-size: 17px; color: var(--ink-strong); }
.label, .kicker, th, .frow.head, .kv dt, .stats dt, .metric .label { font-size: 14px; letter-spacing: .01em; color: var(--muted); }
.btn { font-size: 16px; } .btn-sm { font-size: 15px; }
.chip { font-size: 13px; height: 26px; }
.tabs button { font-size: 16px; }
.crumbs { font-size: 16px; }
.chart text, .ring .sm { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.side .brand .app { font-family: var(--tivoli-font-body, 'Source Serif 4', Georgia, serif); text-transform: none; letter-spacing: .02em; font-size: 14px; font-weight: 600; }
.nav h4 { text-transform: uppercase; }
.savebar .btn { min-width: 160px; justify-content: center; }
.field[hidden] { display: none !important; }

/* ---------- selecting several files ---------- */
.frow.has-sel { grid-template-columns: 26px minmax(0, 1fr) 150px 150px 96px 130px 44px; }
.c-by { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow.head .c-by { overflow: visible; }
.dropbox svg { width: 44px; height: 44px; color: var(--tivoli-gold-dark-40); margin-bottom: 8px; }
.dropbox h2 { margin: 0 0 6px; }
.dropbox p { margin: 0; color: var(--muted); }
.selcell { display: flex; align-items: center; justify-content: center; }
.selcell input { width: 18px; height: 18px; margin: 0; accent-color: var(--tivoli-gold-dark-40); cursor: pointer; }
.frow.is-sel:not(.head) { background: var(--tivoli-gold-light-100); }
.selbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--gold); border-radius: 8px; position: sticky; top: 8px; z-index: 5; box-shadow: 0 6px 20px rgba(75,64,44,.12); }
.selbar b { margin-right: 6px; }
.selbar .spacer { flex: 1; }
@media (max-width: 1180px) { .frow.has-sel { grid-template-columns: 26px minmax(0, 1fr) 130px 84px 44px; } .frow .c-by { display: none; } }
@media (max-width: 720px) { .frow.has-sel { grid-template-columns: 26px minmax(0, 1fr) 40px; } .frow.head.has-sel { display: none; } }

/* ---------- help site ---------- */
.help { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-side { position: sticky; top: 16px; display: grid; gap: 10px; max-height: calc(100vh - 32px); overflow: auto; }
.help-nav h4 { margin: 14px 0 6px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.help-nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.help-nav a:hover { background: var(--tivoli-gold-light-100); }
.help-nav a.active { background: var(--tivoli-gold-light-80); font-weight: 700; }
.help-body { padding: 28px 32px; max-width: 820px; line-height: 1.6; }
.help-body h2 { margin: 4px 0 14px; }
.help-body h3 { margin: 22px 0 8px; }
.help-body p, .help-body ul, .help-body ol { margin: 0 0 12px; }
.help-body li { margin-bottom: 4px; }
.help-body code { background: var(--tivoli-gold-light-100); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
@media (max-width: 900px) { .help { grid-template-columns: minmax(0, 1fr); } .help-side { position: static; max-height: none; } .help-body { padding: 20px 18px; } }

/* ---------- automation rule form ---------- */
.tpl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rule-step { margin: 18px 0; padding: 14px 16px; background: var(--tivoli-gold-light-100); border: 1px solid var(--rule); border-radius: 8px; }
.rule-step > .kicker { display: block; margin-bottom: 8px; }
.rule-more { margin-top: 10px; }
.rule-more summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.rule-more .grid2 { margin-top: 10px; }
.rule-act { display: grid; grid-template-columns: 190px minmax(0, 1fr) 40px; gap: 10px; align-items: start; margin-bottom: 10px; }
.rule-act .row { flex-wrap: wrap; }
.rule-act .row > * { flex: 1 1 200px; }
@media (max-width: 720px) { .rule-act { grid-template-columns: minmax(0, 1fr) 40px; } .rule-act-type { grid-column: 1 / -1; } }
