/* ===== Design Tokens ===== */
@font-face {
  font-family: 'Readex Pro';
  src: url('/fonts/readex-arabic.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Readex Pro';
  src: url('/fonts/readex-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Readex Pro';
  src: url('/fonts/readex-latin-ext.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Readex Pro';
  src: url('/fonts/readex-vietnamese.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  /* Brand */
  --brand: #0F1B3D;
  --brand-2: #1A2B5C;
  --brand-3: #284080;
  --gold: #C9A961;
  --gold-2: #D9BD7E;
  --gold-bg: rgba(201,169,97,0.10);

  /* Surfaces (light) */
  --paper: #FAFAF7;
  --surf: #FFFFFF;
  --surf-2: #F4F4F0;
  --surf-3: #ECECE6;

  /* Rules */
  --rule: #E5E5DF;
  --rule-2: #D0D0CA;
  --rule-3: #9A9C92;

  /* Ink */
  --ink: #15181A;
  --ink-2: #4A5054;
  --ink-3: #7C838A;

  /* Semantic */
  --grn: #1B5E4A;
  --grn-b: #E6EFEB;
  --red: #A2322A;
  --red-b: #F8EAE8;
  --amb: #8A6516;
  --amb-b: #F5EEDC;
  --ind: #33477A;
  --ind-b: #E9ECF4;

  /* Nav (sidebar) */
  --nav: #0F1B3D;
  --nav-2: #16244A;
  --nav-r: #243567;
  --nav-t: #9CABD4;
  --nav-t2: #5C6B95;
  --nav-active: #C9A961;

  /* Radius */
  --r: 6px;
  --r2: 10px;
  --r3: 14px;

  /* Shadows (subtle, no glow) */
  --sh1: 0 1px 2px rgba(15,27,61,0.04);
  --sh2: 0 2px 8px rgba(15,27,61,0.06);
  --sh3: 0 4px 16px rgba(15,27,61,0.08);

  /* Fonts */
  --fh: 'Readex Pro', system-ui, sans-serif;
  --fb: 'Readex Pro', system-ui, sans-serif;
  --fm: 'Readex Pro', ui-monospace, monospace;

  /* Spacing scale (8px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Legacy aliases */
  --surf-1: var(--surf);
  --ink-1: var(--ink);
  --green: var(--grn);
  --bg-card: var(--surf);
  --bg-soft: var(--surf-2);
  --ind-bg: var(--ind-b);
  --txt-2: var(--ink-3);
}

[data-theme="dark"] {
  --brand: #6B8FE8;
  --brand-2: #4A6FCC;
  --brand-3: #3A5AA8;
  --gold: #D9BD7E;
  --gold-2: #C9A961;
  --gold-bg: rgba(217,189,126,0.12);

  --paper: #0B0F1A;
  --surf: #131829;
  --surf-2: #1A2038;
  --surf-3: #222B48;

  --rule: #2A3258;
  --rule-2: #3A4570;
  --rule-3: #5A6494;

  --ink: #E8EAF2;
  --ink-2: #B0B8D0;
  --ink-3: #7F88A8;

  --grn: #54B996;
  --grn-b: #122E27;
  --red: #DE7168;
  --red-b: #331916;
  --amb: #CFA044;
  --amb-b: #302713;
  --ind: #8098D4;
  --ind-b: #1B2233;

  --nav: #060912;
  --nav-2: #0E1424;
  --nav-r: #1A2240;
  --nav-t: #8895BC;
  --nav-t2: #4C5878;
  --nav-active: #D9BD7E;

  --sh1: 0 1px 2px rgba(0,0,0,0.20);
  --sh2: 0 2px 8px rgba(0,0,0,0.25);
  --sh3: 0 4px 16px rgba(0,0,0,0.30);
}

/* ===== Reset ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--fb);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.2s ease, color 0.2s ease;
}
html[dir="ltr"] body { font-family: var(--fh); }
h1, h2, h3 { font-family: var(--fh); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 17px; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.f, .ltr { font-family: var(--fm); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 2px; }

/* ===== Login ===== */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--nav);
  background-image: radial-gradient(circle at 50% 30%, var(--nav-2) 0%, var(--nav) 70%);
}
.lc { width: 100%; max-width: 380px; text-align: center; }
.lm {
  width: 52px; height: 52px;
  border: 1.5px solid var(--gold);
  display: grid; place-items: center;
  margin: 0 auto 32px;
  border-radius: var(--r2);
}
.lm i { width: 16px; height: 16px; background: var(--gold); display: block; border-radius: 2px; }
.lc h1 { color: #F0F3F2; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.lc .sb {
  color: var(--nav-t2);
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-bottom: 28px;
  font-family: var(--fm);
  direction: ltr;
  text-align: center;
}
.lc input {
  width: 100%; height: 48px;
  border: none;
  border-bottom: 1px solid var(--nav-r);
  padding: 0 4px;
  background: transparent;
  color: #F0F3F2;
  margin-bottom: 18px;
  font-size: 15px;
  transition: border-color 0.2s;
}
.lc input::placeholder { color: var(--nav-t2); }
.lc input:focus { outline: none; border-bottom-color: var(--gold); }
.lc button.lbtn {
  width: 100%; height: 48px;
  background: var(--gold);
  color: var(--nav);
  font-weight: 700;
  margin-top: 14px;
  border-radius: var(--r2);
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  transition: filter 0.2s, transform 0.1s;
}
.lc button.lbtn:hover:not(:disabled) { filter: brightness(1.08); }
.lc button.lbtn:active:not(:disabled) { transform: scale(0.98); }
.lc button.lbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.lc .row2 { display: flex; gap: 8px; margin-top: 18px; justify-content: center; }
.lc .row2 button {
  border: 1px solid var(--nav-r);
  color: var(--nav-t2);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: var(--r);
  transition: border-color 0.2s, color 0.2s;
}
.lc .row2 button.on { border-color: var(--gold); color: var(--gold); }
.cr { margin-top: 24px; text-align: center; font-size: 10px; color: var(--nav-t2); font-family: var(--fm); direction: ltr; letter-spacing: 0.03em; }
.cr-s { padding: 8px 16px 4px; font-size: 9px; color: var(--nav-t2); font-family: var(--fm); direction: ltr; letter-spacing: 0.03em; text-align: center; }

@keyframes pulse { 0%,100% { opacity: 0.4 } 50% { opacity: 1 } }
@keyframes spin { from { transform: rotate(0) } to { transform: rotate(360deg) } }
.spin { animation: spin 0.8s linear infinite; }
.lc .sb.loading { animation: pulse 1.2s ease-in-out infinite; }
.lerr { color: var(--red); font-size: 13px; min-height: 20px; }
.lok { color: var(--grn); font-size: 13px; min-height: 20px; }

/* ===== Shell Layout ===== */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* ===== Sidebar (desktop) ===== */
.side {
  background: var(--nav);
  padding: 20px 0;
  padding-left: env(safe-area-inset-left, 0);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-inline-end: 1px solid var(--nav-r);
}
.side::-webkit-scrollbar { width: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px 20px;
  border-bottom: 1px solid var(--nav-r);
  margin-bottom: 12px;
}
.bm {
  width: 36px; height: 36px;
  border: 1.5px solid var(--gold);
  display: grid; place-items: center;
  flex: none;
  border-radius: var(--r2);
}
.bm i { width: 12px; height: 12px; background: var(--gold); display: block; border-radius: 2px; }
.brand b { font-family: var(--fh); font-size: 16px; color: #EEF1F0; display: block; font-weight: 600; }
.brand span { font-size: 10px; color: var(--nav-t2); font-family: var(--fm); letter-spacing: 0.12em; display: block; margin-top: 1px; }

/* Search in sidebar */
.side-search {
  margin: 0 16px 12px;
  position: relative;
}
.side-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--nav-r);
  border-radius: var(--r2);
  background: var(--nav-2);
  color: var(--nav-t);
  font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
}
.side-search input::placeholder { color: var(--nav-t2); }
.side-search input:focus { outline: none; border-color: var(--gold); }
.side-search svg {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-start: 9px;
  color: var(--nav-t2);
  pointer-events: none;
}

.sl {
  font-size: 10px;
  color: var(--nav-t2);
  padding: 18px 22px 6px;
  letter-spacing: 0.16em;
  font-family: var(--fm);
  font-weight: 500;
}
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px;
  color: var(--nav-t);
  font-size: 13.5px;
  width: 100%;
  text-align: start;
  border-inline-start: 2.5px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav:hover { background: var(--nav-2); color: #EEF1F0; }
.nav.on {
  background: var(--nav-2);
  color: var(--nav-active);
  border-inline-start-color: var(--gold);
}
.nav .k { font-family: var(--fm); font-size: 9.5px; color: var(--nav-t2); margin-inline-start: auto; direction: ltr; }
.sf { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--nav-r); }
.uc { display: flex; align-items: center; gap: 11px; padding: 10px 22px 12px; }
.uc b { font-size: 14px; color: #EEF1F0; display: block; font-weight: 600; }
.uc span { font-size: 10px; color: var(--nav-t2); font-family: var(--fm); display: block; margin-top: 1px; }
.av {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
  flex: none;
  font-family: var(--fm);
  border-radius: var(--r2);
}

/* ===== Main content ===== */
.main { padding: 0 0 80px; max-width: 1280px; padding-top: env(safe-area-inset-top, 0); }
.inner { padding: 0 40px; }
.banner {
  background: var(--amb-b);
  border-bottom: 1px solid var(--amb);
  color: var(--amb);
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.banner button {
  border: 1px solid var(--amb);
  color: var(--amb);
  padding: 3px 12px;
  font-size: 12px;
  margin-inline-start: auto;
  border-radius: var(--r);
}

/* ===== Section header ===== */
.sect { padding: 36px 0 0; margin-bottom: 24px; border-bottom: 1px solid var(--rule-2); }
.sr { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; }
.sect h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.sd { font-size: 14px; color: var(--ink-3); margin-top: 4px; }
.meta { display: flex; align-items: center; gap: 10px; }
.dtb { text-align: end; line-height: 1.45; }
.dtb .d1 { font-size: 13px; color: var(--ink-2); font-weight: 500; display: block; }
.dtb .d2 { font-size: 11px; color: var(--ink-3); font-family: var(--fm); direction: ltr; unicode-bidi: isolate; display: block; }
.tgl {
  width: 32px; height: 32px;
  border: 1px solid var(--rule-2);
  display: grid; place-items: center;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: var(--r);
  flex: none;
  transition: border-color 0.2s, color 0.2s;
}
.tgl:hover { border-color: var(--gold); color: var(--gold); }
.tgl.w { width: auto; padding: 0 10px; font-family: var(--fm); font-size: 11px; }

/* ===== Cards ===== */
.card {
  background: var(--surf);
  border: 1px solid var(--rule);
  border-radius: var(--r3);
  padding: 22px 24px;
  box-shadow: var(--sh1);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover { box-shadow: var(--sh2); border-color: var(--rule-2); }
.card > h3 {
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > h3 .c { margin-inline-start: auto; font-size: 12px; color: var(--ink-3); font-family: var(--fm); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.mb { margin-bottom: 18px; }

/* ===== Stats ===== */
.st { border-top: 2px solid var(--ink); padding-top: 10px; }
.st.gr { border-top-color: var(--grn); }
.st.rd { border-top-color: var(--red); }
.st.am { border-top-color: var(--amb); }
.st.in { border-top-color: var(--ind); }
.st span { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; font-weight: 500; }
.st b { font-size: 28px; font-weight: 600; display: block; line-height: 1.15; letter-spacing: -0.02em; }
.st .u { font-size: 12px; color: var(--ink-3); font-family: var(--fb); font-weight: 400; }
.st small { font-size: 12px; color: var(--ink-3); display: block; }
.pos { color: var(--grn); }
.neg { color: var(--red); }
.amc { color: var(--amb); }

/* ===== Rows ===== */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.row:last-child { border-bottom: none; }
.gr { flex: 1; min-width: 0; }
.rt { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs { font-size: 13px; color: var(--ink-3); }
.amt { font-family: var(--fm); font-weight: 600; font-size: 15px; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.mk { width: 3px; height: 28px; flex: none; border-radius: 1px; }

/* ===== Tags ===== */
.tag { display: inline-block; font-size: 11px; padding: 3px 10px; font-family: var(--fm); border: 1px solid; border-radius: var(--r); white-space: nowrap; font-weight: 500; }
.ok { color: var(--grn); border-color: var(--grn); background: var(--grn-b); }
.wr { color: var(--amb); border-color: var(--amb); background: var(--amb-b); }
.dg { color: var(--red); border-color: var(--red); background: var(--red-b); }
.nu { color: var(--ink-3); border-color: var(--rule-2); background: transparent; }

/* ===== Bar ===== */
.bar { height: 3px; background: var(--surf-2); margin-top: 8px; overflow: hidden; border-radius: 1px; }
.bar i { display: block; height: 100%; border-radius: 1px; }
.sep { height: 1px; background: var(--rule); margin: 12px 0; }
.mini { font-size: 13px; color: var(--ink-3); line-height: 1.8; }
.empty { text-align: center; color: var(--ink-3); font-size: 14px; padding: 32px 8px; }
.empty b { display: block; color: var(--ink-2); font-family: var(--fh); font-size: 16px; font-weight: 500; }

/* ===== Forms ===== */
label { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 5px; }
.field {
  width: 100%; height: 40px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r2);
  padding: 0 12px;
  background: var(--surf);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
textarea.field { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.8; }
.frm {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  align-items: end;
  padding: 18px;
  background: var(--surf-2);
  border: 1px solid var(--rule);
  border-radius: var(--r3);
  margin-bottom: 18px;
}
.frm.ed { border-color: var(--gold); background: var(--gold-bg); }
.frm .full { grid-column: 1/-1; }

/* ===== Buttons ===== */
.btn {
  height: 40px; padding: 0 18px;
  border-radius: var(--r2);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: filter 0.2s, transform 0.1s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn-w { width: 100%; }
.btn-g { background: transparent; color: var(--ink); border: 1px solid var(--rule-2); }
.btn-g:hover { filter: none; background: var(--surf-2); }
.btn-s { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-gold { background: var(--gold); color: var(--nav); font-weight: 600; }
.btn-gold:hover { filter: brightness(1.08); }
.x { color: var(--ink-3); font-size: 14px; padding: 3px 6px; font-family: var(--fm); transition: color 0.2s; }
.x:hover { color: var(--red); }
.e { color: var(--ink-3); font-size: 12px; padding: 3px 6px; font-family: var(--fm); transition: color 0.2s; }
.e:hover { color: var(--gold); }

/* ===== Checkbox ===== */
.chk {
  width: 18px; height: 18px;
  border: 1px solid var(--rule-2);
  display: grid; place-items: center;
  font-size: 10px; color: transparent;
  flex: none;
  border-radius: 3px;
  transition: background 0.15s, border-color 0.15s;
}
.chk.on { background: var(--grn); border-color: var(--grn); color: #fff; }
.done { text-decoration: line-through; color: var(--ink-3); }

/* ===== Tabs ===== */
.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; gap: 4px; }
.tab {
  padding: 9px 18px;
  font-size: 14px;
  color: var(--ink-3);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  font-weight: 500;
}
.tab.on { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }

/* ===== Table ===== */
.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb th { text-align: start; font-size: 12px; color: var(--ink-3); font-weight: 500; padding: 0 10px 10px; border-bottom: 1px solid var(--rule-2); }
.tb td { padding: 11px 10px; border-bottom: 1px solid var(--rule); }
.tb .n { font-family: var(--fm); direction: ltr; unicode-bidi: isolate; text-align: end; }

/* ===== Habit grid ===== */
.hg { display: grid; grid-template-columns: 1fr repeat(7, 26px); gap: 5px; align-items: center; font-size: 13px; }
.hd {
  width: 26px; height: 26px;
  border: 1px solid var(--rule-2);
  display: grid; place-items: center;
  font-size: 9px; color: var(--ink-3);
  border-radius: 3px;
  transition: background 0.15s;
}
.hd.on { background: var(--grn); border-color: var(--grn); color: #fff; }

/* ===== Search results ===== */
.res { border: 1px solid var(--rule); border-radius: var(--r); margin-top: 10px; max-height: 260px; overflow: auto; }
.res button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--rule); text-align: start; transition: background 0.15s; }
.res button:hover { background: var(--surf-2); }

/* ===== Installment card ===== */
.inst { background: var(--surf); border: 1px solid var(--rule); border-radius: var(--r2); overflow: hidden; }
.inst .ih { display: flex; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--rule); background: var(--surf-2); }
.inst .ib { padding: 16px; display: flex; align-items: flex-end; gap: 14px; }
.inst .tmp { font-family: var(--fm); font-size: 40px; line-height: 0.95; direction: ltr; }
.inst .ig { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); }
.inst .ic { padding: 10px 16px; border-inline-end: 1px solid var(--rule); }
.inst .ic:last-child { border-inline-end: none; }
.inst .ic span { display: block; font-size: 9.5px; color: var(--ink-3); font-family: var(--fm); direction: ltr; }
.inst .ic b { font-size: 14px; font-family: var(--fm); direction: ltr; display: block; }

/* ===== Transaction header ===== */
.tr-h { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 14px; }
.tr-h b { font-family: var(--fh); font-size: 20px; font-weight: 500; }
.tr-h span { font-family: var(--fm); font-size: 11px; color: var(--ink-3); direction: ltr; }

/* ===== Import ===== */
.imp { border: 1px dashed var(--rule-2); border-radius: var(--r); padding: 12px; margin-top: 10px; }
.ir { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.ir:last-child { border-bottom: none; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--nav);
  color: #fff;
  padding: 10px 20px;
  font-size: 13px;
  z-index: 60;
  border-radius: var(--r);
  box-shadow: var(--sh3);
}

.print-only { display: none; }
.no-print {}

/* ===== Calendar ===== */
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cal-dow div { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  min-height: 74px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
  cursor: default;
  transition: background 0.15s, border-color 0.15s;
}
.cal-cell.empty { border: none; min-height: 74px; }
.cal-cell.today { border-color: var(--gold); background: var(--gold-bg); }
.cal-dnum { font-size: 11px; font-weight: 600; color: var(--ink-2); font-family: var(--fm); }
.cal-items { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-item {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
  transition: opacity 0.15s;
}
.cal-item.event { background: rgba(201,169,97,0.12); color: var(--amb); }
.cal-item.task { background: rgba(130,50,42,0.10); color: var(--red); }
.cal-item.task.done { text-decoration: line-through; opacity: 0.5; }
.cal-item:hover { filter: brightness(0.95); }
.cal-time { font-family: var(--fm); font-size: 9px; opacity: 0.7; margin-inline-end: 3px; }
.cal-more { font-size: 9px; color: var(--ink-3); padding: 0 4px; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .cal-cell { min-height: 52px; }
  .cal-item { font-size: 9px; }
}

@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute !important; inset: 0 auto auto 0 !important; left: 0 !important; top: 0 !important; width: 100% !important; border: none; display: block !important; }
  .no-print, .no-print * { visibility: hidden; }
  .print-only { display: block !important; }
}

/* ===== Mobile layout (≤860px) ===== */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 0; }
  .side { display: none; }
  .inner { padding: 0 20px; }
  .banner { padding: 10px 20px; }
  .sect h2 { font-size: 21px; }
  .sect { padding-top: 24px; margin-bottom: 16px; }
  .main { padding-bottom: 72px; }

  .botnav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: var(--nav);
    border-top: 1px solid var(--nav-r);
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: 56px;
    align-items: stretch;
    justify-content: space-around;
  }
  .botnav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--nav-t);
    font-size: 9.5px;
    font-family: var(--fm);
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 6px 2px;
    border: none;
    background: none;
    letter-spacing: 0.02em;
    transition: color 0.15s;
  }
  .botnav button.on { color: var(--gold); }
  .botnav button svg { flex: none; }
  .botnav .more-btn { color: var(--nav-t); }
  .botnav .more-btn.on { color: var(--gold); }

  .botnav-sheet {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0));
    left: 0; right: 0;
    background: var(--nav);
    border-top: 1px solid var(--nav-r);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 49;
    padding: 8px 0;
    display: none;
    border-radius: var(--r2) var(--r2) 0 0;
  }
  .botnav-sheet.open { display: block; }
  .botnav-sheet .sl { font-size: 9.5px; color: var(--nav-t2); padding: 12px 18px 4px; letter-spacing: 0.14em; font-family: var(--fm); }
  .botnav-sheet .nav { color: var(--nav-t); font-size: 13px; padding: 10px 18px; min-height: 44px; }
  .botnav-sheet .nav.on { color: var(--gold); }
  .botnav-sheet .nav:hover { background: var(--nav-2); }

  .botnav-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 48; display: none; }
  .botnav-overlay.open { display: block; }
}

@media (min-width: 861px) {
  .botnav, .botnav-sheet, .botnav-overlay { display: none; }
}
