/* Taxcat, inside the Shopify admin.

   Every page is drawn with Shopify's Polaris web components, which bring their own look. This file
   never restyles one of them. It holds only:
     1. the frame the local demo needs, because outside the admin there is no Shopify navigation;
     2. layout for arranging things on a page;
     3. the few things Polaris has no component for: the state tile map, small charts, the
        booking calendar, the plans grid, code samples and the Taxcat AI sidebar.
   The operator console is not a Shopify admin page and keeps its own sheet (operator.css). */

:root {
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-subdued: #f7f7f7;
  --border: #e3e3e3;
  --border-strong: #8a8a8a;
  --divider: #ebebeb;
  --text: #303030;
  --text-subdued: #616161;
  --text-disabled: #b5b5b5;
  --link: #005bd3;
  --success-bg: #cdfee1; --success-text: #0c5132; --success: #29845a;
  --info-bg: #e0f0ff; --info-text: #00527c; --info: #0094d5;
  --attention-bg: #ffef9d; --attention-text: #4f4700; --attention: #e5c300;
  --warning-bg: #ffd6a4; --warning-text: #5e4200; --warning: #e07c00;
  /* Red is for errors only. */
  --critical-bg: #fedad9; --critical-text: #8e1f0b; --critical: #e22c38;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Text that sits outside a Polaris component (a map tile, a chart label) uses the admin's own type. */
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 13px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
span.cluster { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row { display: flex; gap: 16px; }
.row > * { flex: 1; min-width: 0; }
.boot { display: grid; place-items: center; min-height: 60vh; }
:is(.tile, .cal-day, .slot, .hbar, .demo-nav a):focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }

/* ---- 1. the demo's frame: stands in for the Shopify admin around the app ---- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; }
.demo-nav {
  width: 220px; flex: none; padding: 16px 12px; background: #ebebeb; border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.demo-brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; padding: 4px 8px 14px; }
.demo-brand .logo { width: 24px; height: 24px; border-radius: 6px; background: #303030; color: #fff; display: grid; place-items: center; font-size: 13px; }
.demo-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--text); font-weight: 550; margin-bottom: 2px; text-decoration: none; }
.demo-nav a:hover { background: #e1e1e1; }
.demo-nav a.active { background: #fafafa; box-shadow: 0 1px 0 0 rgba(26, 26, 26, 0.07), 0 0 0 1px rgba(26, 26, 26, 0.04); }
.demo-nav-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--divider); display: flex; flex-direction: column; }
.demo-note { margin: 16px 8px 0; font-size: 12px; color: var(--text-subdued); }
.nav-count { font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 10px; background: var(--attention-bg); color: var(--attention-text); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #303030; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; font-weight: 550; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
@media (max-width: 860px) { .demo-nav { display: none; } .row { flex-direction: column; } }

/* ---- 2. layout ---- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.kpi { padding: 16px; }
.kpi-label { color: var(--text-subdued); font-weight: 550; font-size: 12px; }
.kpi-value { font-size: 24px; line-height: 32px; font-weight: 650; margin-top: 4px; letter-spacing: -0.3px; }
.kpi-foot { color: var(--text-subdued); font-size: 12px; margin-top: 2px; }
.kpi-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--border-strong); }
.kpi-dot.critical { background: var(--critical); }
.kpi-dot.warning { background: var(--warning); }
.kpi-dot.attention { background: var(--attention); }
.kpi-dot.success { background: var(--success); }
/* figures side by side in one section, a rule between them */
.stat + .stat { border-left: 1px solid var(--divider); }
@media (max-width: 700px) { .stat + .stat { border-left: 0; border-top: 1px solid var(--divider); } }
.toggle-row + .toggle-row { border-top: 1px solid var(--divider); }
div.toggle-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 14px 16px; }
div.toggle-row > div:first-child { max-width: 70ch; }
.meter-bar { min-width: 90px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.state-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; }
.day-checks { display: flex; gap: 10px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--text-subdued); }
.dl dd { margin: 0; }
.summary-lines { width: 100%; border-collapse: collapse; }
.summary-lines td { padding: 6px 0; border-bottom: 1px solid var(--divider); }
.summary-lines tr:last-child td { border-bottom: 0; font-weight: 650; font-size: 14px; }
.summary-lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--divider); border-radius: 8px; }
.fact { padding: 10px 12px; }
.fact + .fact { border-left: 1px solid var(--divider); }
.fact-label { font-size: 12px; color: var(--text-subdued); }
.fact-value { font-size: 14px; font-weight: 650; margin-top: 2px; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .fact + .fact { border-left: 0; border-top: 1px solid var(--divider); } }
.disclosure > summary { cursor: pointer; font-weight: 550; color: var(--link); }
.disclosure[open] > summary { color: var(--text); }
.bulk-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--divider); background: var(--surface-subdued); }
/* a row of filters above a table */
.tx-toolbar { display: flex; gap: 8px; padding: 8px 12px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--divider); }
.tx-toolbar > .grow { flex: 1 1 0; }
.tool-field { flex: 0 1 220px; min-width: 160px; }
.tx-fix { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; background: var(--surface-subdued); border-bottom: 1px solid var(--divider); }
.tx-fix > div:first-child { flex: 1; min-width: 260px; }
.tx-pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-top: 1px solid var(--divider); }
.tool-line { display: grid; grid-template-columns: minmax(180px, 2fr) 90px 130px auto; gap: 8px; align-items: center; }
.tool-head { font-size: 12px; font-weight: 550; color: var(--text-subdued); margin-bottom: 4px; }
@media (max-width: 640px) { .tool-line { grid-template-columns: 1fr 1fr; } .tool-head { display: none; } }
.suggest { border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--divider); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: var(--surface-subdued); }
.copy-box { display: flex; gap: 8px; align-items: center; }
.int-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--divider); }
.int-divide { border-top: 1px solid var(--divider); }
.int-error { color: var(--critical-text); font-size: 12px; }
.int-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.int-history li { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.int-options { display: flex; flex-direction: column; }
.int-option { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--divider); }
.int-option:first-child { border-top: 0; padding-top: 0; }
.int-option:last-child { padding-bottom: 0; }
.int-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 560px) { .int-row, .int-option { flex-direction: column; align-items: flex-start; } .copy-box { flex-direction: column; align-items: stretch; } }
.setup-sub { padding: 10px 12px; background: var(--surface-subdued); border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- 3. Taxcat's own pieces ---- */

/* the states as a tile map */
.tilemap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; max-width: 560px; }
.overview-top .tilemap { max-width: none; }
.tile {
  aspect-ratio: 1 / 1; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 650;
  background: #ebebeb; color: var(--text-subdued); border: 0; cursor: pointer; padding: 0; min-width: 0;
}
.tile:hover { filter: brightness(0.95); }
.tile.registered { background: #92e6b5; color: #0c5132; }
.tile.triggered, .tile.physical { background: #ffb96a; color: #5e4200; }
.tile.pending { background: #a9dcff; color: #00527c; }
.tile.approaching { background: #ffe66b; color: #4f4700; }
.tile.no_sales_tax { background: #fff; color: #b5b5b5; box-shadow: 0 0 0 1px #e3e3e3 inset; cursor: default; }
.tile.disregarded { background: repeating-linear-gradient(135deg, #ebebeb, #ebebeb 4px, #f7f7f7 4px, #f7f7f7 8px); color: #616161; }
.legend { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-subdued); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* what needs attention, as a list */
.alert { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--divider); align-items: flex-start; }
.alert:last-child { border-bottom: 0; }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--info); }
.alert.critical .dot { background: var(--critical); }
.alert.warning .dot { background: var(--warning); }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 650; }
.alert-actions { display: flex; gap: 12px; flex: none; }
.alert-meter { margin-top: 6px; max-width: 320px; }
.alert-foot { align-items: center; justify-content: space-between; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--divider); }
.task-row:first-child { border-top: 0; }
.task-count { flex: none; min-width: 44px; font-size: 18px; font-weight: 650; }
.task-label { flex: 1; min-width: 0; }

/* small charts */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.chart .bar { flex: 1; background: #b5b5b5; border-radius: 3px 3px 0 0; min-height: 1px; position: relative; }
.chart .bar.cur { background: #303030; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-subdued); margin-top: 4px; }
.chart.tall { height: 160px; gap: 10px; }
.chart.tall .bar { border-radius: 4px 4px 0 0; max-width: 72px; margin: 0 auto; }
.chart-labels { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--text-subdued); }
.chart-labels span { flex: 1; text-align: center; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(84px, 28%) 1fr auto; gap: 10px; align-items: center; border: 0; background: none; padding: 2px 0; font: inherit; color: inherit; text-align: left; width: 100%; }
.hbar.clickable { cursor: pointer; border-radius: 6px; }
.hbar.clickable:hover { background: var(--surface-subdued); }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: #f1f1f1; border-radius: 5px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: #303030; border-radius: 5px; }
.hbar-value { font-size: 12px; color: var(--text-subdued); min-width: 64px; text-align: right; }

/* the person on the account, and booking a call */
.avatar { flex: none; border-radius: 50%; background: #1f3a5f; color: #fff; display: grid; place-items: center; font-weight: 650; overflow: hidden; letter-spacing: 0.02em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.engineer { display: flex; gap: 16px; align-items: center; }
.engineer-main { flex: 1; min-width: 0; }
.engineer-kicker { font-size: 12px; font-weight: 650; color: var(--text-subdued); text-transform: uppercase; letter-spacing: 0.04em; }
.engineer-name { font-size: 18px; font-weight: 650; line-height: 1.3; }
.engineer-actions { flex: none; }
.contact-lines { display: flex; gap: 6px 20px; flex-wrap: wrap; margin-top: 8px; }
.contact-line { display: inline-flex; gap: 6px; align-items: baseline; font-weight: 550; overflow-wrap: anywhere; }
.contact-kind { font-size: 12px; font-weight: 650; color: var(--text-subdued); }
.meeting { display: flex; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--divider); align-items: flex-start; }
.meeting:last-child { border-bottom: 0; }
.meeting-date { flex: none; width: 48px; border-radius: 8px; background: var(--surface-subdued); box-shadow: 0 0 0 1px var(--border); text-align: center; padding: 4px 0 6px; }
.meeting-month { font-size: 11px; font-weight: 650; text-transform: uppercase; color: var(--text-subdued); }
.meeting-day { font-size: 20px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.meeting-main { flex: 1; min-width: 0; }
.meeting-actions { flex: none; justify-content: flex-end; }
.booking { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: 12px; font-weight: 650; color: var(--text-subdued); text-align: center; padding: 2px 0 4px; }
.cal-day { border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--border); border-radius: 8px; min-height: 58px; padding: 4px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0; color: var(--text); font: inherit; position: relative; }
.cal-day:hover:not(:disabled) { background: #f1f1f1; }
.cal-day:disabled { background: var(--surface-subdued); color: var(--text-disabled); cursor: default; box-shadow: none; }
.cal-day.selected { background: #303030; color: #fff; box-shadow: none; }
.cal-month { font-size: 10px; font-weight: 650; text-transform: uppercase; height: 12px; line-height: 12px; }
.cal-num { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-open { font-size: 11px; height: 14px; color: var(--success-text); }
.cal-day.selected .cal-open { color: #fff; }
.cal-day.booked::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--info); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 268px; overflow-y: auto; padding: 1px; }
.slot { border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong); border-radius: 8px; padding: 7px 4px; cursor: pointer; font: inherit; font-weight: 550; font-variant-numeric: tabular-nums; color: var(--text); }
.slot:hover { background: #f1f1f1; }
.slot.selected { background: #303030; color: #fff; box-shadow: none; }
@media (max-width: 720px) {
  .booking { grid-template-columns: 1fr; }
  .engineer { flex-wrap: wrap; }
  .meeting { flex-wrap: wrap; }
  .cal-open { font-size: 10px; }
}

/* plans, side by side */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }
.plan { display: flex; }
.plan.featured { outline: 2px solid #303030; outline-offset: -1px; border-radius: 12px; }
.plan-body { display: flex; flex-direction: column; flex: 1; }
.plan-name { font-size: 16px; font-weight: 650; margin: 0; }
.plan-price { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 4px; }
.plan-amount { font-size: 30px; line-height: 36px; font-weight: 650; letter-spacing: -0.5px; }
.plan-points { flex: 1; align-content: start; }
.plan-foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider); }
.promo-points { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.promo-points li { display: flex; gap: 8px; align-items: flex-start; }
.promo-tick { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--success-bg); color: var(--success-text); display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 1px; }

/* the catalog of places sales come from */
.connectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.connector { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.connector-head { display: flex; gap: 12px; align-items: center; }
.connector-logo { flex: none; width: 36px; height: 36px; border-radius: 8px; background: #303030; color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 16px; }
.connector-about { flex: 1; margin: 0; font-size: 13px; }

/* code samples */
.code-block { background: #1a1a1a; color: #e3e3e3; border-radius: 8px; padding: 12px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; margin: 0; white-space: pre; }
.code-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 16px; }
code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-subdued); padding: 1px 5px; border-radius: 4px; }
.code-block code { background: none; padding: 0; }

/* Taxcat AI: what it found, and the sidebar. Plain surfaces; no purple and no sparkle, which belong to Shopify's own AI. */
.ai-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-radius: 12px; background: var(--surface-subdued); box-shadow: 0 0 0 1px var(--border) inset; }
.ai-banner > div:first-child { flex: 1; min-width: 260px; }
.ai-brief { padding: 10px 12px; border-radius: 8px; background: var(--surface-subdued); }
.ai-findings { margin-top: 8px; }
.ai-finding { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--divider); }
.ai-finding:first-child { border-top: 0; }
.ai-finding .kpi-dot { margin-top: 7px; flex: none; }
.ai-finding .alert-body { flex: 1; min-width: 0; }
.precheck { padding: 12px; border-radius: 8px; background: var(--surface-subdued); box-shadow: 0 0 0 1px var(--border) inset; }
.precheck-list { margin-top: 10px; background: #fff; border-radius: 8px; padding: 4px 12px; }
.precheck-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--divider); }
.precheck-row:first-child { border-top: 0; }
.precheck-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.precheck-mark.ok { background: var(--success-bg); color: var(--success-text); }
.precheck-mark.warn { background: var(--warning-bg); color: var(--warning-text); }
.precheck-mark.info { background: var(--info-bg); color: var(--info-text); }
.ai-launcher { position: fixed; right: 20px; bottom: 20px; z-index: 400; }
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); z-index: 500; display: flex; flex-direction: column; background: var(--surface); box-shadow: -1px 0 0 var(--border), -8px 0 24px rgba(0, 0, 0, 0.08); }
.ai-panel.over { outline: 2px dashed var(--link); outline-offset: -6px; }
.ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--divider); background: var(--surface-subdued); }
.ai-list-wrap { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface-subdued); }
.ai-msg.user { align-self: flex-end; background: var(--info-bg); color: var(--info-text); }
.ai-msg.error { background: var(--critical-bg); color: var(--critical-text); }
.ai-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ai-card { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-foot { padding: 12px 16px 14px; border-top: 1px solid var(--divider); display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 1500px) { body.ai-open .main { margin-right: 400px; } }
