/* MyBooks: Coastal Tax colors from coastaltaxma.com. Fonts installed on every PC and phone; nothing loads from
   anywhere else (the Content Security Policy blocks it).

   Light and dark themes: every color is a token below. Dark mode follows the device setting, unless the person picked
   Light or Dark on their Account page (data-theme on <html>). The dark values are their own steps, not an inversion:
   chart colors (--viz-*) were validated for each surface with the dataviz palette checker. */
:root {
  color-scheme: light;
  --bg: #f6f9fb; --surface: #ffffff; --surface-2: #EAF3F8; --ink: #2f3b45; --muted: #5C6873; --line: #dde5ea;
  --input-border: #b8c4cc; --heading: #153A5B; --accent: #2695B3; --link: #1F7FA0;
  --btn-bg: #153A5B; --btn-ink: #ffffff; --btn-hover: #2695B3; --th-bg: #153A5B; --th-ink: #ffffff;
  --header-bg: #ffffff; --header-rule: #153A5B; --logo-plate: transparent;
  --good: #2E7D32; --bad: #C62828; --good-bg: #edf6ee; --bad-bg: #fbeeee; --warn-bg: #fdf3e7; --warn-ink: #9a4a1c;
  --warn-rule: #d9733e; --hover-wash: rgba(21, 58, 91, .05); --shadow: rgba(21, 58, 91, .15);
  /* charts, light surface #FFFFFF */
  --viz-navy: #153A5B; --viz-muted: #B8C4CC; --viz-down: #8FA3B5; --viz-other: #B8C4CC;
  --viz-s0: #0079C1; --viz-s1: #C9A227; --viz-s2: #2A9D8F; --viz-s3: #D9733E; --viz-grid: #E6ECF0; --viz-zero: #9AA6AF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1720; --surface: #16232F; --surface-2: #1E2F3E; --ink: #E3EAF0; --muted: #9FB0BD; --line: #2A3B4A;
    --input-border: #3A4D5E; --heading: #CFE0EE; --accent: #4FB3D4; --link: #6CC3E0;
    --btn-bg: #24729F; --btn-ink: #ffffff; --btn-hover: #2E87B9; --th-bg: #1E3347; --th-ink: #E3EAF0;
    --header-bg: #0E1720; --header-rule: #24729F; --logo-plate: #ffffff;
    --good: #6CC070; --bad: #F07575; --good-bg: #1C3324; --bad-bg: #3A1F22; --warn-bg: #3A2A1C; --warn-ink: #F0B27A;
    --warn-rule: #D8723D; --hover-wash: rgba(255, 255, 255, .06); --shadow: rgba(0, 0, 0, .5);
    /* charts, dark surface #16232F */
    --viz-navy: #7FA4C8; --viz-muted: #5E7182; --viz-down: #7B8FA0; --viz-other: #6B7A86;
    --viz-s0: #3799E3; --viz-s1: #B38D00; --viz-s2: #37A698; --viz-s3: #D8723D; --viz-grid: #233444; --viz-zero: #5E7182;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1720; --surface: #16232F; --surface-2: #1E2F3E; --ink: #E3EAF0; --muted: #9FB0BD; --line: #2A3B4A;
  --input-border: #3A4D5E; --heading: #CFE0EE; --accent: #4FB3D4; --link: #6CC3E0;
  --btn-bg: #24729F; --btn-ink: #ffffff; --btn-hover: #2E87B9; --th-bg: #1E3347; --th-ink: #E3EAF0;
  --header-bg: #0E1720; --header-rule: #24729F; --logo-plate: #ffffff;
  --good: #6CC070; --bad: #F07575; --good-bg: #1C3324; --bad-bg: #3A1F22; --warn-bg: #3A2A1C; --warn-ink: #F0B27A;
  --warn-rule: #D8723D; --hover-wash: rgba(255, 255, 255, .06); --shadow: rgba(0, 0, 0, .5);
  --viz-navy: #7FA4C8; --viz-muted: #5E7182; --viz-down: #7B8FA0; --viz-other: #6B7A86;
  --viz-s0: #3799E3; --viz-s1: #B38D00; --viz-s2: #37A698; --viz-s3: #D8723D; --viz-grid: #233444; --viz-zero: #5E7182;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", Calibri, -apple-system, Roboto, Arial, sans-serif; font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
h1, h2, h3 { font-family: Georgia, serif; font-weight: 400; color: var(--heading); margin: 0 0 .4rem; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; margin-top: 1.6rem; } h3 { font-size: 1.1rem; }
.muted { color: var(--muted); } .small { font-size: .88rem; }

/* header */
.top { background: var(--header-bg); border-bottom: 3px solid var(--header-rule); }
.top .bar { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap; }
.top .logo { display: block; background: var(--logo-plate); border-radius: 8px; padding: 2px 6px; }
.top img { height: 42px; display: block; }
.top .product { font-family: Georgia, serif; color: var(--accent); font-size: 1.1rem; }
.top nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.top nav a { text-decoration: none; color: var(--heading); }
.top nav a.on { border-bottom: 2px solid var(--accent); }
.top nav form { margin: 0; }
.menu-toggle { display: none; }
.linkbutton { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0;
  text-decoration: underline; }
.linkbutton:hover { background: none; color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 22px 16px 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; margin-bottom: 18px; }
.card > h1:first-child, .card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.narrow { max-width: 440px; margin: 40px auto; }
.narrow .brandmark { display: block; width: 230px; max-width: 100%; margin: 0 auto 6px; background: var(--logo-plate);
  border-radius: 10px; padding: 6px 10px; }
.narrow .tag { text-align: center; color: var(--accent); font-family: Georgia, serif; font-style: italic; margin: 0 0 18px; }

/* forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input[type=email], input[type=password], input[type=text], textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); border: 1px solid var(--input-border);
  border-radius: 6px; background: var(--surface); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
button, .button { display: inline-block; padding: 10px 18px; font: inherit; color: var(--btn-ink); background: var(--btn-bg);
  border: 0; border-radius: 6px; cursor: pointer; text-decoration: none; min-height: 44px; }
button:hover, .button:hover { background: var(--btn-hover); }
button.secondary, .button.secondary { background: var(--surface); color: var(--heading); border: 1px solid var(--heading); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); }
.full { width: 100%; margin-top: 18px; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 6px 0; font-size: .9rem; }
.helptext, .hint { color: var(--muted); font-size: .85rem; }

/* notices */
.note { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border-left: 4px solid var(--accent); background: var(--surface-2); }
.note.success { border-color: var(--good); background: var(--good-bg); }
.note.error { border-color: var(--bad); background: var(--bad-bg); }
.note.warning { border-color: var(--warn-rule); background: var(--warn-bg); }

/* cards of numbers */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 10px 0 6px; }
.metric { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px 14px; }
.metric .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.metric .value { font-size: 1.6rem; color: var(--heading); font-weight: 600; }
.metric .delta { font-size: .82rem; color: var(--muted); }
.metric .delta.good { color: var(--good); } .metric .delta.bad { color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; background: var(--th-bg); color: var(--th-ink); font-weight: 600; padding: 8px 10px; font-size: .85rem; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
.letter p { margin: 0 0 .8rem; white-space: pre-line; }
.qr { display: block; width: 200px; height: 200px; margin: 10px auto; background: #fff; padding: 8px; border: 1px solid var(--line);
  border-radius: 6px; }   /* stays white in dark mode: phone cameras read dark on light */
.secret { font-family: Consolas, monospace; letter-spacing: .08em; text-align: center; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: Consolas, monospace;
  font-size: 1.1rem; padding: 12px; background: var(--surface-2); border-radius: 6px; }
.thread .msg { padding: 12px 14px; border-radius: 8px; margin-bottom: 10px; max-width: 80%; white-space: pre-line; }
.thread .client { background: var(--surface-2); margin-left: auto; }
.thread .firm { background: var(--surface); border: 1px solid var(--line); }
.thread .who { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.answered { color: var(--good); font-size: .85rem; }
footer { max-width: 1080px; margin: 0 auto; padding: 0 16px 30px; color: var(--muted); font-size: .82rem; }

/* welcome page */
.welcome { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: 10px;
  padding: 22px 26px; margin-bottom: 8px; }
.welcome h1 { font-size: 2rem; margin-bottom: .2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--accent); margin: 0 0 4px; }
.lead { font-size: 1.1rem; margin: 0 0 6px; }
.todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 8px; }
.task { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; color: var(--ink); text-decoration: none; }
a.task:hover, a.task:focus { border-color: var(--accent); }
.task .count { min-width: 40px; height: 40px; border-radius: 20px; background: var(--surface-2); color: var(--heading);
  font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.task.urgent .count { background: var(--warn-bg); color: var(--warn-ink); }
.task .icon { min-width: 40px; text-align: center; font-size: 1.4rem; color: var(--accent); }
.task.done .icon { color: var(--good); }
.contact { margin-top: 26px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* books status steps */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 14px 0 8px; flex-wrap: wrap; }
.steps li { flex: 1 1 120px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg); color: var(--muted); font-size: .9rem; }
.steps .dot { width: 24px; height: 24px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); font-size: .8rem; font-weight: 700; background: var(--surface); }
.steps li.done { color: var(--ink); }
.steps li.done .dot { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.steps li.now { background: var(--surface-2); color: var(--heading); font-weight: 600; }
.steps li.now .dot { border-color: var(--heading); color: var(--heading); }

/* tax calendar */
.deadlines { list-style: none; margin: 0; padding: 0; }
.deadlines li { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.deadlines li:last-child { border-bottom: 0; }
.deadlines .when { min-width: 92px; font-weight: 600; color: var(--heading); }
.deadlines li.soon .when { color: var(--warn-ink); }
.who { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; margin-top: 3px; }
.who.client { background: var(--warn-bg); color: var(--warn-ink); }
.who.firm { background: var(--surface-2); color: var(--heading); }

/* 1099 vendors */
fieldset.vendor { margin: 0 0 14px; }
fieldset.vendor legend { padding: 0 6px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.choices .q { font-weight: 600; font-size: .9rem; margin: 8px 0 4px; }
label.choice { font-weight: 400; display: flex; gap: 10px; align-items: center; margin: 2px 0; min-height: 36px; }
label.choice input { width: 18px; height: 18px; }

/* dashboard */
.filters { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.filters p { margin: 0; }
.period { display: flex; gap: 8px; align-items: center; }
.period label { margin: 0; }
.period select { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.commentary p { margin: 0 0 .7rem; }
.charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin: 16px 0; }
.chartcard { margin: 0; min-width: 0; }
.tablewrap { overflow-x: auto; }
.chartcard.wide { grid-column: 1 / -1; }
.chartcard figcaption { font-family: Georgia, serif; color: var(--heading); font-size: 1.05rem; margin-bottom: 6px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .ax { font-size: 11px; fill: var(--muted); }
svg.chart .dl { font-size: 11px; fill: var(--ink); font-weight: 600; }
svg.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
svg.chart .zero { stroke: var(--viz-zero); stroke-width: 1; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ring { stroke: var(--surface); stroke-width: 2; }
.gap { stroke: var(--surface); stroke-width: 2; }
.f-navy { fill: var(--viz-navy); } .f-muted { fill: var(--viz-muted); } .f-down { fill: var(--viz-down); }
.f-other { fill: var(--viz-other); } .f-s0 { fill: var(--viz-s0); } .f-s1 { fill: var(--viz-s1); }
.f-s2 { fill: var(--viz-s2); } .f-s3 { fill: var(--viz-s3); }
.k-navy { stroke: var(--viz-navy); } .k-muted { stroke: var(--viz-muted); } .k-other { stroke: var(--viz-other); }
.k-s0 { stroke: var(--viz-s0); } .k-s1 { stroke: var(--viz-s1); } .k-s2 { stroke: var(--viz-s2); } .k-s3 { stroke: var(--viz-s3); }
.bg-navy { background: var(--viz-navy); } .bg-muted { background: var(--viz-muted); } .bg-down { background: var(--viz-down); }
.bg-other { background: var(--viz-other); } .bg-s0 { background: var(--viz-s0); } .bg-s1 { background: var(--viz-s1); }
.bg-s2 { background: var(--viz-s2); } .bg-s3 { background: var(--viz-s3); }
svg.chart .hit { fill: transparent; cursor: crosshair; outline: none; }
svg.chart .hit.row { cursor: default; }
svg.chart .hit.on, svg.chart .hit:focus { fill: var(--hover-wash); }
svg.chart .xhair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; display: none; pointer-events: none; }
svg.chart .xhair.on { display: inline; }
details { margin-top: 8px; font-size: .9rem; }
details summary { cursor: pointer; color: var(--link); padding: 6px 0; }
details table { margin-top: 6px; font-size: .88rem; }
td.delta.good { color: var(--good); } td.delta.bad { color: var(--bad); }
.tip { position: absolute; z-index: 10; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; box-shadow: 0 4px 14px var(--shadow); font-size: .85rem; pointer-events: none; min-width: 150px; }
.tip-title { color: var(--muted); font-size: .78rem; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-key { width: 12px; height: 3px; border-radius: 2px; background: transparent; }
.tip-name { color: var(--muted); }

/* package PDF */
.pdfwrap { margin: 10px 0 18px; }
iframe.pdf { width: 100%; height: 82vh; min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pdfnote { display: none; }

/* access setup */
.access .filters { margin-bottom: 4px; }
.access h2 { margin: 0; }
.state { font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); }
.state.done { background: var(--surface-2); color: var(--heading); }
.state.confirmed { background: var(--good-bg); color: var(--good); }
.state.problem { background: var(--bad-bg); color: var(--bad); }
.howto { padding-left: 1.3rem; margin: 8px 0; }
.howto li { margin-bottom: 4px; }
.access form button { margin-top: 10px; }

/* account: theme choice */
.themes { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.themes label.choice { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }

/* phones and small tablets */
@media (max-width: 760px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
  .top .bar { gap: 10px; }
  .top img { height: 32px; }
  .top .product { font-size: 1rem; }
  .plot { overflow-x: auto; }               /* charts keep readable text and scroll sideways */
  svg.chart { min-width: 420px; }
  .wide svg.chart { min-width: 640px; }
  main { padding: 16px 16px 40px; }
  .card { padding: 16px; }
  .welcome { padding: 18px; }
  .welcome h1 { font-size: 1.6rem; }
  .choices { grid-template-columns: 1fr; }
  iframe.pdf { display: none; }
  .pdfnote { display: block; }
  /* the menu folds behind a button (only when the script runs, so it never disappears without it) */
  .js .menu-toggle { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; background: var(--surface);
    color: var(--heading); border: 1px solid var(--line); }
  .js .top nav { display: none; }
  .js .top nav.open { display: flex; }
  .top nav { width: 100%; flex-direction: column; align-items: stretch; gap: 0; margin: 4px 0 0; }
  .top nav a, .top nav .linkbutton { display: block; padding: 12px 4px; border-bottom: 1px solid var(--line);
    text-align: left; width: 100%; text-decoration: none; }
  .top nav a.on { border-bottom: 1px solid var(--line); border-left: 3px solid var(--accent); padding-left: 10px; }
  .top nav form { display: flex; gap: 8px; padding: 10px 0; }
  .actions { width: 100%; }
  .actions .button, .actions button { flex: 1 1 auto; text-align: center; }
  .deadlines li { flex-direction: column; gap: 2px; }
}

@media (max-width: 640px) {
  td.hide-small, th.hide-small { display: none; }
  .thread .msg { max-width: 100%; }
  .contact .button { width: 100%; text-align: center; }
}
