/* Chetaa's "new look" (beta): Tabler's palette and components over Chetaa's own layout (ledger.css, loaded before).
   Loaded only when the ui=tabler cookie is set; the markup is the same as the classic look, so every screen works.
   Tabler (MIT): /static/vendor/tabler-1.6.1/. Colours come from Tabler's own variables, so its dark theme works too. */
:root {
  --ink: var(--tblr-body-color, #1d273b); --muted: var(--tblr-secondary, #667382); --line: var(--tblr-border-color, #e6e7e9);
  --bg: var(--tblr-bg-surface-secondary, #f6f8fb); --panel: var(--tblr-bg-surface, #fff); --soft: var(--tblr-bg-surface, #fff);
  --accent: var(--tblr-primary, #066fd1); --bar: var(--tblr-primary, #066fd1); --bad: var(--tblr-danger, #d63939);
  --body-font: "Inter", system-ui, "Segoe UI", sans-serif; --head-font: "Inter", system-ui, "Segoe UI", sans-serif;
}
/* Owner's choice (20-10-2026): yellow ground, dark black text (Tally-like); applies over Tabler's palette */
:root {
  --ink: #000000; --muted: #2b2b2b; --line: #e3cf6e; --bg: #fff2a8; --panel: #fffbe0; --soft: #fffbe0;
  --tblr-body-color: #000000; --tblr-body-bg: #fff2a8; --tblr-bg-surface: #fffbe0; --tblr-bg-surface-secondary: #fff2a8;
  --tblr-border-color: #e3cf6e; --tblr-secondary: #2b2b2b; --tblr-muted: #2b2b2b;
}
html, body { background: var(--bg); }
body { font: .875rem/1.45 var(--body-font); color: var(--ink); }
h1 { font-size: 1.25rem; font-weight: 600; color: var(--ink); } h2 { font-size: 1rem; font-weight: 600; }
a { color: var(--accent); }

/* Header: Tabler's white navbar with a line under it; the menu is plain nav items, the current page underlined */
.bar { background: var(--panel); box-shadow: none; border-bottom: 1px solid var(--line); padding: .5rem clamp(12px, 2vw, 32px); }
.bar nav { gap: .15rem; }
.bar nav a, .bar nav a:nth-child(n) { --menu-color: transparent; background: transparent; border: 0; border-radius: 6px;
  color: var(--muted); font: 500 .875rem var(--head-font); padding: .4rem .65rem; filter: none; }
.bar nav a:hover, .bar nav a:focus-visible { background: var(--bg); color: var(--ink); outline: none; }
.bar nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.bar nav a.ai-link { background: var(--accent); color: #fff; }
.bar nav a.ai-link:hover { background: var(--accent); filter: brightness(1.08); color: #fff; }
.bar .back { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.bar .back:hover, .bar .back:focus-visible { background: var(--bg); }
.brand { color: var(--ink); font-weight: 700; }
.brand .company { color: var(--muted); border-left-color: var(--line); }
.who { color: var(--muted); font-size: .8125rem; }
.who a { color: var(--muted); }
.role { background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: 4px; }
.fy select { background-color: var(--panel); }
.menu-toggle { background: var(--accent); }

/* Cards and panels: white, hairline border, soft shadow (Tabler .card) */
main { margin: 1.25rem 0; padding: 0 clamp(12px, 2vw, 32px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(29, 39, 59, .04); }
.card { background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 8px; padding: .85rem 1rem;
  box-shadow: 0 1px 2px rgba(29, 39, 59, .04); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.card.profit::before { background: var(--tblr-success, #2fb344); } .card.loss::before { background: var(--bad); }
.card span { font-size: .7rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.card b { font-size: 1.15rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.cards { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); align-items: start; }
.cards .card { padding: .65rem .85rem; min-height: 0; height: auto; }  /* Tabler's own .card would stretch them */
.card:hover { border-color: var(--accent); }

/* Forms: Tabler .form-control */
label { color: var(--muted); font-size: .8125rem; font-weight: 500; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
  box-shadow: 0 1px 1px rgba(29, 39, 59, .03); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 22%, transparent); }

/* Buttons: Tabler .btn; data-tone keeps meaning but uses Tabler's colours */
button, a.button, label.button { border-radius: 6px; font: 500 .875rem var(--head-font); box-shadow: 0 1px 1px rgba(29, 39, 59, .08); }
button:hover, a.button:hover, label.button:hover { transform: none; filter: brightness(1.06); }
button:focus-visible { outline: 0; box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 30%, transparent); }
a.button[data-tone="blue"], button[data-tone="blue"], button[data-tone="indigo"] { background: var(--tblr-primary, #066fd1); }
a.button[data-tone="green"], button[data-tone="green"] { background: var(--tblr-success, #2fb344); }
label.button[data-tone="teal"], button[data-tone="teal"], button.secondary { background: var(--tblr-teal, #0ca678); }
button[data-tone="purple"] { background: var(--tblr-purple, #ae3ec9); }
button[data-tone="orange"] { background: var(--tblr-orange, #f76707); }
button[data-tone="pink"] { background: var(--tblr-pink, #d6336c); }
button[data-tone="red"], button.danger { background: var(--bad); }
button.link { color: var(--accent); }
button.link[data-tone] { color: #fff; }

/* Tables: Tabler .table */
table { font-size: .8125rem; }
th { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg);
  border-bottom: 1px solid var(--line); }
th, td { padding: .5rem .65rem; border-bottom-color: var(--line); }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
tr.total td { border-top: 1px solid var(--ink); }

/* Lists and the Gateway menu: neutral rows instead of rainbow tiles */
.list li, .list li:nth-child(n), .fkeys a, .fkeys a:nth-child(n), .gw-menu li a, .gw-menu li:nth-child(n) a {
  --menu-color: var(--panel); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; filter: none; }
.list li:hover, .fkeys a:hover, .gw-menu li a:hover { background: var(--bg); }
.gw-menu { border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 2px rgba(29, 39, 59, .04); }
.gw-menu h1 { background: var(--panel); color: var(--ink); font-size: .95rem; border-bottom-color: var(--line); }
.gw-menu h4 { color: var(--muted); }
.gw-menu li a u { color: var(--accent); }
.gw-menu li a.active, .gw-menu li a:focus, .gw-menu li a:focus-visible, .fkeys a:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel)); outline: 0; box-shadow: inset 3px 0 0 var(--accent); color: var(--ink); }
.gw-info { background: var(--panel); border-radius: 8px; }
.gw-info h3 { color: var(--muted); }
.fkeys kbd { color: var(--accent); }
.chips a[aria-current] { background: var(--accent); border-color: var(--accent); }

/* AI Accountant */
.ai-msg.user { background: var(--accent); }
.ai-msg.assistant { background: var(--panel); border: 1px solid var(--line); }
.ai-card { border: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--accent), 0 1px 2px rgba(29, 39, 59, .05); background: var(--panel); }
.due { background: var(--panel); }

/* The look switch in the header */
.ui-switch { font-size: .75rem; padding: .15rem .5rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
@media print { :root { --bg: #fff; --panel: #fff; } .panel, .card { box-shadow: none; } }

/* ---- New look header: Tabler's two-row navbar (brand row + menu row with icons and dropdowns) ---- */
.tb-header { display: block; padding: 0; position: relative; z-index: 20; }
.tb-top { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .55rem clamp(12px, 2vw, 32px); }
.tb-top .fy { margin-left: auto; }
.tb-top .who { margin-left: 0; }
.tb-top .fy + .who, .tb-top .brand + .who { margin-left: auto; }
.tb-icon { width: 1.05rem; height: 1.05rem; flex: none; stroke-width: 1.75; }
.tb-nav { display: flex; align-items: stretch; gap: .1rem; flex-wrap: wrap; padding: 0 clamp(12px, 2vw, 32px);
  border-top: 1px solid var(--line); }
.tb-nav > a, .tb-dd > summary { display: flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .75rem;
  color: var(--muted); font: 500 .875rem var(--head-font); text-decoration: none; border: 0; border-radius: 0; background: none;
  cursor: pointer; list-style: none; box-shadow: none; }
.tb-dd > summary::-webkit-details-marker { display: none; }
.tb-nav > a:hover, .tb-dd > summary:hover, .tb-dd[open] > summary { color: var(--ink); background: var(--bg); }
.tb-nav > a[aria-current="page"], .tb-dd > summary[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.tb-nav > a:focus-visible, .tb-dd > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tb-nav > a.ai-link { color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tb-nav > a.ai-link:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); filter: none; }
.tb-dd { position: relative; }
.tb-dd > summary .tb-icon:last-child { width: .85rem; height: .85rem; transition: transform .15s; }
.tb-dd[open] > summary .tb-icon:last-child { transform: rotate(180deg); }
.tb-menu { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 14rem; display: flex; flex-direction: column;
  padding: .35rem 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 28px rgba(29, 39, 59, .14); }
.tb-menu-end { left: auto; right: 0; }
.tb-menu a, .tb-menu-button { display: flex; align-items: center; gap: .55rem; padding: .45rem 1rem; color: var(--ink);
  font: 400 .875rem var(--body-font); text-decoration: none; white-space: nowrap; }
.tb-menu a:hover, .tb-menu a:focus-visible, .tb-menu-button:hover { background: var(--bg); color: var(--accent); outline: none; }
.tb-menu a kbd { margin-left: auto; padding-left: 1rem; font: 600 .7rem ui-monospace, monospace; color: var(--muted); background: none; border: 0; box-shadow: none; }
.tb-menu hr { margin: .35rem 0; border: 0; border-top: 1px solid var(--line); }
.tb-menu-head { padding: .35rem 1rem .15rem; font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tb-menu-wide { flex-direction: row; gap: .25rem; padding: .35rem .25rem; }
.tb-menu-wide > div { display: flex; flex-direction: column; min-width: 12rem; }
.tb-menu form { margin: 0; }
.tb-menu-button { width: 100%; margin: 0; min-height: 0; border: 0; border-radius: 0; background: none; box-shadow: none; cursor: pointer; text-align: left; }
.tb-user > summary { display: flex; align-items: center; gap: .55rem; min-height: 40px; padding: .15rem .4rem; border-radius: 8px; color: var(--ink); }
.tb-user > summary:hover, .tb-user[open] > summary { background: var(--bg); }
.tb-avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; flex: none;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); font: 700 .85rem var(--head-font); }
.tb-user-name { display: flex; flex-direction: column; line-height: 1.15; }
.tb-user-name b { font-weight: 600; font-size: .85rem; } .tb-user-name small { color: var(--muted); font-size: .72rem; }
.tb-header .menu-toggle { display: none; }
@media (max-width: 600px) {
  .tb-header .menu-toggle { display: inline-flex; gap: .35rem; margin-left: auto; }
  .tb-top .fy, .tb-top .who { margin-left: 0; width: 100%; }
  .tb-nav { flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .tb-nav > a, .tb-dd > summary { min-height: 44px; }
  .tb-menu, .tb-menu-end { position: static; box-shadow: none; border: 0; border-left: 2px solid var(--line); border-radius: 0; margin-left: 1rem; }
  .tb-menu-wide { flex-direction: column; }
  .tb-user .tb-menu { margin-left: 0; }
}
.tb-menu a.ui-switch { border: 0; border-radius: 0; padding: .45rem 1rem; font-size: .875rem; }
/* table links (ledger and voucher names in reports) read as black text, as in Tally; blue + underline on hover */
td a { color: var(--ink); text-decoration: none; }
td a:hover, td a:focus-visible { color: var(--accent); text-decoration: underline; }
