/* Nourison FileShare — responsive (phone / tablet / desktop) */
:root {
  --navy: #1b2a41; --navy-2: #243652; --navy-3: #31476b;
  --gold: #b8955a; --gold-2: #d8bd8a;
  --bg: #f4f5f7; --panel: #ffffff; --line: #e3e6eb; --line-2: #eef0f3;
  --text: #1d2433; --muted: #667085; --faint: #98a2b3;
  --blue: #2f6fde; --green: #18794e; --green-bg: #e7f6ee; --red: #c0362c; --red-bg: #fdecea;
  --amber: #a15c07; --amber-bg: #fff4e0; --info-bg: #eaf1fd;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --sidebar-w: 248px; --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--navy); color: #cfd6e3;
  display: flex; flex-direction: column; z-index: 40; transition: transform .22s ease; padding-bottom: env(safe-area-inset-bottom); }
.brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px; }
.brand-link { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: #fff; text-decoration: none !important; }
.brand-logo { display: block; width: 132px; height: auto; }
.brand-sub { color: var(--gold-2); font-size: 11px; font-weight: 600; letter-spacing: 2.2px; text-transform: uppercase; padding-left: 4px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--gold);
  color: var(--navy); font-weight: 800; font-size: 18px; font-family: Georgia, serif; }
.brand-mark.lg { width: 46px; height: 46px; font-size: 24px; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; font-weight: 700; letter-spacing: .3px; line-height: 1.1; }
.brand-text small { color: var(--gold-2); font-weight: 500; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px; margin: 2px 0; border-radius: 8px;
  color: #cfd6e3; text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: var(--navy-3); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav .pill { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 99px; font-size: 12px; padding: 1px 8px; }
.nav-group { margin: 16px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: #8796ad; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--navy-2); }
.sidebar-foot form { margin: 0; }
.me { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none !important; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.me-text b, .me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: #8796ad; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy-3);
  color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.sidebar .icon-btn { color: #cfd6e3; }
.sidebar .icon-btn:hover { background: var(--navy-2); color: #fff; }
.sidebar-close { display: none; }
.scrim { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.topsearch { display: flex; align-items: center; gap: 8px; width: min(360px, 40vw); height: 38px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 99px; background: var(--bg); color: var(--muted); }
.topbar .topsearch input, .topbar .topsearch input:focus { border: 0; background: transparent; outline: 0; flex: 1; font: inherit; min-width: 0; min-height: 0; padding: 0; }
.menu-btn, .search-mobile { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.banner { display: flex; gap: 8px; align-items: center; padding: 10px 24px; font-size: 14px; }
.banner-warn { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid #f3dfb8; }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card, .card + .grid, .grid + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid > .card { margin-top: 0 !important; }
a.card { color: inherit; text-decoration: none !important; }
a.card:hover { border-color: #c9ced8; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat a { color: inherit; }
.meter { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--navy-3); border-radius: 99px; }
.meter.warn i { background: var(--amber); } .meter.full i { background: var(--red); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 600 14px var(--font); cursor: pointer;
  text-decoration: none !important; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-danger { color: var(--red); border-color: #f1c8c4; }
.btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 8px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
form.inline { display: inline; margin: 0; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: 13.5px; }
.field .req { color: var(--red); font-style: normal; }
.field small { font-size: 12.5px; }
.field small.error { color: var(--red); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=search], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #cfd4dc; border-radius: var(--radius-sm); background: #fff;
  font: 16px var(--font); /* 16px stops iOS zoom-on-focus */ color: var(--text); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 700; margin-bottom: 10px; padding: 0; font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

.flashes { margin-bottom: 16px; }
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: var(--green-bg); color: var(--green); border-color: #bfe6d1; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: #f5c6c1; }
.flash-info, .flash-message { background: var(--info-bg); color: #1d4fa8; border-color: #cfdcf7; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge-approved, .badge-low, .badge-clean, .badge-done, .badge-ok { background: var(--green-bg); color: var(--green); }
.badge-pending_review, .badge-medium, .badge-queued, .badge-running, .badge-pending_email { background: var(--amber-bg); color: var(--amber); }
.badge-rejected, .badge-disabled, .badge-high, .badge-infected, .badge-failed, .badge-fail { background: var(--red-bg); color: var(--red); }
.badge-superadmin, .badge-admin { background: #efe7d8; color: #7a5a24; }
.badge-staff { background: var(--info-bg); color: #1d4fa8; }
.badge-vendor { background: #e8f3f1; color: #1f6f63; }
.badge-partner { background: #efeaf8; color: #5b3aa8; }
.badge-external { background: var(--line-2); color: var(--muted); }

/* tables -> cards on small screens */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.empty .icon { width: 36px; height: 36px; color: var(--faint); display: block; margin: 0 auto 8px; }

/* drives (Azure storages) */
.drives { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.drive { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none !important; }
.drive:hover { border-color: #c9ced8; }
.drive.active { border-color: var(--blue); color: var(--blue); background: var(--info-bg); }
.dropzone-list { border: 2px dashed transparent; padding: 0; background: none; border-radius: var(--radius); text-align: left; }
.dropzone-list.over { border-color: var(--blue); background: var(--info-bg); }
.dropzone-list .upload-list, .dropzone-list .progress { margin: 0 0 10px; }
tr.drop-target td { background: var(--info-bg) !important; }
.stats-counts { display: block; font-size: 12px; font-weight: 400; }
.fname > span { min-width: 0; }
.view-grid { grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 1023px) { .view-grid { grid-template-columns: 1fr; } }

/* file explorer */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; margin-bottom: 12px; }
.crumbs a, .crumbs span { padding: 4px 6px; border-radius: 6px; }
.crumbs .sep { color: var(--faint); padding: 0; }
.fname { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.fname b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: #eef1f6; color: #51607a;
  font-size: 10px; font-weight: 800; letter-spacing: .3px; flex: none; }
.ficon .icon { width: 20px; height: 20px; }
.ficon-dir { background: #fdf3e1; color: #b07a1d; } .ficon-pdf { background: #fde8e6; color: #c0362c; }
.ficon-img { background: #e9f4ec; color: #2a7d4f; } .ficon-xls { background: #e6f4ea; color: #1e7145; }
.ficon-doc { background: #e8effc; color: #2b579a; } .ficon-ppt { background: #fdeee6; color: #c4502a; } .ficon-zip { background: #efeaf8; color: #6941c6; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; } .tag { font-size: 11.5px; background: var(--line-2); padding: 1px 7px; border-radius: 99px; color: var(--muted); }
.dropzone { border: 2px dashed #cfd4dc; border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); background: #fbfcfd; margin-bottom: 14px; transition: .15s; }
.dropzone.over { border-color: var(--blue); background: var(--info-bg); color: var(--blue); }
.dropzone .icon { width: 28px; height: 28px; display: block; margin: 0 auto 6px; }
.upload-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; font-size: 13px; }
.upload-list li { display: flex; gap: 8px; justify-content: space-between; padding: 4px 0; }
.progress { height: 4px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }

.menu { position: relative; display: inline-block; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(16,24,40,.16); padding: 6px; z-index: 30; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; background: none;
  border-radius: 7px; color: var(--text); font: 14px var(--font); cursor: pointer; text-align: left; text-decoration: none !important; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-pop .danger { color: var(--red); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(16,24,40,.3); }
dialog::backdrop { background: rgba(16,24,40,.45); }
dialog form.dlg { padding: 20px; margin: 0; }
dialog.confirm-dlg { width: min(440px, calc(100vw - 24px)); }
.confirm-body { display: grid; grid-template-columns: 44px 1fr; gap: 4px 16px; padding: 22px !important; }
.confirm-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-icon.danger { background: var(--red-bg); color: var(--red); }
.confirm-icon.info { background: var(--info-bg); color: var(--blue); }
.confirm-text h2 { margin: 2px 0 6px; font-size: 1.1rem; }
.confirm-msg { margin: 0; color: var(--muted); word-break: break-word; }
.confirm-msg b { color: var(--text); }
.confirm-body .dlg-actions { grid-column: 1 / -1; margin-top: 16px; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #a42d24; }
@media (max-width: 720px) { .confirm-body { grid-template-columns: 1fr; } .confirm-body .dlg-actions .btn { flex: 1; } }
dialog .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

.viewer { position: relative; background: #f0f2f5; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 60vh; display: grid; place-items: center; }
.viewer iframe { width: 100%; height: 78vh; border: 0; background: #fff; }
.viewer img, .viewer video { max-width: 100%; max-height: 78vh; display: block; }
.viewer pre { margin: 0; width: 100%; max-height: 78vh; overflow: auto; padding: 16px; background: #fff; font-size: 13px; white-space: pre-wrap; word-break: break-word; place-self: stretch; }
.watermark { position: absolute; inset: 0; pointer-events: none; display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around;
  overflow: hidden; opacity: .13; font-weight: 700; font-size: 18px; color: var(--navy); }
.watermark span { transform: rotate(-30deg); padding: 40px; white-space: nowrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.flag-list { list-style: none; padding: 0; margin: 0; }
.flag-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font: 600 16px ui-monospace, Menlo, monospace; background: var(--bg); padding: 16px; border-radius: var(--radius-sm); text-align: center; }

/* settings */
.settings-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-nav { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; position: sticky; top: 76px; }
.settings-nav a { display: grid; grid-template-columns: 20px 1fr; gap: 4px 10px; align-items: center; padding: 10px; border-radius: 8px; color: var(--text); text-decoration: none !important; }
.settings-nav a .badge { grid-column: 2; justify-self: start; font-size: 11px; }
.settings-nav a:hover { background: var(--bg); }
.settings-nav a.active { background: var(--info-bg); color: var(--navy); font-weight: 600; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; -webkit-overflow-scrolling: touch; }
  .settings-nav a { flex: none; grid-template-columns: 18px auto; }
}

/* mail */
.mail-list a.msg { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px; border-bottom: 1px solid var(--line-2); color: var(--text); text-decoration: none; }
.mail-list a.msg:hover { background: #fafbfc; }
.mail-list a.msg.unread b { font-weight: 800; } .mail-list a.msg.unread::before { content: ""; }
.mail-list .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list .subj { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.mail-list time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--navy); border-color: var(--gold); }
.mail-body { width: 100%; min-height: 50vh; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.filepick { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; }
.filepick label { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; word-break: break-all; }

/* calendar */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 12px; color: var(--muted); text-transform: uppercase; padding: 6px; }
.cal td { border: 1px solid var(--line-2); vertical-align: top; height: 112px; padding: 4px; }
.cal td.other { background: #fafbfc; color: var(--faint); }
.cal td.today .daynum { background: var(--navy); color: #fff; }
.daynum { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.ev { display: block; font-size: 12px; background: var(--info-bg); color: #1d4fa8; border-radius: 5px; padding: 2px 6px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
.ev.outlook { background: #e5f0fa; color: #0f5ea8; }
.agenda { display: none; }

/* scan */
.scan-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin: 12px 0; }
.scan-page { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; aspect-ratio: 3/4; }
.scan-page img { width: 100%; height: 100%; object-fit: cover; }
.scan-page .n { position: absolute; left: 6px; top: 6px; background: var(--navy); color: #fff; font-size: 12px; border-radius: 99px; padding: 0 8px; }
.scan-page .rm { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border-radius: 99px; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.scan-page .mv { position: absolute; bottom: 4px; left: 4px; right: 4px; display: flex; justify-content: space-between; }
.scan-page .mv button { width: 32px; height: 32px; border-radius: 99px; border: 0; background: rgba(255,255,255,.9); cursor: pointer; }
.capture-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capture-btns label.btn { min-height: 64px; flex-direction: column; gap: 4px; }
.capture-btns input { display: none; }

/* password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 42px; height: 38px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; }
.pw-toggle:hover { color: var(--text); background: var(--bg); }
.pw-toggle:focus-visible { outline: 2px solid var(--blue); }
#username-status.ok { color: var(--green); font-weight: 600; }
#username-status.checking { color: var(--muted); }
.visitor { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2);
  font-size: 13.5px; color: var(--muted); }
.visitor b { color: var(--text); font-weight: 600; }
.visitor small { flex-basis: 100%; font-size: 12px; }
.visitor .icon { width: 15px; height: 15px; }

/* auth pages */
body.auth { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #2c4266 0, transparent 60%), linear-gradient(160deg, var(--navy) 0, #0f1a2b 100%);
  display: flex; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 16px 24px; }
.auth-wrap { width: 100%; max-width: 440px; margin: auto 0; display: flex; flex-direction: column; align-items: stretch; }
/* standard auth pages: card is exactly as wide as the tagline above it (wider pages keep their own width) */
.auth-wrap:not(.wide):not(.xwide) { width: max-content; min-width: 440px; max-width: 100%; }
@media (max-width: 640px) { .auth-wrap:not(.wide):not(.xwide) { width: 100%; min-width: 0; } }

.auth-wrap.wide { max-width: 760px; }
.auth-wrap.xwide { max-width: 1240px; }
.reg-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 36px; }
.reg-col + .reg-col { border-left: 1px solid var(--line-2); padding-left: 36px; }
.reg-finish { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line-2); }
@media (max-width: 1000px) {
  .reg-cols { grid-template-columns: 1fr; }
  .reg-col + .reg-col { border-left: 0; padding-left: 0; }
}
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 0 0 18px; }
.auth-logo { display: block; width: 210px; max-width: 60vw; height: auto; }
.auth-brand span { color: var(--gold-2); font-size: 14px; font-weight: 500; letter-spacing: .4px; line-height: 1.4; white-space: nowrap; }
@media (max-width: 640px) { .auth-brand span { white-space: normal; } }
.auth-card { padding: 28px; }
.auth-card h1 { font-size: 1.35rem; }
.auth-foot { text-align: center; color: #9fb0c8; font-size: 13px; margin-top: 16px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-top: 14px; }
.cf-turnstile { margin: 4px 0 14px; min-height: 65px; }
.otp { font: 600 26px ui-monospace, Menlo, monospace !important; letter-spacing: 10px; text-align: center; }
.qr { display: block; margin: 8px auto; width: 200px; height: 200px; image-rendering: pixelated; border-radius: 8px; }
.secret { word-break: break-all; text-align: center; background: var(--bg); padding: 8px; border-radius: 6px; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 6px; }
.error-page { text-align: center; padding: 60px 16px; } .error-page b { font-size: 3rem; color: var(--faint); display: block; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; width: min(300px, 86vw); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 35; }
  body.nav-open { overflow: hidden; }
  .sidebar-close, .menu-btn { display: inline-grid; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px 0 6px; padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
  .content { padding: 18px 16px; }
  .banner { padding: 10px 16px; }
}
/* ---------- phone ---------- */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topsearch { display: none; } .search-mobile { display: inline-grid; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 16px; border-radius: 12px; }
  .content { padding: 14px 12px calc(24px + env(safe-area-inset-bottom)); }
  .stat b { font-size: 1.4rem; }
  .btn { min-height: var(--tap); }
  .toolbar .btn span.lbl { display: none; }
  /* responsive tables become stacked cards */
  table.table.stack-sm, .table.stack-sm thead, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm thead { display: none; }
  .table.stack-sm tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .table.stack-sm td { border: 0; padding: 3px 4px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .table.stack-sm td.primary { text-align: left; } .table.stack-sm td.primary::before { display: none; }
  .table.stack-sm td.actions { justify-content: flex-end; } .table.stack-sm td.actions::before { display: none; }
  .table .hide-sm { display: none !important; }
  .viewer iframe { height: 70vh; }
  .cal { display: none; } .agenda { display: block; }
  .agenda .day { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .agenda .day b { display: block; font-size: 13px; color: var(--muted); }
  .auth-card { padding: 20px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; }
}
@media (hover: none) { .table tbody tr:hover { background: none; } }

/* print: only the document */
@media print {
  .sidebar, .topbar, .toolbar, .no-print, .banner, .flashes { display: none !important; }
  .main { margin: 0; } .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
