/* tavlo Hub — mobile-first, Tavlo BrandKit tokens (tokens.css). Amber is a fill, never a text colour on light. */

@font-face { font-family: 'DM Sans'; src: url('/fonts/DMSans-Variable.ttf') format('truetype'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('/fonts/InstrumentSerif-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }

* { box-sizing: border-box; }
/* The hidden attribute must win over any display rule (.tabs, .grid2 … set display themselves). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
a { color: var(--text); }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; margin: 0 0 var(--space-3); }
h1 { font-size: 2rem; line-height: 1.1; }
h2 { font-size: 1.45rem; margin-top: var(--space-6); }
h3 { font-size: 1rem; margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
.muted { color: var(--text-2); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  min-height: calc(56px + env(safe-area-inset-top)); /* fixed, so the desktop tab bar can stick right below it */
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-3); background: var(--bg-glass-solid);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; }
.logo { height: 22px; width: auto; display: block; }
.brand-hub { font-weight: 600; color: var(--text-2); font-size: 0.95rem; }
.bell {
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none; background: var(--accent); color: var(--pal-warm-900);
  border-radius: var(--radius-full); padding: 3px 10px 3px 8px; font-weight: 700; font-size: 0.85rem; min-height: 30px;
}
.bell svg { width: 16px; height: 16px; }

.main { max-width: 760px; margin: 0 auto; padding: var(--space-4); }
.narrow { max-width: 460px; margin: var(--space-12) auto; padding: var(--space-4); }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--bg-elevated); border-top: 1px solid var(--border-hover); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; text-decoration: none;
  color: var(--text-2); font-size: 0.7rem; padding: 6px 0 8px; font-weight: 500; min-width: 0; white-space: nowrap;
}
.tabs a .tab-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 28px; border-radius: var(--radius-full); }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.active { color: var(--text); font-weight: 700; }
.tabs a.active .tab-icon { background: var(--accent-bg); }
@media (max-width: 350px) { .tabs a { font-size: 0.62rem; } .tabs a .tab-icon { width: 36px; } }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs {
    position: sticky; top: 56px; border-top: 0; border-bottom: 1px solid var(--border-hover); max-width: 760px; margin: 0 auto;
    background: var(--bg); padding: 0 var(--space-4);
  }
  .tabs a { flex-direction: row; justify-content: center; gap: 6px; font-size: 0.88rem; padding: 10px 2px; }
  .tabs a .tab-icon { width: auto; height: auto; background: transparent !important; }
  .tabs a svg { width: 18px; height: 18px; }
  .tabs a.active { box-shadow: inset 0 -2px 0 var(--accent); }
}

.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-2xl); box-shadow: var(--shadow-sm); padding: var(--space-4); margin-bottom: var(--space-3); }
.card.draft { border: 1px solid var(--pal-amber-soft); }
.card.warn { background: var(--accent-bg); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: var(--space-2); }
.kv { display: grid; grid-template-columns: 9.5rem 1fr; gap: 4px var(--space-3); margin: var(--space-2) 0; font-size: 0.95rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 6.2rem 1fr; gap: 3px var(--space-2); } }
.big { font-size: 1.6rem; font-weight: 700; }

.badge { display: inline-block; border-radius: var(--radius-full); padding: 1px 9px; font-size: 0.75rem; font-weight: 600; background: var(--pal-warm-100); color: var(--text); }
.badge.open { background: var(--accent-bg); }
.badge.reimbursed { background: #E3F1EC; }
.badge.void { background: var(--pal-warm-200); text-decoration: line-through; }
.badge.flag { background: #F6E4DF; }
.badge.soon { background: var(--accent); color: var(--pal-warm-900); }

button, .button {
  font: inherit; font-weight: 600; border-radius: var(--radius-md); border: 1px solid var(--border-hover); background: var(--bg-elevated);
  color: var(--text); padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; min-height: 42px;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--pal-warm-900); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.danger { color: #8C2F1F; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.small { padding: 4px 10px; min-height: 32px; font-size: 0.85rem; }

label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.field { margin-bottom: var(--space-3); }
.field .hint { font-size: 0.8rem; color: var(--text-2); margin-top: 3px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--pal-warm-300);
  background: var(--pal-white); color: var(--text);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--pal-warm-900); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.checkbox { display: flex; gap: var(--space-2); align-items: center; font-weight: 500; color: var(--text); }
.checkbox input { width: auto; }
.errors { color: #8C2F1F; font-size: 0.9rem; margin: var(--space-2) 0; padding-left: 1.1rem; }
.error-text { color: #8C2F1F; }

dialog.popup {
  border: 0; border-radius: var(--radius-2xl); padding: var(--space-4); width: calc(100% - 32px); max-width: 520px;
  background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.popup::backdrop { background: rgba(20, 16, 10, 0.45); }
dialog.popup h2 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; font-size: 0.8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.list-item { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }

.chat { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.msg { max-width: 88%; padding: 10px 14px; border-radius: var(--radius-xl); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--pal-warm-900); color: var(--pal-white); }
.msg.assistant { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); }
.composer { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); background: var(--bg); padding: var(--space-2) 0; }
.composer textarea { min-height: 52px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--pal-warm-900); color: var(--pal-white); padding: 10px 16px; border-radius: var(--radius-lg); max-width: 92vw;
  box-shadow: var(--shadow-lg);
}
.toast.error { background: #8C2F1F; }
.option-buttons { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0; }
.reason { margin-top: var(--space-2); }
.row.spread select.inline, select.inline { width: auto; min-width: 6.5rem; }
.inline-confirm, .inline-ask {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); background: var(--bg-alt); border: 1px solid var(--border-hover); margin-top: var(--space-2);
}
.inline-ask { flex-direction: column; align-items: stretch; }
.inline-ask label { margin: 0; }
button.danger-fill { background: #8C2F1F; border-color: #8C2F1F; color: var(--pal-white); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-full); background: var(--pal-warm-100); margin-bottom: var(--space-3); }
.segmented a {
  text-decoration: none; padding: 6px 16px; border-radius: var(--radius-full); font-weight: 600; font-size: 0.9rem; color: var(--text-2);
  min-height: 34px; display: inline-flex; align-items: center;
}
.segmented a.active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.chips { display: flex; gap: var(--space-2); overflow-x: auto; padding: 2px 0 var(--space-2); margin-bottom: var(--space-2); scrollbar-width: none; }
.chips button { white-space: nowrap; border-radius: var(--radius-full); min-height: 34px; padding: 4px 14px; font-size: 0.85rem; }
.chips button.active { background: var(--pal-warm-900); border-color: var(--pal-warm-900); color: var(--pal-white); }
.amount-out { font-variant-numeric: tabular-nums; }
.amount-in { font-variant-numeric: tabular-nums; color: #2E6B57; }
.badge.ok { background: #E3F1EC; }
.badge.info { background: #E6EEF8; }
.booking { cursor: pointer; }
.booking-detail { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px dashed var(--border-hover); }
.suggestion { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; }
.suggestion button { flex-shrink: 0; white-space: nowrap; }
.tick-list label.checkbox { padding: 6px 0; }
.total-line { font-weight: 700; font-variant-numeric: tabular-nums; }
.divider { border: 0; border-top: 1px solid var(--border); margin: var(--space-4) 0; }
img.preview { max-width: 100%; border-radius: var(--radius-md); margin-top: var(--space-2); }

/* Bank (v0.3) */
.booking-head {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: 100%; text-align: left; background: transparent; border: 0;
  padding: 0; min-height: 0; border-radius: var(--radius-sm); font-weight: 400; cursor: pointer;
}
@media (hover: hover) { .booking-head:hover strong:first-child { text-decoration: underline; } }
.booking-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-box { margin-top: var(--space-2); }
.import-box summary { cursor: pointer; font-weight: 600; padding: var(--space-2) 0; min-height: 36px; }
.import-box[open] summary { margin-bottom: var(--space-2); }
ul.plain { list-style: none; padding: 0; margin: var(--space-1) 0 var(--space-2); }
ul.plain li { padding: 3px 0; display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
