/* Master Tax office: design tokens, base elements and app shell.
   Direction: Runey (see DESIGN.md). Every color, size and radius comes from the tokens below. */

@font-face{font-family:Poppins;src:url(fonts/poppins-latin-400-normal.woff2) format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:Poppins;src:url(fonts/poppins-latin-500-normal.woff2) format('woff2');font-weight:500;font-display:swap}
@font-face{font-family:Poppins;src:url(fonts/poppins-latin-600-normal.woff2) format('woff2');font-weight:600;font-display:swap}
@font-face{font-family:Poppins;src:url(fonts/poppins-latin-700-normal.woff2) format('woff2');font-weight:700;font-display:swap}
@font-face{font-family:'Playfair Display';src:url(fonts/playfair-display-latin-400-normal.woff2) format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:'Playfair Display';src:url(fonts/playfair-display-latin-600-normal.woff2) format('woff2');font-weight:600;font-display:swap}
@font-face{font-family:'Geist Mono';src:url(fonts/geist-mono-latin-wght-normal.woff2) format('woff2-variations');font-weight:100 900;font-display:swap}

:root{
  /* Type. Playfair is for printed/document views only. */
  --font-sans:Poppins,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --font-doc:'Playfair Display',Georgia,serif;
  --font-mono:'Geist Mono',ui-monospace,Menlo,monospace;
  --text-xs:12px;--text-sm:13px;--text-md:14px;--text-lg:17px;--text-xl:21px;--text-2xl:28px;--text-kpi:28px;--text-money:32px;

  /* Surfaces */
  --canvas:#f5f5f5;      /* the desk everything sits on */
  --surface:#ffffff;     /* cards */
  --well:#f5f5f5;        /* fills inside cards: segmented controls, chips */
  --rail:#1a1a1a;        /* navigation rail */
  --rail-2:#2e2e2e;      /* rail buttons */

  /* Ink */
  --ink:#1a1a1a;--ink-2:#6b6b6b;--ink-3:#767676;   /* ink-2 and ink-3 pass 4.5:1 on white and on the desk */
  --line:#ebebeb;--line-strong:#dedede;--field:#b8b8b8;   /* field and control outlines */

  /* The raised black pill: primary action only */
  --accent:linear-gradient(180deg,#3b3b3b,#232323);--accent-flat:#292929;--accent-ink:#ffffff;
  --shadow-raised:inset 0 1px 0 rgba(255,255,255,.22),inset 0 -1px 0 rgba(0,0,0,.12),0 1px 3px rgba(41,41,41,.4),0 4px 12px -4px rgba(41,41,41,.35);
  --shadow-soft:0 1px 2px rgba(0,0,0,.05);
  --shadow-pop:0 1px 2px rgba(0,0,0,.06),0 24px 48px -16px rgba(0,0,0,.25);
  --focus:#1a1a1a;

  /* Money states. Green means money collected; nothing else uses it. */
  --pos:#3f7d12;--pos-bg:#ecfccb;--pos-bar:linear-gradient(90deg,#bef264,#65a30d);
  --warn:#b45309;--warn-bg:#fef3c7;
  --neg:#b91c1c;--neg-bg:#fee2e2;

  /* Shape and rhythm */
  --r-pill:9999px;--r-card:16px;--r-inner:12px;--r-sm:8px;
  --gutter:24px;--gap:12px;--rail-w:64px;--rail-inset:8px;
  }

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;background:var(--canvas)}
body{margin:0;font-family:var(--font-sans);font-size:var(--text-md);line-height:1.5;color:var(--ink);background:var(--canvas);-webkit-font-smoothing:antialiased;font-synthesis:none}
button,input,select,textarea{font:inherit;color:inherit}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
h1{margin:0;font-size:var(--text-2xl);line-height:1.2;font-weight:600;letter-spacing:-.02em;text-wrap:balance}
h2{margin:0;font-size:var(--text-lg);line-height:1.3;font-weight:600;letter-spacing:-.01em}
h3{margin:0;font-size:var(--text-md);font-weight:600}
p{line-height:1.6;text-wrap:pretty}
a{color:var(--ink);text-decoration:underline;text-decoration-color:var(--line-strong);text-underline-offset:3px}
a:hover{text-decoration-color:currentColor}
.mono,code{font-family:var(--font-mono);font-size:.92em}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Buttons: white pills by default, one raised black pill for the main action */
button{cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px;height:36px;padding:0 16px;border:1px solid var(--line);border-radius:var(--r-pill);background:var(--surface);color:var(--ink);font-size:var(--text-sm);font-weight:500;white-space:nowrap;box-shadow:var(--shadow-soft);transition:background .15s,box-shadow .15s,transform .05s}
button:hover{background:#fafafa}
button:active{transform:translateY(1px)}
button.primary{border:0;background:var(--accent);color:var(--accent-ink);box-shadow:var(--shadow-raised)}
button.primary:hover{background:linear-gradient(180deg,#474747,#2b2b2b)}
button.ghost{border-color:transparent;background:transparent;box-shadow:none}
button.ghost:hover{background:var(--well)}
button.link{height:auto;padding:0;border:0;border-radius:4px;background:none;box-shadow:none;color:var(--ink);font-weight:500;text-align:left;white-space:normal;justify-content:flex-start}
button.link:hover{background:none;text-decoration:underline;text-decoration-color:var(--line-strong);text-underline-offset:3px}
button:disabled{cursor:default;opacity:.45;transform:none}
button:focus-visible,a:focus-visible,summary:focus-visible,select:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.icon-btn{width:36px;padding:0}

/* Fields: rounded, soft */
input,select,textarea{background:var(--surface);border:1px solid var(--field);border-radius:var(--r-inner);color:var(--ink)}
input::placeholder,textarea::placeholder{color:var(--ink-3)}
input:focus,select:focus,textarea:focus{outline:0;border-color:var(--ink);box-shadow:0 0 0 3px rgba(26,26,26,.08)}
select{appearance:none;-webkit-appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%231a1a1a' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;padding-right:34px!important}

.ico{width:18px;height:18px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}

/* Text helpers */
.muted,.sub{color:var(--ink-2)}
.sub{margin-top:4px;font-size:var(--text-sm)}
.under{display:block;margin-top:2px;color:var(--ink-2);font-size:var(--text-xs)}
.eyebrow{font-size:var(--text-sm);color:var(--ink-2);font-weight:400}
.num,.amount{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.positive{color:var(--pos)}

/* Status pills */
.badge{display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 10px;border-radius:var(--r-pill);background:var(--well);color:var(--ink-2);font-size:var(--text-xs);font-weight:500;white-space:nowrap;border:0}
.badge.green{background:var(--pos-bg);color:var(--pos)}
.badge.amber,.badge.warn{background:var(--warn-bg);color:var(--warn)}
.badge.red{background:var(--neg-bg);color:var(--neg)}
.badge.blue{background:var(--well);color:var(--ink-2)}
.badge.dark{background:var(--ink);color:#fff}

/* App shell: floating black rail + canvas */
.app{min-height:100vh;padding-left:calc(var(--rail-w) + var(--rail-inset) * 2)}
.sidebar{position:fixed;z-index:20;top:var(--rail-inset);bottom:var(--rail-inset);left:var(--rail-inset);width:var(--rail-w);display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 0;border-radius:22px;background:var(--rail);color:#fff}
.brand{display:grid;place-items:center;margin-bottom:6px;font-size:0}
.brandmark{display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:#fff;color:var(--rail);font-size:17px;font-weight:700;letter-spacing:-.04em}
.rail-add{position:relative;width:36px;height:36px;padding:0;margin-bottom:10px;border:0;border-radius:50%;background:var(--rail-2);color:#fff;box-shadow:none}
.rail-add:hover{background:#3a3a3a}
.sidebar nav{display:grid;gap:6px}
.nav,.rail-link{display:grid;place-items:center;position:relative;width:42px;height:42px;padding:0;border:0;border-radius:50%;background:transparent;color:rgba(255,255,255,.62);box-shadow:none}
.nav:hover,.rail-link:hover{background:var(--rail-2);color:#fff}
.nav.active{background:#fff;color:var(--rail)}
.nav .ico,.rail-link .ico{width:19px;height:19px}
.nav-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:is(.nav,.rail-link,.rail-add)[data-tip]:is(:hover,:focus-visible)::after{content:attr(data-tip);position:absolute;left:54px;top:50%;transform:translateY(-50%);padding:6px 12px;border-radius:var(--r-pill);background:var(--rail);color:#fff;font-size:var(--text-xs);font-weight:500;white-space:nowrap;box-shadow:var(--shadow-pop);pointer-events:none;animation:tip .15s .35s both}
@keyframes tip{from{opacity:0}to{opacity:1}}
.nav.active:hover::after{display:none}
.sidebar :focus-visible{outline-color:#fff}
.nav .count{position:absolute;top:2px;right:0;min-width:16px;height:16px;padding:0 4px;border-radius:var(--r-pill);background:#fff;color:var(--rail);font-size:10px;font-weight:600;line-height:16px}
.sidebar-bottom{margin-top:auto;display:grid;justify-items:center;gap:6px}
.demo-panel{display:grid;gap:6px;justify-items:center}
.user{display:grid;place-items:center;margin-top:6px}
.user>div{display:none}
.avatar{display:inline-grid;place-items:center;flex-shrink:0;width:34px;height:34px;border-radius:50%;background:#f3e8d6;color:#6b4f1d;font-size:12px;font-weight:600;text-transform:uppercase}
.sidebar .avatar{box-shadow:0 0 0 2px var(--rail),0 0 0 3px rgba(255,255,255,.35)}

.workspace{min-width:0;padding:0 var(--gutter) 96px 8px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;height:68px}
.crumb{display:flex;align-items:center;gap:10px;min-width:0;font-size:var(--text-sm);color:var(--ink-2)}
.crumb .ico{display:none}
.crumb strong{font-weight:500;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crumb .back{width:36px;height:36px;padding:0;border-radius:50%}
.crumb .back .ico{display:block}
.separator{display:none}
.top-right{display:flex;align-items:center;gap:8px}
.date{margin-right:6px;color:var(--ink-2);font-size:var(--text-sm)}
.top-right .icon-btn{width:36px}

/* Page header */
.pagehead{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:16px;padding:4px 0 20px}
.pagehead .sub{font-size:var(--text-md)}
.actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}

/* Cards */
.card{background:var(--surface);border-radius:var(--r-card);padding:22px 24px;box-shadow:var(--shadow-soft)}
.card+.card{margin-top:var(--gap)}
.card-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.card-head h2{font-size:var(--text-lg)}
.card-head .sub{margin-top:2px}

/* Money cards (Runey KPI) */
.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--gap);margin-bottom:var(--gap)}
.kpi{display:flex;flex-direction:column;min-height:132px;padding:18px 20px;border-radius:var(--r-card);background:var(--surface);box-shadow:var(--shadow-soft)}
.kpi-top{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:28px}
.kpi-top:has(.owes-amount){flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:0}
.kpi-icon{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;border:1px solid var(--line);color:var(--ink-2)}
.kpi-icon .ico{width:14px;height:14px}
.kpi-value,.kpi .owes-amount{margin:10px 0 0;font-size:var(--text-kpi);line-height:1.1;font-weight:600;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.kpi .sub{margin-top:auto;padding-top:10px;font-size:var(--text-xs)}
.meter{display:flex;align-items:center;gap:10px;margin-top:12px}
.meter progress{flex:1;height:8px;border:0;border-radius:var(--r-pill);background:var(--well);overflow:hidden;appearance:none;-webkit-appearance:none}
.meter progress::-webkit-progress-bar{background:var(--well);border-radius:var(--r-pill)}
.meter progress::-webkit-progress-value{background:var(--ink);border-radius:var(--r-pill)}
.meter progress::-moz-progress-bar{background:var(--ink);border-radius:var(--r-pill)}
.meter.paid progress::-webkit-progress-value{background:var(--pos-bar)}
.meter.paid progress::-moz-progress-bar{background:var(--pos-bar)}
.meter span{color:var(--ink-2);font-size:var(--text-xs);font-variant-numeric:tabular-nums}

/* Toolbar and tables (inside cards) */
.toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.pager{display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:14px 16px;border-top:1px solid var(--line);color:var(--ink-2);font-size:var(--text-sm)}

.search{display:flex;align-items:center;gap:8px;width:260px;height:36px;padding:0 14px;border:1px solid var(--field);border-radius:var(--r-pill);background:var(--surface);color:var(--ink-3)}
.search .ico{width:16px;height:16px}
.search input{width:100%;min-width:0;height:100%;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none!important}
.search:focus-within{border-color:var(--ink);box-shadow:0 0 0 3px rgba(26,26,26,.08)}
.toolbar select{height:36px;padding:0 14px;border-radius:var(--r-pill);font-size:var(--text-sm);font-weight:500;box-shadow:var(--shadow-soft)}
.toolbar .right{color:var(--ink-2);font-size:var(--text-sm)}
.table-wrap{overflow-x:auto;margin:0 -24px}
table{width:100%;border-collapse:collapse;text-align:left}
th{height:40px;padding:0 12px;border-bottom:1px solid var(--line);color:var(--ink-2);font-size:var(--text-xs);font-weight:500;white-space:nowrap}
td{padding:14px 12px;border-bottom:1px solid var(--line);vertical-align:middle;font-size:var(--text-sm)}
tr:last-child td{border-bottom:0}
th:first-child,td:first-child{padding-left:24px}
th:last-child,td:last-child{padding-right:24px}
.client-row{cursor:pointer;transition:background .12s}
.client-row:hover{background:#fafafa}
.client-name{display:flex;align-items:center;gap:12px}
.client-name .link,.client-name button{color:var(--ink);font-weight:500;font-size:var(--text-md)}
.tile{display:grid;place-items:center;flex-shrink:0;width:36px;height:36px;border-radius:50%;background:#ececec;color:#3d3d3d;font-size:12px;font-weight:600;letter-spacing:.02em;border:0}
.tile.lg{width:64px;height:64px;font-size:21px}
.tile.t1{background:#fde4e4;color:#8a2a2a}.tile.t2{background:#e4f4e8;color:#245c35}.tile.t3{background:#f3e8d6;color:#6b4f1d}.tile.t4{background:#fde7d6;color:#8a4b1f}.tile.t5{background:#efe9df;color:#5c4a2e}
.service-text{color:var(--ink-2)}
.owner{display:flex;align-items:center;gap:8px;color:var(--ink-2);font-size:var(--text-sm)}
.owner .avatar{width:24px;height:24px;font-size:10px}
.bottomline{padding:14px 0 0;color:var(--ink-3);font-size:var(--text-xs)}
.hide-md{}

/* Toast: white card, bottom right */
#toast{position:fixed;right:24px;bottom:24px;z-index:100;display:flex;align-items:center;gap:10px;max-width:420px;padding:14px 18px 14px 14px;border-radius:var(--r-inner);background:var(--surface);color:var(--ink);font-size:var(--text-sm);font-weight:500;box-shadow:var(--shadow-pop);opacity:0;transform:translateY(12px);pointer-events:none;transition:opacity .2s,transform .2s}
#toast::before{content:'';flex-shrink:0;width:20px;height:20px;border-radius:50%;background:var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center/12px no-repeat}
#toast.visible{opacity:1;transform:none}
.mobile-brand{display:none}

@media(max-width:1100px){.hide-md{display:none}}
@media(max-width:1000px){.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(pointer:coarse){button.link{min-height:40px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important}}
@media(max-width:800px){
  :root{--gutter:14px;--text-2xl:24px}
  .app{padding-left:0}
  .sidebar{top:auto;bottom:10px;left:10px;right:10px;width:auto;height:68px;flex-direction:row;justify-content:space-around;padding:0 8px}
  .brand,.rail-add,.sidebar-bottom{display:none}
  .sidebar nav{display:flex;flex:1;justify-content:space-around}
  .nav[data-tip]:is(:hover,:focus-visible)::after{display:none}
  .nav{width:auto;min-width:68px;height:54px;padding:0 6px;border-radius:16px;gap:3px;align-content:center}
  .nav-label{position:static;width:auto;height:auto;clip:auto;font-size:10px;line-height:1.1;font-weight:500}
  .workspace{padding:0 var(--gutter) 100px}
  .topbar{height:60px}
  .date{display:none}
  .search{width:100%}
  .toolbar .right{display:none}
  .table-wrap table{min-width:640px}
  .card{padding:18px 16px}
  .table-wrap{margin:0 -16px}
  th:first-child,td:first-child{padding-left:16px}
}
