:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #000000;
    --accent-hover: #1a1a1a;
    --accent-light: #f5f5f5;
    --accent-border: #d4d4d4;
    --accent-muted: #404040;
    --accent-rgb: 0, 0, 0;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 10px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.12);
    --sidebar-width: 260px;
    --topbar-height: 92px;
  }
  html {
    height: 100%;
  }
  html.pms-shell-open {
    overflow: hidden;
    height: 100%;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
  }
  body.pms-shell-open {
    overflow: hidden;
    height: 100%;
    width: 100%;
    position: fixed;
    inset: 0;
  }
  .hidden { display: none !important; }

  /* Global loader */
  .global-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
  }
  .loader-box {
    text-align: center;
    padding: 2rem 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
  }
  .loader-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  #loaderText { font-size: 0.9rem; color: var(--muted); font-weight: 500; }

  .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
  }
  .icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .app-shell {
    display: block;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg);
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 300;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .sidebar-head {
    flex-shrink: 0;
    margin-bottom: 1rem;
  }
  .sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.65rem 0.75rem;
    margin-top: 0.75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .sidebar-user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
  }
  .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.15rem;
    margin: 0 -0.15rem 0 0;
  }
  .sidebar-foot {
    flex-shrink: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
  }
  .main-wrap {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100dvh;
    padding-top: var(--topbar-height);
    overflow: hidden;
    background: #fafbfc;
  }
  .main-content {
    height: calc(100dvh - var(--topbar-height));
    min-height: 0;
    padding: 1.5rem 2rem 2rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .main-content [ng-view] {
    min-height: 200px;
  }
  .sidebar .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    color: var(--text);
  }
  .sidebar .brand .brand-text {
    letter-spacing: -0.02em;
  }
  .sidebar .role-badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    margin-bottom: 0;
    padding-left: 0.45rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
  }
  .role-badge.role-super_admin {
    color: #1e3a8a;
    background: #eff6ff;
    border-color: #bfdbfe;
  }
  .role-badge.role-accountant {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
  }
  .role-badge.role-admin {
    color: #9a3412;
    background: #ffedd5;
    border-color: #fed7aa;
  }
  .role-badge.role-client {
    color: #6b21a8;
    background: #f3e8ff;
    border-color: #e9d5ff;
  }
  a.nav-item {
    text-decoration: none;
    cursor: pointer;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.2rem;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
  }
  .nav-item .icon { width: 20px; height: 20px; opacity: 0.85; }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
  }
  .nav-item.active .icon { color: var(--accent); opacity: 1; }
  .main { flex: 1; padding: 1.5rem 2rem; overflow: auto; background: #fafbfc; }
  .main [ng-view] { min-height: 200px; }
  .login-page { min-height: 100vh; }
  .topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    width: calc(100% - var(--sidebar-width));
    z-index: 250;
    display: grid;
    grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr);
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 1rem 2rem;
    min-height: var(--topbar-height);
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  }
  .topbar-left h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .topbar-left {
    justify-self: start;
    min-width: 0;
  }
  .topbar-center {
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
  }
  .topbar-right {
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .topbar h1 {
    font-size: 1.35rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
  }
  .topbar h1 .icon { width: 26px; height: 26px; color: var(--accent); }
  .topbar-greeting {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.95rem;
    line-height: 1.3;
  }
  .greet-wish { color: var(--muted); font-weight: 400; }
  .greet-name { color: var(--text); font-weight: 600; }
  .topbar-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 7.5rem;
  }
  .clock-time {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    line-height: 1.2;
  }
  .clock-date {
    font-size: 0.65rem;
    color: var(--muted);
    line-height: 1.2;
    margin-top: 0.15rem;
  }
  .notif-wrap { position: relative; }
  .notif-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    box-shadow: var(--shadow);
  }
  .notif-btn .icon { width: 18px; height: 18px; color: var(--accent); }
  .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 999px;
  }
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-height: 108px;
  }
  .stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .stat-card .stat-icon .icon { width: 22px; height: 22px; }
  .stat-card .label, .stat-card .stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
  .stat-card .value, .stat-card .stat-value { display: block; font-size: 1.6rem; font-weight: 700; margin-top: 0.15rem; color: var(--text); }
  .stat-card .value.value-income, .stat-card .stat-value.value-income { color: var(--success); }
  .stat-card .value.value-expense, .stat-card .stat-value.value-expense { color: var(--danger); }
  .stat-card .stat-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.4;
  }
  .stat-card a.stat-hint-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
  }
  .stat-card a.stat-hint-link:hover { text-decoration: underline; }
  .stat-card-wide { grid-column: span 2; }
  .stat-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
  }
  .stat-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
  }
  .stat-chip.chip-draft { background: #f1f5f9; color: #475569; }
  .stat-chip.chip-sent { background: #dbeafe; color: #1e40af; }
  .stat-chip.chip-paid { background: #dcfce7; color: #166534; }
  @media (max-width: 640px) {
    .stat-card-wide { grid-column: span 1; }
  }

  .dashboard-charts-section {
    margin-bottom: 1.75rem;
  }
  .section-head {
    margin-bottom: 1.25rem;
  }
  .section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text);
  }
  .section-sub {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
  }
  .charts-loading {
    padding: 2rem;
    text-align: center;
  }
  .charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
  .chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem 1.25rem;
    box-shadow: var(--shadow);
    min-height: 340px;
    display: flex;
    flex-direction: column;
  }
  .chart-card-wide {
    grid-column: 1 / -1;
    min-height: 380px;
  }
  .chart-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--text);
  }
  .pms-chart-canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 200px;
  }
  .pms-chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
  }
  @media (max-width: 900px) {
    .charts-grid {
      grid-template-columns: 1fr;
    }
    .chart-card-wide {
      grid-column: auto;
    }
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
  }
  .card-title, .card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
  }
  .card-title .icon, .card h3 .icon { width: 22px; height: 22px; color: var(--accent); }
  .progress-wrap { margin: 0.75rem 0; }
  .progress-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.35rem; }
  .progress-bar {
    height: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-muted));
    border-radius: 999px;
    transition: width 0.4s ease;
  }
  label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; font-weight: 500; }
  input, select, textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
  }
  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
  }
  textarea { min-height: 90px; resize: vertical; }
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  }
  .btn:active:not(:disabled) { transform: scale(0.98); }
  .btn:disabled { opacity: 0.65; cursor: wait; }
  .btn .icon { width: 18px; height: 18px; }
  .btn-primary { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.25); }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-primary .icon { color: white; }
  .btn-ghost {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
  }
  .btn-ghost:hover { background: var(--surface2); }
  .btn-success { background: var(--success); color: white; }
  .btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
  .btn-sm .icon { width: 16px; height: 16px; }
  .btn-danger { background: var(--danger); color: white; }
  .btn-block { width: 100%; }
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
  th, td { padding: 0.65rem; text-align: left; border-bottom: 1px solid var(--border); }
  th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; background: var(--surface2); }
  .tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
  }
  .tag-open { background: var(--accent-light); color: var(--accent-hover); }
  .tag-pending { background: #fef3c7; color: #b45309; }
  .tag-resolved { background: #dcfce7; color: #15803d; }
  .login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(160deg, var(--accent-light) 0%, #ffffff 45%, #f8fafc 100%);
  }
  .login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
  }
  .login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
  }
  .login-brand .icon { width: 40px; height: 40px; color: var(--accent); }
  .login-box h1 { font-size: 1.4rem; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
  .login-box > p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
  .error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }
  .login-info { color: var(--success); font-size: 0.85rem; margin-bottom: 0.75rem; }
  .login-dev-otp {
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 0.85rem;
  }
  .login-role-hint {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: var(--muted);
  }
  .login-otp-input {
    font-size: 1.35rem;
    letter-spacing: 0.35em;
    text-align: center;
    font-weight: 700;
  }
  .login-otp-actions {
    margin-top: 0.75rem;
    justify-content: space-between;
  }
  .first-run-hint {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    font-size: 0.85rem;
  }
  .chat-box {
    height: 320px;
    overflow-y: auto;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
  }
  .chat-msg { margin-bottom: 0.85rem; max-width: 85%; }
  .chat-msg.mine { margin-left: auto; text-align: right; }
  .chat-msg-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
    font-size: 0.625rem;
    line-height: 1.25;
  }
  .chat-msg.mine .chat-msg-head { flex-direction: row-reverse; }
  .chat-sender {
    font-weight: 500;
    font-size: 0.625rem;
    color: var(--muted);
    white-space: nowrap;
  }
  .chat-msg.mine .chat-sender { color: var(--accent); opacity: 0.9; }
  .chat-time {
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 400;
    opacity: 0.85;
    white-space: nowrap;
  }
  .chat-inbox-table th:nth-child(3),
  .chat-inbox-table td:nth-child(3) {
    font-size: 0.65rem;
    color: var(--muted);
  }
  .chat-live-hint { font-size: 0.7rem; color: var(--muted); margin-bottom: 0.5rem; }
  .chat-msg .bubble {
    display: inline-block;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius);
    background: white;
    border: 1px solid var(--border);
    font-size: 0.9rem;
  }
  .chat-msg.mine .bubble { background: var(--accent); color: white; border-color: var(--accent); }
  .chat-input-row { display: flex; gap: 0.5rem; align-items: center; }
  .chat-input-row input { margin-bottom: 0; flex: 1; }
  .bot-reply {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface2);
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
  }
  .bot-panel {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
  }
  .bot-reply {
    background: white;
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
    white-space: pre-wrap;
    font-size: 0.9rem;
    border: 1px solid var(--border);
  }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  @media (max-width: 768px) {
    :root {
      --sidebar-width: 220px;
      --topbar-height: 168px;
    }
    .sidebar {
      position: fixed;
      width: var(--sidebar-width);
    }
    .main-wrap {
      margin-left: var(--sidebar-width);
      width: calc(100% - var(--sidebar-width));
    }
    .topbar {
      grid-template-columns: 1fr;
      padding: 0.85rem 1rem;
      gap: 0.65rem;
      width: calc(100% - var(--sidebar-width));
    }
    .topbar-left,
    .topbar-center,
    .topbar-right {
      justify-self: stretch;
    }
    .topbar-center {
      order: 2;
    }
    .topbar-right {
      order: 3;
      justify-content: flex-start;
    }
    .main-content {
      padding: 1rem;
    }
    .grid-2 { grid-template-columns: 1fr; }
  }
  .empty { color: var(--muted); font-size: 0.9rem; padding: 1rem 0; }
  .notif-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .notif-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
  }
  .notif-item:hover { background: var(--surface2); }
  .notif-item.unread { border-left: 3px solid var(--accent); background: var(--accent-light); }
  .checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    cursor: pointer;
  }
  .checkbox-row input { width: auto; margin: 0; }
  .btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
  .invoice-actions { margin-top: 0; }
  .invoice-actions .btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
  .invoice-template-card {
    margin-bottom: 1.25rem;
  }
  .invoice-template-preview {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
  }
  .invoice-template-image {
    display: block;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-lg);
  }
  .invoice-template-live {
    margin-top: 1.25rem;
  }
  .invoice-doc-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px 36px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
  }
  .billing-logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
  }
  .billing-logo-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    background: #fff;
    text-align: center;
  }
  .billing-logo-item img {
    display: block;
    max-width: 100%;
    max-height: 72px;
    margin: 0 auto 0.5rem;
    object-fit: contain;
  }
  .billing-logo-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.35;
  }
  .invoice-letterhead {
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  }
  .invoice-letterhead-logo img {
    max-height: 64px;
    max-width: 200px;
    margin-bottom: 0.75rem;
  }
  .invoice-letterhead-name {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
  }
  .invoice-number-preview {
    margin: 0 0 1rem;
    padding: 0.65rem 0.9rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.92rem;
  }
  .billing-signature-preview {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    max-width: 280px;
    text-align: center;
  }
  .billing-signature-preview img {
    display: block;
    max-height: 72px;
    max-width: 220px;
    margin: 0 auto 0.5rem;
  }
  .billing-signature-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .invoice-letterhead-address {
    margin: 0;
    line-height: 1.55;
    white-space: pre-line;
    color: var(--muted);
    font-size: 0.88rem;
  }
  .accountant-dashboard {
    margin-bottom: 1.5rem;
  }

  /* Hero */
  .accountant-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .accountant-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #334155 100%);
    opacity: 1;
  }
  .accountant-hero-inner {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem 1.65rem;
    color: #fff;
  }
  .accountant-hero-main {
    flex: 1;
    min-width: 220px;
  }
  .accountant-hero-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94a3b8;
  }
  .accountant-hero-title {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
  }
  .accountant-hero-sub {
    margin: 0 0 0.85rem;
    color: #cbd5e1;
    font-size: 0.92rem;
    max-width: 520px;
    line-height: 1.55;
  }
  .accountant-hero-sub strong {
    color: #f8fafc;
  }
  .accountant-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.78rem;
    font-weight: 600;
    color: #e2e8f0;
  }
  .hero-pill-warn { background: rgba(217, 119, 6, 0.25); border-color: rgba(251, 191, 36, 0.4); }
  .hero-pill-danger { background: rgba(220, 38, 38, 0.25); border-color: rgba(248, 113, 113, 0.4); }
  .accountant-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .btn-hero.btn-primary {
    background: #fff;
    color: #0f172a;
    border-color: #fff;
  }
  .btn-hero.btn-primary:hover {
    background: #f1f5f9;
  }
  .btn-hero.btn-ghost {
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
  }
  .btn-hero.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  /* Quick actions */
  .accountant-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.15rem;
  }
  .quick-action-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    color: inherit;
    font: inherit;
  }
  .quick-action-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
  }
  .quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .quick-action-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
  }
  .quick-action-text strong {
    font-size: 0.88rem;
    font-weight: 700;
  }
  .quick-action-text small {
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.35;
  }

  .accountant-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.45rem;
    margin-bottom: 0.35rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .accountant-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  }
  .accountant-tab:hover {
    background: #fff;
    color: var(--text);
  }
  .accountant-tab.is-active {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow);
  }
  .accountant-tab-desc {
    margin: 0 0 1rem;
    padding-left: 0.25rem;
    font-size: 0.82rem;
    color: var(--muted);
  }
  .accountant-tab-panel {
    margin-bottom: 1rem;
  }

  .card-elevated {
    box-shadow: var(--shadow);
    border-radius: 12px;
  }
  .card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  .card-head-row .card-title {
    margin: 0;
  }
  .card-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
  }
  .card-link:hover {
    text-decoration: underline;
  }
  .data-table-compact th,
  .data-table-compact td {
    padding: 0.45rem 0.55rem;
  }
  .data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .loading-spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto 0.65rem;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: accountant-spin 0.7s linear infinite;
  }
  @keyframes accountant-spin {
    to { transform: rotate(360deg); }
  }

  .accountant-attention {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
    padding: 1rem 1.15rem;
    border-color: #fcd34d;
    background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
  }
  .attention-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fef3c7;
    color: #b45309;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .attention-body strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
  }
  .attention-body p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
  }
  .link-btn {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
  }

  .stat-icon-dark {
    background: #0f172a !important;
    color: #fff !important;
  }
  .stat-icon-income {
    background: #dcfce7 !important;
    color: #166534 !important;
  }
  .stat-icon-expense {
    background: #fee2e2 !important;
    color: #991b1b !important;
  }

  /* Accounts workspace */
  .accounts-workspace {
    display: grid;
    grid-template-columns: 1fr minmax(300px, 360px);
    gap: 1rem;
    align-items: start;
  }
  .accounts-main {
    min-width: 0;
  }
  .accounts-sidebar {
    position: sticky;
    top: 1rem;
  }
  .accounts-summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: var(--surface2);
    font-size: 0.82rem;
    color: var(--muted);
  }
  .strip-divider {
    opacity: 0.5;
  }
  .client-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }
  .client-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .client-avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }
  .client-email-sub {
    display: block;
    font-size: 0.76rem;
    color: var(--muted);
    font-weight: 400;
  }
  .health-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .health-good { background: #dcfce7; color: #166534; }
  .health-warning { background: #fef3c7; color: #92400e; }
  .health-critical { background: #fee2e2; color: #991b1b; }
  .health-neutral { background: var(--surface2); color: var(--muted); }

  .client-detail-card {
    padding: 1.15rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
  }
  .client-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .client-detail-header h4 {
    margin: 0 0 0.15rem;
    font-size: 1.05rem;
  }
  .client-detail-email {
    margin: 0 0 0.45rem;
    font-size: 0.82rem;
    color: var(--muted);
  }
  .client-detail-header-inline {
    margin-bottom: 1rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
  }
  .client-detail-section {
    margin-bottom: 1rem;
  }
  .section-label {
    margin: 0 0 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .metric-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .metric-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-item {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
  }
  .metric-item-muted {
    background: #fff;
  }
  .metric-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.15rem;
  }
  .metric-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .metric-value-sm {
    font-size: 0.88rem;
  }
  .metric-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.1rem;
  }
  .agreement-panel {
    padding: 0.75rem;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px solid var(--border);
  }
  .agreement-title {
    margin: 0 0 0.25rem;
    font-size: 0.88rem;
    font-weight: 600;
  }
  .agreement-terms {
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.45;
  }
  .client-detail-error {
    color: var(--danger) !important;
    margin-bottom: 0.75rem;
  }
  .invoice-due-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .invoice-due-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
  }
  .invoice-due-list li:last-child {
    border-bottom: none;
  }
  .invoice-due-meta {
    display: block;
    font-size: 0.74rem;
    color: var(--muted);
  }
  .invoice-due-right {
    text-align: right;
    flex-shrink: 0;
  }
  .client-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
  }
  .client-detail-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: var(--surface2);
    color: var(--muted);
  }
  .client-detail-empty strong {
    display: block;
    margin: 0.65rem 0 0.35rem;
    color: var(--text);
    font-size: 0.95rem;
  }
  .client-detail-empty .icon {
    opacity: 0.45;
  }

  /* Schedule cards */
  .schedule-list-cards {
    display: grid;
    gap: 0.75rem;
  }
  .schedule-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    border-left: 4px solid var(--border);
  }
  .schedule-card-expiring_soon,
  .schedule-card-expiring-soon {
    border-left-color: #d97706;
    background: #fffbeb;
  }
  .schedule-card-expired {
    border-left-color: var(--danger);
    background: #fef2f2;
  }
  .schedule-card-active {
    border-left-color: var(--success);
  }
  .schedule-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .schedule-card-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
    color: var(--muted);
  }
  .schedule-summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: var(--surface2);
    font-size: 0.82rem;
    color: var(--muted);
  }
  .schedule-summary-strip .health-good strong { color: #166534; }
  .schedule-summary-strip .health-warning strong { color: #92400e; }
  .schedule-summary-strip .health-critical strong { color: #991b1b; }
  .payments-summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: var(--surface2);
    font-size: 0.82rem;
    color: var(--muted);
  }
  .payments-summary-strip .health-good strong { color: #166534; }
  .payments-summary-strip .health-critical strong { color: #991b1b; }
  .payments-forms-grid {
    margin-bottom: 1rem;
  }
  .payment-form-card label {
    display: block;
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: var(--muted);
  }
  .payment-form-card input {
    width: 100%;
    margin-top: 0.25rem;
  }
  .payment-form-card .btn {
    margin-top: 1rem;
  }
  .payment-form-income {
    border-top: 3px solid #16a34a;
  }
  .payment-form-expense {
    border-top: 3px solid #dc2626;
  }
  .payments-toolbar {
    margin: 0;
    flex-wrap: wrap;
  }
  .payments-ledger-card .invoice-list-head {
    align-items: flex-start;
    gap: 1rem;
  }
  .schedule-toolbar {
    margin-bottom: 0.75rem;
  }

  /* Notebook */
  .notebook-entry-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    margin-bottom: 0.65rem;
  }
  .notebook-client-tag {
    display: inline-block;
    padding: 1px 8px;
    margin-right: 0.35rem;
    border-radius: 999px;
    background: var(--accent-light);
    font-size: 0.72rem;
    font-weight: 600;
  }
  .notebook-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
  }
  .notebook-empty-state strong {
    display: block;
    margin: 0.65rem 0 0.35rem;
    color: var(--text);
  }
  .notebook-empty-state .icon {
    opacity: 0.4;
  }

  @media (max-width: 960px) {
    .accounts-workspace {
      grid-template-columns: 1fr;
    }
    .accounts-sidebar {
      position: static;
    }
    .hide-sm {
      display: none;
    }
    .metric-grid-3 {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  @media (max-width: 640px) {
    .accountant-hero-inner {
      padding: 1.15rem;
    }
    .accountant-quick-actions {
      grid-template-columns: 1fr 1fr;
    }
    .accountant-tab-label {
      display: none;
    }
    .accountant-tab {
      padding: 0.55rem 0.7rem;
    }
  }

  .data-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .data-page-size,
  .data-filter-client {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .data-page-size select,
  .data-filter-client select {
    margin: 0;
    min-width: 110px;
  }
  .data-table-wrap {
    overflow-x: auto;
    margin-bottom: 0.75rem;
  }
  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
  }
  .data-table th,
  .data-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
  }
  .data-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: #f8fafc;
  }
  .data-table-clickable tbody tr {
    cursor: pointer;
  }
  .data-table-clickable tbody tr:hover {
    background: #f8fafc;
  }
  .data-table-clickable tbody tr.is-selected {
    background: var(--accent-light);
  }
  .data-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
  }
  .stat-card-highlight {
    border-color: var(--accent);
    background: var(--accent-light);
  }
  .stat-card .value-sm {
    font-size: 1.15rem;
  }
  .value-income {
    color: var(--success);
  }
  .value-expense {
    color: var(--danger);
  }
  .pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--surface2);
    color: var(--muted);
  }
  .pill-income {
    background: #dcfce7;
    color: #166534;
  }
  .pill-expense {
    background: #fee2e2;
    color: #991b1b;
  }
  .expiry-pill-active {
    background: #dcfce7;
    color: #166534;
  }
  .expiry-pill-soon {
    background: #fef3c7;
    color: #92400e;
  }
  .expiry-pill-expired {
    background: #fee2e2;
    color: #991b1b;
  }
  .expiry-pill-none {
    background: var(--surface2);
    color: var(--muted);
  }
  .due-pill-on_track {
    background: #dcfce7;
    color: #166534;
  }
  .due-pill-completed {
    background: #dbeafe;
    color: #1e40af;
  }
  .due-pill-soon {
    background: #fef3c7;
    color: #92400e;
  }
  .due-pill-overdue {
    background: #fee2e2;
    color: #991b1b;
  }
  .due-pill-none {
    background: var(--surface2);
    color: var(--muted);
  }
  .stat-card-warn {
    border-color: #fde68a;
    background: #fffbeb;
  }
  .stat-card-danger {
    border-color: #fecaca;
    background: #fef2f2;
  }
  .dev-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.5rem 0 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    max-height: 220px;
    overflow-y: auto;
  }
  .dev-checkbox-item {
    justify-content: flex-start;
    gap: 0.5rem;
  }
  .dev-assigned-tag {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--muted);
  }
  .assignment-dev-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0;
  }
  .assignment-project-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .assignment-project-card {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
  }
  .assignments-form-card label {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
  }
  .assignments-form-card select,
  .assignments-form-card input[type="date"] {
    width: 100%;
    margin-top: 0.25rem;
  }

  .activity-feed-card {
    margin-bottom: 1rem;
  }
  .activity-feed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
  }
  .activity-feed-head .card-title {
    margin: 0;
    font-size: 1rem;
  }
  .activity-feed-count {
    font-size: 0.75rem;
    color: var(--muted);
  }
  .activity-feed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
  }
  .activity-feed-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .activity-feed-item:last-child {
    border-bottom: none;
  }
  .activity-feed-item:hover {
    background: #f8fafc;
  }
  .activity-feed-item.is-unread {
    background: #f0f9ff;
  }
  .activity-type-pill {
    flex-shrink: 0;
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: var(--surface2);
    color: var(--muted);
    max-width: 5.5rem;
    text-align: center;
    line-height: 1.2;
  }
  .activity-feed-body {
    min-width: 0;
    flex: 1;
  }
  .activity-feed-title {
    display: block;
    font-size: 0.86rem;
    color: var(--text);
    margin-bottom: 0.15rem;
  }
  .activity-feed-msg {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .activity-feed-time {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--muted);
  }
  .activity-feed-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
  }
  .activity-page-btn.is-active {
    background: var(--primary, #2563eb);
    color: #fff;
  }
  .notebook-schedule-card .schedule-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }
  .schedule-row {
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
  }
  .schedule-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
  }
  .schedule-name {
    font-size: 0.95rem;
  }
  .schedule-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
  }
  .schedule-fields label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .schedule-fields input[type="date"] {
    margin: 0;
  }
  .client-project-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }
  .client-project-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
  }
  .client-project-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }
  .client-project-head h4 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
  }
  .client-project-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }
  .client-project-stat .stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
  }
  .client-project-stat-highlight strong {
    font-size: 0.95rem;
    color: #0f172a;
  }
  .dev-dashboard-deadlines .card-head-row {
    align-items: center;
    gap: 0.75rem;
  }
  .dev-project-deadline-card {
    border-left: 3px solid var(--primary, #2563eb);
  }
  .client-dashboard-schedule {
    margin-bottom: 1.25rem;
  }
  .client-dashboard-schedule .progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
  }
  .client-project-progress .progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
  }
  .client-project-progress .progress-bar span {
    display: block;
    height: 100%;
    background: #0f172a;
    border-radius: 999px;
  }
  .accountant-logo-preview {
    max-height: 64px;
    max-width: 200px;
    margin-bottom: 0.5rem;
  }
  .accountant-dashboard-preview-card {
    margin-bottom: 1.25rem;
  }
  .accountant-dashboard-preview-wrap {
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
  }
  .accountant-dashboard-preview-image {
    display: block;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-lg);
  }
  .accountant-loading {
    margin-bottom: 1rem;
    text-align: center;
  }
  .accountant-alert {
    margin-bottom: 1rem;
    border-color: #fbbf24;
    background: #fffbeb;
  }
  .accountant-workflow {
    margin-bottom: 1.25rem;
  }
  .workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
  }
  .workflow-step {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  }
  .workflow-step:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
  }
  .workflow-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
  }
  .workflow-desc {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.45;
  }
  .accountant-footer-grid {
    margin-top: 0.25rem;
  }
  .billing-section {
    scroll-margin-top: 1.25rem;
  }
  .billing-section-focus {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 12px;
  }
  .invoice-list-card {
    margin-bottom: 1.25rem;
  }
  .invoice-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .invoice-list-head .card-title {
    margin-bottom: 0.25rem;
  }
  .invoice-list-sub {
    margin: 0;
    padding: 0;
  }
  .invoice-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  .invoice-search-wrap {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .invoice-search-wrap .icon {
    color: var(--muted);
    flex-shrink: 0;
  }
  .invoice-search {
    flex: 1;
    border: none;
    background: transparent;
    margin: 0;
    padding: 0.15rem 0;
    font-size: 0.9rem;
  }
  .invoice-search:focus {
    outline: none;
    box-shadow: none;
  }
  .invoice-status-filter {
    width: auto;
    min-width: 150px;
    margin-bottom: 0;
  }
  .invoice-result-count {
    margin: 0 0 0.75rem;
    padding: 0;
    font-size: 0.82rem;
  }
  .invoice-table td {
    vertical-align: middle;
  }
  .invoice-client-email {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.15rem;
  }
  .sales-payment-ledger-card {
    margin-bottom: 1.25rem;
  }
  .ledger-summary-grid {
    margin-bottom: 1rem;
  }
  .ledger-toolbar {
    margin-bottom: 0.75rem;
  }
  .ledger-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
    padding: 0.35rem;
    background: var(--surface2);
    border-radius: 10px;
    border: 1px solid var(--border);
  }
  .ledger-tab {
    padding: 0.5rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  }
  .ledger-tab:hover {
    color: var(--text);
    background: #fff;
  }
  .ledger-tab.is-active {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
  .invoice-status-pill.status-draft {
    background: #fef3c7;
    color: #92400e;
  }
  .invoice-status-pill.status-sent {
    background: #dbeafe;
    color: #1e40af;
  }
  .invoice-status-pill.status-paid {
    background: #dcfce7;
    color: #166534;
  }
  .invoice-status-pill.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
  }
  .invoice-status-pill.status-accepted,
  .invoice-status-pill.status-signed {
    background: #dcfce7;
    color: #166534;
  }
  .invoice-status-pill.status-rejected {
    background: #fee2e2;
    color: #991b1b;
  }
  .invoice-status-pill.status-expired {
    background: #f1f5f9;
    color: #475569;
  }
  .ticket-table td {
    vertical-align: middle;
  }
  .ticket-project {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.15rem;
  }
  .ticket-status-pill.status-open {
    background: #dbeafe;
    color: #1e40af;
  }
  .ticket-status-pill.status-resolved {
    background: #dcfce7;
    color: #166534;
  }
  .ticket-priority-pill.priority-high {
    background: #fee2e2;
    color: #991b1b;
  }
  .ticket-priority-pill.priority-medium {
    background: #fef3c7;
    color: #92400e;
  }
  .ticket-priority-pill.priority-low {
    background: #f1f5f9;
    color: #475569;
  }
  .invoice-form-card {
    margin-bottom: 1.25rem;
  }

  .accountant-notebook {
    margin-bottom: 1.5rem;
  }
  .notebook-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
  }
  .notebook-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
  }
  .notebook-clients {
    position: sticky;
    top: calc(var(--topbar-height, 56px) + 12px);
    max-height: calc(100vh - var(--topbar-height, 56px) - 32px);
    overflow: auto;
  }
  .notebook-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }
  .notebook-search {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
  }
  .notebook-count {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
  }
  .notebook-client-item {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 0.45rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
  }
  .notebook-client-item:hover,
  .notebook-client-item.is-active {
    border-color: #0f172a;
    background: #f8fafc;
  }
  .notebook-client-item strong {
    display: block;
    margin-bottom: 0.15rem;
  }
  .notebook-client-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
  }
  .notebook-client-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.45rem;
  }
  .notebook-stats {
    margin: 0.75rem 0 1rem;
  }
  .notebook-form-card {
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: #f8fafc;
  }
  .notebook-entry {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
  }
  .notebook-entry:last-child {
    border-bottom: none;
  }
  .notebook-entry-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
  }
  .notebook-entry-head h4 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
  }
  .notebook-entry-meta {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
  }
  .notebook-entry-body {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.55;
    color: #334155;
  }
  @media (max-width: 900px) {
    .notebook-layout {
      grid-template-columns: 1fr;
    }
    .notebook-clients {
      position: static;
      max-height: none;
    }
  }