:root{
    --ink:#1D2B4F; --paper:#F5F6F1; --paper-raised:#FFFFFF; --rule:#DBDFD6;
    --emerald:#0F6B5C; --emerald-dark:#0B5347; --amber:#C97C2E; --muted:#6B7280; --danger:#B3452F;
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  body{ font-family:'Inter', sans-serif; background:var(--paper); color:var(--ink); min-height:100vh; }
  .app{display:flex; min-height:100vh;}
  .sidebar{ width:240px; background:var(--ink); color:#EDEFE9; display:flex; flex-direction:column; flex-shrink:0; }
  .brand{ padding:28px 24px 20px; border-bottom:1px solid rgba(255,255,255,0.1); }
  .brand-mark{ font-family:'Lora', serif; font-style:italic; font-size:22px; font-weight:600; letter-spacing:0.3px; }
  .brand-sub{ font-family:'IBM Plex Mono', monospace; font-size:10px; letter-spacing:1.5px; color:#9BA6C4; margin-top:4px; text-transform:uppercase; }
  .nav{padding:16px 12px; flex:1;}
  .nav-item{ display:flex; align-items:center; gap:10px; padding:11px 14px; border-radius:6px; color:#C9CFDE; font-size:14px; font-weight:500; cursor:pointer; margin-bottom:2px; transition:background 0.15s; }
  .nav-item:hover{background:rgba(255,255,255,0.06);}
  .nav-item.active{background:var(--emerald); color:#fff;}
  .nav-num{ font-family:'IBM Plex Mono', monospace; font-size:11px; color:#7C86A5; width:18px; }
  .nav-item.active .nav-num{color:rgba(255,255,255,0.7);}
  .sidebar-user{ padding:14px 24px; border-top:1px solid rgba(255,255,255,0.1); font-size:12px; }
  .sidebar-user button{ background:none; border:none; color:#9BA6C4; font-size:11px; cursor:pointer; margin-top:6px; padding:0; text-decoration:underline; }
  .main{flex:1; padding:36px 44px; max-width:1180px;}
  .page-head{margin-bottom:28px;}
  .page-title{ font-family:'Lora', serif; font-size:28px; font-weight:600; }
  .page-desc{color:var(--muted); font-size:14px; margin-top:4px;}
  .hidden{display:none !important;}
  .stats{display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:32px;}
  .stat-card{ background:var(--paper-raised); border:1px solid var(--rule); border-radius:4px; padding:20px 22px; position:relative; }
  .stat-card::before{ content:''; position:absolute; top:0; left:0; bottom:0; width:3px; background:var(--emerald); }
  .stat-card.has-issues::before{ background:var(--danger); }
  .stat-card.has-issues .stat-value{ color:var(--danger); }
  .stat-label{ font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); font-weight:600; }
  .stat-value{ font-family:'IBM Plex Mono', monospace; font-size:32px; font-weight:500; margin-top:8px; }
  .section-card{ background:var(--paper-raised); border:1px solid var(--rule); border-radius:4px; padding:0; margin-bottom:24px; }
  .section-card-head{ padding:18px 22px; border-bottom:1px solid var(--rule); display:flex; align-items:center; justify-content:space-between; }
  .section-card-title{font-weight:600; font-size:15px;}
  .btn{ font-family:'Inter', sans-serif; font-size:13px; font-weight:600; padding:9px 16px; border-radius:5px; border:none; cursor:pointer; transition:background 0.15s; }
  .btn-primary{background:var(--emerald); color:#fff;}
  .btn-primary:hover{background:var(--emerald-dark);}
  .btn-primary:disabled{background:#9BB8B2; cursor:not-allowed;}
  .btn-ghost{background:transparent; color:var(--ink); border:1px solid var(--rule);}
  .btn-ghost:hover{background:var(--paper);}
  table{width:100%; border-collapse:collapse;}
  thead th{ text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:0.6px; color:var(--muted); font-weight:600; padding:12px 22px; border-bottom:1px solid var(--rule); }
  tbody td{ padding:14px 22px; font-size:14px; border-bottom:1px solid var(--rule); }
  tbody tr:last-child td{border-bottom:none;}
  .ledger-no{font-family:'IBM Plex Mono', monospace; color:var(--muted); font-size:13px;}
  .client-name{font-weight:600;}
  .tag{ display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:600; background:rgba(15,107,92,0.1); color:var(--emerald-dark); }
  .tag-entity{ display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:600; background:rgba(29,43,79,0.08); color:var(--ink); }
  .service-tags{display:flex; flex-wrap:wrap; gap:5px; max-width:260px;}
  .empty-state{ padding:60px 22px; text-align:center; color:var(--muted); }
  .empty-state-title{font-family:'Lora', serif; font-size:17px; color:var(--ink); margin-bottom:6px;}
  .form-panel{ background:var(--paper-raised); border:1px solid var(--rule); border-radius:4px; padding:24px 26px; margin-bottom:24px; }
  .form-grid{display:grid; grid-template-columns:1fr 1fr; gap:16px;}
  .field{display:flex; flex-direction:column; gap:6px;}
  .field label{font-size:12px; font-weight:600; color:var(--muted);}
  .field input, .field select, .field textarea{ font-family:'Inter', sans-serif; font-size:14px; padding:9px 12px; border:1px solid var(--rule); border-radius:5px; background:var(--paper); color:var(--ink); }
  .field input:focus, .field select:focus, .field textarea:focus{ outline:2px solid var(--emerald); outline-offset:1px; border-color:var(--emerald); }
  .form-actions{display:flex; gap:10px; margin-top:18px;}
  .service-grid{ display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; margin-top:6px; }
  .service-chip{ display:flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid var(--rule); border-radius:5px; font-size:12.5px; font-weight:500; cursor:pointer; background:var(--paper); }
  .service-chip input{width:14px; height:14px; accent-color:var(--emerald); flex-shrink:0;}
  .service-chip:has(input:checked){ border-color:var(--emerald); background:rgba(15,107,92,0.08); }
  .client-checklist{padding:14px 22px;}
  .check-row{ display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--rule); }
  .check-row:last-child{border-bottom:none;}
  .check-row input{width:16px; height:16px; accent-color:var(--emerald);}
  .toast{ position:fixed; bottom:26px; right:26px; background:var(--ink); color:#fff; padding:14px 20px; border-radius:6px; font-size:13px; font-weight:500; box-shadow:0 8px 24px rgba(0,0,0,0.2); display:flex; align-items:center; gap:10px; animation:slideIn 0.25s ease; z-index:50; }
  @keyframes slideIn{from{transform:translateY(12px); opacity:0;} to{transform:translateY(0); opacity:1;}}
  .history-item{padding:16px 22px; border-bottom:1px solid var(--rule);}
  .history-item:last-child{border-bottom:none;}
  .history-meta{font-family:'IBM Plex Mono', monospace; font-size:11px; color:var(--muted); margin-bottom:4px;}
  .history-msg{font-size:14px;}
  .center-screen{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--paper); }
  .auth-card{ background:var(--paper-raised); border:1px solid var(--rule); border-radius:6px; padding:36px 34px; width:360px; }
  .auth-title{ font-family:'Lora', serif; font-size:24px; font-weight:600; margin-bottom:4px; }
  .auth-sub{ color:var(--muted); font-size:13px; margin-bottom:22px; }
  .auth-card .field{margin-bottom:14px;}
  .auth-toggle{ font-size:12.5px; color:var(--muted); margin-top:14px; text-align:center; }
  .auth-toggle a{ color:var(--emerald-dark); cursor:pointer; font-weight:600; text-decoration:none; }
  .config-note{ font-size:12px; color:var(--danger); background:rgba(179,69,47,0.08); border:1px solid rgba(179,69,47,0.25); padding:10px 12px; border-radius:5px; margin-bottom:18px; line-height:1.5; }
  .config-note code{ font-family:'IBM Plex Mono', monospace; font-size:11px; }
  .row-actions{display:flex; gap:6px;}
  .row-btn{ background:none; border:1px solid var(--rule); border-radius:4px; padding:5px 10px; font-size:11.5px; font-weight:600; cursor:pointer; color:var(--ink); }
  .row-btn:hover{background:var(--paper);}
  .row-btn.danger{color:var(--danger); border-color:rgba(179,69,47,0.3);}
  .row-btn.danger:hover{background:rgba(179,69,47,0.06);}
  .detail-tab{ padding:8px 16px; border-radius:20px; border:1px solid var(--rule); font-size:13px; font-weight:600; cursor:pointer; background:var(--paper-raised); }
  .detail-tab.active{ background:var(--ink); color:#fff; border-color:var(--ink); }
  .subtab{ padding:7px 14px; border-radius:20px; border:1px solid var(--rule); font-size:12.5px; font-weight:600; cursor:pointer; background:var(--paper); }
  .subtab.active{ background:var(--emerald); color:#fff; border-color:var(--emerald); }
  .subtab.suggested{ border-style:dashed; color:var(--muted); background:transparent; }
  .subtab.suggested.active{ border-style:solid; background:var(--emerald); color:#fff; }
  .status-badge{ display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
  .status-badge.pending{ background:rgba(201,124,46,0.12); color:var(--amber); }
  .status-badge.filed{ background:rgba(15,107,92,0.12); color:var(--emerald-dark); }
  .status-badge.expired{ background:rgba(179,69,47,0.12); color:var(--danger); }
  .status-badge.soon{ background:rgba(201,124,46,0.12); color:var(--amber); }
  .status-badge.active{ background:rgba(15,107,92,0.12); color:var(--emerald-dark); }
  .status-badge.none{ background:rgba(107,114,128,0.12); color:var(--muted); }
  .filing-row{ display:flex; align-items:center; justify-content:space-between; padding:14px 22px; border-bottom:1px solid var(--rule); gap:16px; }
  .filing-row:last-child{border-bottom:none;}
  .filing-main{flex:1;}
  .filing-period{font-weight:600; font-size:14px;}
  .filing-meta{font-size:12px; color:var(--muted); margin-top:2px;}
  .filing-notes{font-size:12.5px; color:var(--muted); margin-top:4px; font-style:italic; white-space:pre-line;}
  .filing-actions{display:flex; gap:6px; align-items:center; flex-shrink:0;}
  .reg-card{ padding:16px 22px; border-bottom:1px solid var(--rule); cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:16px; }
  .reg-card:last-child{border-bottom:none;}
  .reg-card:hover{background:var(--paper);}
  .reg-main{flex:1;}
  .reg-label{font-weight:600; font-size:14px;}
  .reg-meta{font-size:12px; color:var(--muted); margin-top:3px;}
  .reg-actions{display:flex; gap:6px; flex-shrink:0;}

  .alert-banner{ border:1px solid var(--rule); border-radius:4px; overflow:hidden; }
  .alert-banner-head{ padding:12px 18px; font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; }
  .alert-banner-head.danger{ background:rgba(179,69,47,0.1); color:var(--danger); }
  .alert-banner-head.warn{ background:rgba(201,124,46,0.1); color:var(--amber); }
  .alert-item{ display:flex; align-items:center; justify-content:space-between; padding:12px 18px; border-top:1px solid var(--rule); background:var(--paper-raised); cursor:pointer; gap:12px; }
  .alert-item:hover{ background:var(--paper); }
  .alert-item-main{font-size:13.5px;}
  .alert-item-main strong{font-weight:600;}
  .alert-item-when{font-family:'IBM Plex Mono', monospace; font-size:11.5px; color:var(--muted); white-space:nowrap;}
  .alert-item-when.danger{color:var(--danger);}
  .alert-item-when.warn{color:var(--amber);}
  .view-tabs{display:flex; gap:8px; margin-bottom:20px;}
