/* ===== Design tokens: macOS shell + Office 365 (Fluent) cards, brand colours from the visiting card ===== */
:root {
  --accent: #b0176e; --accent-d: #8c1157; --accent-tint: rgba(176, 23, 110, .10);
  --green: #2e7d32; --green-tint: rgba(46, 125, 50, .12); --blue: #0f6cbd; --blue-tint: rgba(15, 108, 189, .12);
  --amber: #9a7400; --amber-tint: rgba(237, 177, 0, .16); --red: #c23b52; --red-tint: rgba(194, 59, 82, .10);
  --bg: #f4f2f0; --side: rgba(246, 244, 242, .82); --card: #ffffff;
  --ink: #1d1b20; --muted: #6b6672; --line: rgba(0, 0, 0, .09); --line2: rgba(0, 0, 0, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-h: 0 2px 4px rgba(0, 0, 0, .08), 0 8px 20px rgba(0, 0, 0, .07);
  --r: 12px; --r-s: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Noto Sans Tamil", "Latha", "Nirmala UI", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --accent: #f06bb4; --accent-d: #ff93cb; --accent-tint: rgba(240, 107, 180, .16);
  --green: #7fd18a; --green-tint: rgba(127, 209, 138, .16); --blue: #6cb6f5; --blue-tint: rgba(108, 182, 245, .16);
  --amber: #f0c040; --amber-tint: rgba(240, 192, 64, .16); --red: #ff8a9a; --red-tint: rgba(255, 138, 154, .14);
  --bg: #121014; --side: rgba(30, 26, 34, .8); --card: #231f27;
  --ink: #f3eef6; --muted: #aaa1b3; --line: rgba(255, 255, 255, .12); --line2: rgba(255, 255, 255, .07);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-h: 0 4px 16px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== macOS-style window ===== */
#app { min-height: 100vh; display: flex; flex-direction: column; }
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  background: var(--side); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--line); }
.lights { display: flex; gap: 8px; } .lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.lights i:nth-child(1) { background: #ff5f57; } .lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
header.top .brand { flex: 1; min-width: 0; text-align: center; }
header.top .brand h1 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .brand small { color: var(--muted); font-size: 11px; }
header.top .tools { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--line2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 11px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink); }
.seg button.on { background: var(--card); box-shadow: var(--shadow); font-weight: 600; }
.shell { display: flex; flex: 1; min-height: 0; }
nav.side { width: 230px; flex-shrink: 0; padding: 12px 10px; background: var(--side); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-right: 1px solid var(--line); position: sticky; top: 49px; align-self: flex-start; height: calc(100vh - 49px); overflow-y: auto; }
nav.side button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); font-size: 14px; }
nav.side button svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
nav.side button:hover { background: var(--line2); }
nav.side button.active { background: var(--accent); color: #fff; font-weight: 600; } nav.side button.active svg { color: #fff; }
main { flex: 1; padding: 22px 26px 40px; min-width: 0; max-width: 1180px; }
@media (max-width: 820px) {
  .lights { display: none; } header.top .brand { text-align: left; }
  .shell { flex-direction: column; }
  nav.side { width: 100%; height: auto; position: static; display: flex; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); gap: 2px; }
  nav.side button { width: auto; white-space: nowrap; }
  main { padding: 14px 12px 32px; }
}

/* ===== Typography ===== */
h2 { margin: 0 0 14px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h3 { margin: 22px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); } .loading { color: var(--muted); padding: 24px; }

/* ===== Office 365 / Fluent cards ===== */
.card { background: var(--card); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--line2); transition: box-shadow .15s; }
.card:hover { box-shadow: var(--shadow-h); }
.card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line2); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.01em; } .stat .l { color: var(--muted); font-size: 13px; }

/* ===== Controls ===== */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 10px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--card); min-width: 140px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); outline: none; }
textarea { width: 100%; min-height: 64px; }
button.btn { background: var(--accent); color: #fff; border: 0; border-radius: var(--r-s); padding: 7px 16px; cursor: pointer; font-weight: 600; transition: filter .12s; }
button.btn:hover { filter: brightness(1.08); } button.btn:active { filter: brightness(.94); }
button.btn.alt { background: var(--green); color: #fff; }
button.btn.ghost { background: var(--card); color: var(--accent); border: 1px solid var(--line); box-shadow: var(--shadow); }
button.btn.small { padding: 3px 10px; font-size: 13px; } button.btn:disabled { opacity: .5; cursor: not-allowed; }
.tablewrap { overflow-x: auto; border-radius: var(--r-s); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: transparent; position: sticky; top: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--accent-tint); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--green-tint); color: var(--green); font-weight: 600; }
.badge.bad { background: var(--red-tint); color: var(--red); }
.msg { padding: 10px 12px; border-radius: var(--r-s); margin: 8px 0; font-size: 14px; }
.msg.err { background: var(--red-tint); color: var(--red); } .msg.ok { background: var(--green-tint); color: var(--green); }
.msg.warn { background: var(--amber-tint); color: var(--ink); }
.charts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } .charts svg { width: 100%; height: auto; max-width: 420px; }
.login { max-width: 380px; margin: 9vh auto; padding: 26px; }
details { border: 1px solid var(--line2); border-radius: var(--r-s); padding: 6px 10px; margin: 6px 0; } summary { cursor: pointer; font-weight: 600; }
.stars { color: #e0a100; letter-spacing: 2px; } .qr svg { width: 150px; height: 150px; }

/* ===== Daily panchangam screen ===== */
.pc-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pc-top .y { font-size: 26px; font-weight: 700; color: var(--accent-d); } .pc-top .y2 { color: var(--muted); }
.pc-top .dn { font-size: 48px; font-weight: 700; line-height: 1; color: var(--accent); text-align: right; } .pc-top .dm { color: var(--muted); text-align: right; }
.sec { font-size: 11px; letter-spacing: .07em; color: var(--muted); text-transform: uppercase; margin: 18px 0 8px; font-weight: 600; }
.limbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 900px) { .limbs { grid-template-columns: repeat(2, 1fr); } }
.limb { background: var(--card); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); border: 1px solid var(--line2); }
.limb .k { font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; } .limb .n { font-size: 18px; font-weight: 700; margin: 2px 0; }
.limb .s { font-size: 12.5px; color: var(--muted); min-height: 36px; }
.bar { height: 6px; background: var(--blue-tint); border-radius: 3px; overflow: hidden; display: flex; margin-top: 8px; } .bar i { display: block; height: 100%; } .bar i.a { background: var(--blue); } .bar i.b { background: color-mix(in srgb, var(--blue) 38%, transparent); } .bar i.g { background: #9a9a9a; }
.tl-scroll { overflow-x: auto; } .tl { min-width: 640px; position: relative; }
.lane { position: relative; display: flex; } .lane .lab { width: 84px; font-size: 13px; font-weight: 700; padding-top: 4px; flex-shrink: 0; } .lane .trk { position: relative; flex: 1; }
.ax { height: 20px; font-size: 11px; color: var(--muted); position: relative; } .ax span { position: absolute; top: 0; transform: translateX(-50%); } .ax span:first-child { transform: none; } .ax span:last-child { transform: translateX(-100%); }
.vl { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.bb { position: absolute; top: 4px; height: 14px; border-radius: 4px; } .bb.g { background: var(--green); } .bb.o { background: #8a7000; } .bb.r { background: var(--red); }
.bl { position: absolute; font-size: 12px; white-space: nowrap; } .bl.g { color: var(--green); } .bl.o { color: var(--amber); } .bl.r { color: var(--red); } .bl.c { color: var(--blue); }
.tk { position: absolute; top: 4px; height: 14px; border-left: 2px solid var(--blue); }
.two { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; } @media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.box h4 { margin: 0 0 8px; font-size: 15px; } .box .ln { display: flex; justify-content: space-between; border-top: 1px solid var(--line2); padding: 7px 0; } .box .ln:first-of-type { border-top: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; } .dot.g { background: var(--green); } .dot.r { background: var(--red); }
.ins .it { display: flex; gap: 12px; border-top: 1px solid var(--line2); padding: 10px 0; font-size: 14px; } .ins .it:first-child { border-top: 0; }
.ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ic.ok { background: var(--green-tint); color: var(--green); } .ic.time { background: var(--blue-tint); color: var(--blue); } .ic.warn { background: var(--amber-tint); color: var(--amber); } .ic.alert { background: var(--red-tint); color: var(--red); }
table.sc { table-layout: fixed; border-collapse: collapse; margin: 0 auto; width: min(100%, 360px); aspect-ratio: 1; border: 2px solid var(--green); background: var(--green-tint); }
table.sc td { border: 1px solid var(--green); text-align: center; vertical-align: top; font-size: 13px; color: var(--accent); padding: 3px; width: 25%; height: 25%; }
table.sc td.mid { vertical-align: middle; font-weight: 700; font-size: 16px; background: var(--card); }
.legend { font-size: 11px; color: var(--muted); text-align: center; margin-top: 8px; } .fn { font-size: 12px; color: var(--muted); margin-top: 14px; }
.pc-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.today-row td { background: var(--accent-tint); font-weight: 600; } .newmoon td:first-child { color: var(--red); } .fullmoon td:first-child { color: var(--green); }

/* ===== Eco-friendly A4 printing: white page, no shadows or fills, thin lines ===== */
@page { size: A4; margin: 12mm; }
@media print {
  header.top, nav.side, .noprint, button, .pc-tools { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; } main { padding: 0; max-width: none; }
  .card, .limb, .stat { box-shadow: none; border: 1px solid #999; break-inside: avoid; } th { position: static; }
}

/* ===== Jathagam screen ===== */
.tabs { overflow-x: auto; max-width: 100%; } .tabs button { white-space: nowrap; }
.dtl { position: relative; height: 38px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); margin: 10px 0 4px; }
.dseg { position: absolute; top: 0; bottom: 0; border: 0; border-right: 1px solid var(--card); cursor: pointer; font-size: 12px; color: #2b2230; padding: 0; overflow: hidden; }
.dseg:hover { filter: brightness(.94); } .dnow { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--red); }
.dax { position: relative; height: 18px; font-size: 11px; color: var(--muted); } .dax span { position: absolute; transform: translateX(-50%); }
.sbars { display: flex; align-items: flex-end; gap: 6px; height: 130px; border-bottom: 1px solid var(--line); padding-top: 14px; }
.scol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; font-size: 11px; height: 100%; position: relative; }
.scol span { margin-bottom: 2px; } .scol i { display: block; width: 100%; background: var(--green); opacity: .75; border-radius: 4px 4px 0 0; } .scol em { position: absolute; bottom: -18px; font-style: normal; font-size: 10px; color: var(--muted); }
.sbars { margin-bottom: 22px; }
.bv { display: inline-block; min-width: 18px; text-align: center; } .bv.hi { background: var(--green-tint); font-weight: 700; border-radius: 4px; } .bv.lo { color: var(--muted); opacity: .7; }
.stl { position: relative; height: 30px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 8px 0 4px; }
.sseg { position: absolute; top: 0; bottom: 0; background: var(--red-tint); border-right: 1px solid var(--card); font-size: 11px; text-align: center; padding-top: 6px; overflow: hidden; color: var(--red); }

/* ===== Rasi palan screen ===== */
.pgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pcard { margin: 0; } .pcard .ph { display: flex; justify-content: space-between; align-items: baseline; } .pcard .ph b { font-size: 17px; } .pcard p { margin: 6px 0; font-size: 14px; }
.pcard.alert { border-color: var(--red); background: var(--red-tint); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; } .cal .wk { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.day { border: 1px solid var(--line2); border-radius: 10px; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; font: inherit; color: var(--ink); }
.day b { font-size: 15px; } .day span { font-size: 9px; color: #b07a00; letter-spacing: 1px; } .day.empty { border: 0; cursor: default; }
.day:hover { box-shadow: var(--shadow-h); } .day.x { outline: 2px solid var(--red); outline-offset: -2px; }
.s1 { background: rgba(194, 59, 82, .22); } .s2 { background: rgba(240, 140, 60, .18); } .s3 { background: rgba(237, 177, 0, .20); } .s4 { background: rgba(120, 190, 90, .22); } .s5 { background: rgba(46, 160, 60, .30); }
.lgk { display: inline-block; width: 22px; text-align: center; border-radius: 4px; margin-right: 3px; }

/* ===== Matching screen ===== */
.mrow { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ring { --p: 0; width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--line2) 0); display: grid; place-items: center; }
.ring span { background: var(--card); border-radius: 50%; width: 74px; height: 74px; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.verdict { font-size: 17px; font-weight: 600; } .verdict.good { color: var(--green); } .verdict.weak { color: var(--red); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { border-radius: var(--r); padding: 10px 12px; border: 1px solid var(--line2); box-shadow: var(--shadow); background: var(--card); } .tile b { font-size: 14px; } .tile small { display: block; color: var(--muted); font-size: 11.5px; min-height: 30px; }
.tile .tm { font-size: 22px; font-weight: 700; } .tile.y { background: var(--green-tint); } .tile.y .tm { color: var(--green); } .tile.n { background: var(--red-tint); } .tile.n .tm { color: var(--red); }

/* ===== Muhurtham screen ===== */
.day.mh .sm { font-size: 9.5px; color: var(--muted); letter-spacing: 0; } .day.mh.ok { background: var(--green-tint); border-color: var(--green); } .day.mh.no { opacity: .55; }
.lgk.mh { width: 22px; text-align: center; border-radius: 4px; margin-right: 3px; } .lgk.mh.ok { background: var(--green-tint); color: var(--green); } .lgk.mh.no { background: var(--line2); }
.chk { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 10px; font-size: 13px; }

/* ===== Clients, appointments, finance ===== */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; }
button.persona { display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; margin: 0; width: 100%; font: inherit; color: inherit; } .persona .pt { display: flex; flex-direction: column; min-width: 0; } .persona small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.persona.big { display: flex; align-items: center; gap: 16px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.slot { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--green); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.slot small { color: var(--muted); font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .slot:hover:not(:disabled) { background: var(--green-tint); }
.slot.sel { background: var(--green); color: #fff; } .slot.sel small { color: #fff; } .slot.booked { background: var(--accent-tint); border-color: var(--accent); cursor: default; } .slot.done { opacity: .6; border-color: var(--line); } .slot.past.free { opacity: .45; }
.fbars { display: flex; align-items: flex-end; gap: 14px; height: 150px; border-bottom: 1px solid var(--line); padding: 0 6px; } .fg { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 100%; }
.fg i { display: block; width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; } .fi { background: var(--green); opacity: .8; } .fe { background: var(--red); opacity: .75; }
.fx { display: flex; gap: 14px; padding: 4px 6px; font-size: 11px; color: var(--muted); } .fx span { flex: 1; text-align: center; }
.hb { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; } .hb div { background: var(--line2); border-radius: 4px; height: 10px; } .hb i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
a.ln { color: inherit; text-decoration: none; }

/* ===== Phone layout (installed app): bottom tab bar, safe areas, touch targets ===== */
@media (max-width: 820px) {
  header.top { padding-top: max(8px, env(safe-area-inset-top)); }
  header.top .brand h1 { font-size: 13px; } header.top .tools .seg button { padding: 4px 8px; }
  nav.side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: 100%; height: auto; z-index: 30; border-top: 1px solid var(--line); border-bottom: 0;
    padding: 4px 4px max(4px, env(safe-area-inset-bottom)); flex-direction: row; overflow-x: auto; }
  nav.side button { flex-direction: column; gap: 2px; min-width: 66px; padding: 5px 6px; font-size: 10.5px; text-align: center; justify-content: center; }
  nav.side button svg { width: 22px; height: 22px; }
  main { padding-bottom: 96px; }
  button.btn, input, select { min-height: 40px; } .seg button { min-height: 32px; }
}
@media (display-mode: standalone) { body { overscroll-behavior-y: none; } }
