/* Same look as the DEMO accounts app: white, DEMO blue #285181, dark-gray strip, underline tabs, collapsible cards, bottom nav bar */
:root {
  --bg: #ffffff; --card: #ffffff; --soft: #f5f7fa; --tx: #1f2937; --mu: #6b7280; --bd: #d9e0ea; --bd2: #b9c7da;
  --ac: #285181; --gray: #333333; --ok: #15803d; --bad: #b91c1c; --wa: #b45309; --hl: #e4ebf5; --on-ac: #ffffff;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0 auto; max-width: 640px; background: var(--bg); color: var(--tx);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; font-size: 15px; line-height: 1.45;
  padding: 0 12px 90px; overflow-x: hidden;
}
[hidden] { display: none !important; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.mu { color: var(--mu); font-size: 13px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .wa { color: var(--wa); }
h1 { font-size: 20px; margin: 0 0 4px; line-height: 1.3; }
h2 { font-size: 15px; margin: 16px 0 8px; }

/* header — same as accounts app */
.hd { position: relative; display: flex; align-items: center; gap: 10px; margin: 0 -12px; padding: 20px 14px 8px; background: #fff; border-bottom: 2px solid var(--ac); }
.hd::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: var(--gray); }
.hd img { height: 36px; display: block; }
.hd small { font-size: 12.5px; color: var(--mu); font-weight: 600; border-inline-start: 1px solid var(--bd); padding-inline-start: 10px; }
.hd .sb { margin-inline-start: auto; font-size: 11.5px; font-weight: 700; color: var(--bad); background: #fdecec; border-radius: 99px; padding: 3px 10px; }
.ft { text-align: center; color: var(--ac); font-size: 11px; letter-spacing: 3px; margin-top: 18px; direction: ltr; }
.fd { height: 34px; margin: 18px -12px -90px; border-bottom: 8px solid var(--gray); position: relative; }
.fd::before { content: ""; position: absolute; right: 0; bottom: 0; width: 42%; height: 26px; background: var(--ac); clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%); }

/* tabs — underline, sticky */
.tabs { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; margin: 0 -12px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--bd); box-shadow: 0 2px 6px rgba(20, 40, 70, .05); }
.tabs button { flex: 1; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 12px 2px 9px; color: var(--mu); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tabs button.on { color: var(--ac); border-bottom-color: var(--ac); }
.tabs .cnt { font-size: 11px; background: var(--soft); border-radius: 99px; padding: 1px 6px; margin-inline-start: 3px; }
#app { padding-top: 10px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--bd); border-radius: 14px; padding: 13px 14px; margin: 0 0 10px; box-shadow: 0 1px 3px rgba(20, 40, 70, .06); }
.card.open, details.card[open] { border-color: var(--bd2); }
.card.new { border: 2px solid var(--ac); }
.top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.tap { cursor: pointer; } .tap:active { opacity: .7; }
details.card > summary { list-style: none; cursor: pointer; min-height: 30px; display: block; }
details.card > summary::-webkit-details-marker { display: none; }
.chev { display: inline-block; color: var(--mu); transition: transform .15s; }
details[open] > summary .chev, .open .chev { transform: rotate(180deg); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--bd); white-space: nowrap; }
.tag.ok { border-color: #bfe3cb; background: #effaf2; } .tag.wa { border-color: #f1d6b0; background: #fff7ec; } .tag.bad { border-color: #f3c6c6; background: #fdf1f1; }
.bar { height: 6px; background: var(--bd); border-radius: 9px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .15s; }
.box { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.box.bad { background: #fdf1f1; color: var(--bad); } .box.ok { background: #effaf2; color: var(--ok); font-weight: 600; } .box.wa { background: #fff7ec; color: var(--wa); }
.sep { border: 0; border-top: 1px solid var(--bd); margin: 12px 0; }

/* forms & buttons */
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; padding: 10px; border: 1px solid var(--bd); border-radius: 10px; background: #fff; color: var(--tx); font: inherit; margin: 4px 0; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--ac); outline-offset: 1px; }
input[type=date] { -webkit-appearance: none; appearance: none; display: block; height: 42px; direction: ltr; text-align: center; }
label.lb { display: block; font-size: 13px; color: var(--mu); margin-top: 6px; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; min-width: 0; }
@media (max-width: 420px) { .row.wrap { flex-direction: column; gap: 0; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 14px; border: 0; border-radius: 10px; background: var(--ac); color: var(--on-ac); font: inherit; font-weight: 600; width: 100%; margin-top: 6px; cursor: pointer; text-decoration: none; box-shadow: 0 1px 2px rgba(20, 40, 70, .15); }
.btn.sm { padding: 7px 10px; font-size: 13px; width: auto; margin: 0; }
.btn.ghost { background: #fff; color: var(--tx); border: 1px solid var(--bd); box-shadow: none; }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #f3c6c6; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.chip { padding: 7px 13px; border: 1px solid var(--bd); background: var(--soft); color: var(--tx); border-radius: 99px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ac); color: var(--on-ac); border-color: var(--ac); }
.search { margin: 0 0 10px; }
.empty { text-align: center; color: var(--mu); padding: 30px 10px; }

/* files */
.drop { border: 2px dashed var(--bd); border-radius: 12px; padding: 14px; text-align: center; color: var(--mu); cursor: pointer; font-size: 14px; background: var(--soft); display: block; }
.drop.over { border-color: var(--ac); background: var(--hl); }
.flist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.flist li { display: flex; gap: 8px; align-items: center; border: 1px solid var(--bd); border-radius: 10px; padding: 8px 10px; font-size: 14px; background: #fff; }
.flist .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.linkrow { display: flex; gap: 8px; align-items: center; background: var(--soft); border-radius: 10px; padding: 6px 6px 6px 10px; }
.linkrow span { flex: 1; min-width: 0; direction: ltr; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* confirm strip (instead of browser popups) */
.confirm { border: 1px solid #f3c6c6; background: #fdf1f1; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }

/* bottom nav bar — same as accounts app */
.navbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 15; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 640px; margin: 0 auto; padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); background: #fff; border-top: 1px solid var(--bd); box-shadow: 0 -2px 8px rgba(20, 40, 70, .06); }
.navbar button { width: 100%; padding: 9px 4px; display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; border-radius: 14px; font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1; min-height: 38px; background: var(--ac); color: var(--on-ac); border: 1px solid var(--ac); cursor: pointer; }
.navbar button.off { opacity: .35; pointer-events: none; }
.toast { position: fixed; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--tx); color: #fff; padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 20; opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.toast.on { opacity: 1; }

/* client page */
body.client { padding-bottom: 20px; }
body.client .fd { margin-bottom: -20px; }
.player { display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 12px; padding: 10px 12px; margin: 12px 0; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ac); color: var(--on-ac); display: grid; place-items: center; cursor: pointer; flex: none; }
.amount { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--bd); padding-top: 12px; margin-top: 4px; }
.amount b { font-size: 26px; }
.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--bd); border-radius: 12px; padding: 10px 12px; }
.files .fn { font-weight: 600; direction: ltr; text-align: right; overflow-wrap: anywhere; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--bd); border-top-color: var(--ac); margin: 20px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* long press — same as the accounts app */
[data-lp] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
[data-lp] input, [data-lp] textarea, [data-lp] .linkrow span { -webkit-user-select: text; user-select: text; }
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; }
.sheet-in { width: 100%; max-width: 640px; margin: 0 auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 14px max(14px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); display: grid; gap: 8px; }
.sheet-in .btn { margin: 0; }
.sheet-t { text-align: center; font-weight: 700; margin-bottom: 2px; overflow-wrap: anywhere; }
.btn.ghost.bad { color: var(--bad); border-color: #f3c6c6; }
.lp-hint { text-align: center; color: var(--mu); font-size: 12px; margin: -4px 0 8px; }

/* ================= website layout (computer first, still works on phone) ================= */
:root { --maxw: 1180px; --gut: max(16px, env(safe-area-inset-left, 0px)); }
body { max-width: none; padding: 0 0 24px; }
body.client { --maxw: 760px; }
.hd, .topbar, #app, .ft { padding-left: max(var(--gut), calc((100% - var(--maxw)) / 2)); padding-right: max(var(--gut), calc((100% - var(--maxw)) / 2)); }
.hd { margin: 0; display: block; padding-top: 22px; padding-bottom: 10px; }
.hd .in { display: flex; align-items: center; gap: 12px; }
.hd img { height: 42px; }
.hd small { font-size: 14px; }
.hd .site { margin-inline-start: auto; color: var(--ac); font-size: 13px; font-weight: 600; text-decoration: none; }
.hd .sb + .site { margin-inline-start: 10px; }
.fd { margin: 18px 0 -24px; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; background: #fff; border-bottom: 1px solid var(--bd); box-shadow: 0 2px 6px rgba(20, 40, 70, .05); }
.topbar .in { display: flex; align-items: center; gap: 16px; }
.topbar .tabs { position: static; flex: 1; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
.topbar .tabs button { flex: 0 1 auto; padding: 14px 18px 11px; font-size: 15px; }
.topbar .navbar { position: static; display: flex; gap: 6px; max-width: none; margin: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.topbar .navbar button { width: auto; padding: 8px 14px; min-height: 34px; border-radius: 10px; font-size: 13px; }

#app { padding-top: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.toolbar .search { flex: 1; margin: 0; max-width: 520px; }
.toolbar .btn { width: auto; margin: 0; padding: 11px 22px; }
.lp-hint { text-align: start; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.grid .card { margin: 0; }
.grid .card.open { grid-column: 1 / -1; }
.card:not(.open):hover { border-color: var(--bd2); box-shadow: 0 3px 10px rgba(20, 40, 70, .08); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.col { min-width: 0; }
.card.new { margin-bottom: 14px; }
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 14px; margin-bottom: 8px; }
.fgrid > div { min-width: 0; }
.sheet { align-items: center; }
.sheet-in { max-width: 380px; border-radius: 16px; padding: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
body:not(.client) .toast { bottom: 24px; }

/* tablet */
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; gap: 0; }
  .cols .col + .col { border-top: 1px solid var(--bd); margin-top: 12px; padding-top: 12px; }
  .fgrid { grid-template-columns: 1fr 1fr; }
}
/* phone: tabs full width, the 4 buttons go back to the bottom bar */
@media (max-width: 640px) {
  :root { --gut: max(12px, env(safe-area-inset-left, 0px)); }
  body:not(.client) { padding-bottom: 90px; }
  .fd { margin-bottom: -90px; }
  body.client .fd { margin-bottom: -24px; }
  .hd img { height: 36px; } .hd .site { display: none; }
  .topbar .in { display: block; }
  .topbar .tabs { display: flex; }
  .topbar .tabs button { flex: 1; padding: 12px 2px 9px; font-size: 14px; }
  .topbar .navbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 15; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    background: #fff; border-top: 1px solid var(--bd); box-shadow: 0 -2px 8px rgba(20, 40, 70, .06); }
  .topbar .navbar button { width: 100%; border-radius: 14px; min-height: 38px; }
  body:not(.client) .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .toolbar { flex-direction: column-reverse; align-items: stretch; }
  .toolbar .search { max-width: none; }
  .toolbar .btn { width: 100%; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .fgrid { grid-template-columns: 1fr; }
  .sheet { align-items: flex-end; }
  .sheet-in { max-width: 640px; border-radius: 18px 18px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

.hd .lang { margin-inline-start: auto; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ac); background: #eef2f8; border: 0; border-radius: 99px; padding: 5px 12px; cursor: pointer; }
.hd .lang + .site { margin-inline-start: 12px; }
@media (max-width: 640px) { .hd .lang { margin-inline-start: auto; } }

/* alerts */
.alerts { border-color: var(--bd2); margin-bottom: 14px; }
.alerts .badge-n { background: var(--bad); color: #fff; border-radius: 99px; font-size: 12px; padding: 1px 8px; margin-inline-start: 6px; }
.alist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.al { display: flex; align-items: center; gap: 10px; border: 1px solid var(--bd); border-radius: 12px; padding: 9px 12px; background: #fff; flex-wrap: wrap; }
.al .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 14px; }
.al.ok .ic { background: #effaf2; color: var(--ok); } .al.wa .ic { background: #fff7ec; } .al.bad .ic { background: #fdf1f1; }
.al .tx { flex: 1; min-width: 180px; }
@media (min-width: 900px) { .alist { grid-template-columns: 1fr 1fr; } }

/* never let the page slide sideways on phones */
html, body { overflow-x: clip; }

/* cover the strip above the sticky top bar (phone notch / app frame) */
body:not(.client)::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: #fff; }

/* bell in the header corner */
.hd .bell { position: relative; margin-inline-start: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--bd); background: #fff; color: var(--ac); display: grid; place-items: center; cursor: pointer; flex: none; }
.hd .bell.on { background: var(--ac); color: #fff; border-color: var(--ac); }
.hd .bell-n { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
@media (max-width: 640px) { .hd .bell { margin-inline-start: auto; } .hd .sb + .bell, .hd .sb ~ .bell { margin-inline-start: 10px; } }
.alerts-page h1 .badge-n { font-size: 13px; vertical-align: middle; }

/* client page: bigger company logo */
body.client .hd img { height: 52px; }
@media (max-width: 640px) { body.client .hd img { height: 46px; } }

/* play buttons + mini player (client page) */
.pbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--bd); background: #fff; color: var(--ac); font-size: 13px; cursor: pointer; flex: none; display: grid; place-items: center; }
.pbtn.on { background: var(--ac); color: #fff; border-color: var(--ac); }
.files li { gap: 10px; }
.mplayer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto;
  padding: 10px max(14px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  background: #fff; border-top: 1px solid var(--bd); box-shadow: 0 -4px 14px rgba(20, 40, 70, .08); }
.mplayer .mp-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.mplayer .mp-x { border: 0; background: none; color: var(--mu); font-size: 18px; cursor: pointer; padding: 6px; }
body.client.has-player { padding-bottom: 96px; }
[dir=rtl] .files .fn, [dir=rtl] .mplayer .mp-name { text-align: right; }
[dir=ltr] .files .fn, [dir=ltr] .mplayer .mp-name { text-align: left; }
