    :root {
      --bg: #000000;
      --surface: #0a0a0a;
      --surface2: #121212;
      --border: #222222;
      --accent: #a4d8a9; /* Pastel matcha green */
      --accent2: #ffd1dc; /* Pastel pink */
      --text: #ffffff;
      --muted: #888888;
      --danger: #ff6b6b;
      --warn: #ffd166;
      --success: #a4d8a9;
      --radius: 12px;
      --radius-sm: 8px;
      --glass-bg: rgba(10, 10, 10, 0.72);
      --glass-border: rgba(255, 255, 255, 0.08);
      --glass-shadow: rgba(0, 0, 0, 0.5);
    }

    /* Language Toggle Utility */
    html[lang="es"] .lang-en { display: none !important; }
    html[lang="en"] .lang-es { display: none !important; }

    html[data-theme="light"] {
      --bg: #ffffff;
      --surface: #f9f9f9;
      --surface2: #f1f1f1;
      --border: #e0e0e0;
      --accent: #87b88c; /* Slightly darker matcha green for contrast */
      --accent2: #f0b2bf; /* Slightly darker pink for contrast */
      --text: #000000;
      --muted: #666666;
      --danger: #e63946;
      --warn: #f4a261;
      --success: #87b88c;
      --glass-bg: rgba(255, 255, 255, 0.72);
      --glass-border: rgba(0, 0, 0, 0.08);
      --glass-shadow: rgba(0, 0, 0, 0.08);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: 'DM Sans', sans-serif;
      background:
        radial-gradient(900px 420px at 90% -20%, rgba(255, 209, 220, .05), transparent 62%),
        radial-gradient(900px 420px at -10% 120%, rgba(164, 216, 169, .05), transparent 62%),
        var(--bg);
      color: var(--text);
      min-height: 100vh;
    }

    .sidebar {
      width: 220px;
      min-height: 100vh;
      background: var(--glass-bg);
      border-right: 1px solid var(--glass-border);
      display: flex;
      flex-direction: column;
      padding: 28px 16px;
      position: fixed;
      left: 0;
      top: 0;
      bottom: 0;
      z-index: 100;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      /* Fixed top+bottom pins this to exactly the viewport height with no built-in
         scrolling — on a short window or with enough nav items, the bottom content
         (the user avatar/footer) rendered past the viewport edge and was completely
         unreachable. Let the sidebar scroll its own content instead. */
      overflow-y: auto;
    }
    .sidebar::-webkit-scrollbar {
      width: 5px;
    }
    .sidebar::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px;
    }

    .logo {
      font-family: 'Syne', sans-serif;
      font-weight: 800;
      font-size: 22px;
      color: var(--accent);
      letter-spacing: -.5px;
      padding: 0 8px;
      margin-bottom: 36px;
    }

    .logo span {
      color: var(--text);
    }

    .nav-section {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--muted);
      padding: 0 8px;
      margin-bottom: 8px;
      margin-top: 20px;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 14px;
      color: var(--muted);
      transition: all .2s;
      margin-bottom: 2px;
    }

    .nav-item svg {
      width: 16px;
      height: 16px;
      stroke-width: 2.2px;
      flex-shrink: 0;
      opacity: .95;
    }

    .nav-item:hover {
      background: var(--surface2);
      color: var(--text);
    }

    .nav-item.active {
      background: var(--accent);
      color: #000;
      font-weight: 600;
    }

    .db-status {
      margin-top: auto;
      padding: 10px 12px;
      border-radius: var(--radius-sm);
      background: var(--surface2);
      border: 1px solid var(--border);
      font-size: 11px;
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      margin: 10px 8px 0;
    }

    .db-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--muted);
      flex-shrink: 0;
    }

    .db-dot.connected {
      background: var(--success);
    }

    .db-dot.error {
      background: var(--danger);
    }


    /* Global Floating Time Tracker Widget */
    .global-tracker {
      margin: 12px 8px 4px 8px;
      padding: 10px 12px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      display: none;
      flex-direction: column;
      gap: 6px;
    }
    .global-tracker-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 10px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    .global-tracker-body {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .global-tracker-info {
      min-width: 0;
      flex: 1;
    }
    .global-tracker-project {
      font-size: 11px;
      font-weight: 500;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .global-tracker-time {
      font-size: 12px;
      font-family: monospace;
      font-weight: bold;
      color: var(--accent);
    }
    .global-tracker-actions {
      display: flex;
      gap: 6px;
    }
    .global-tracker-btn {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.15s ease;
      padding: 0;
    }
    .global-tracker-btn:hover {
      background: var(--border);
      border-color: var(--accent);
      color: var(--accent);
    }

    .sidebar-footer {
      padding: 0 8px;
      font-size: 11px;
      color: var(--muted);
      line-height: 1.6;
      min-width: 0;
      margin-top: 12px;
    }

    .user-mini {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
    }

    #usrName,
    #usrMail,
    #usrLast {
      display: block;
      overflow-wrap: anywhere;
      word-break: break-word;
    }

    .user-avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      border: 1px solid var(--border);
      object-fit: cover;
      background: var(--surface2);
    }

    .user-avatar-fallback {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: var(--accent);
      color: #000;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 13px;
    }

    .main {
      margin-left: 220px;
      padding: 28px 30px 36px;
      max-width: calc(100vw - 220px);
    }

    .page {
      display: none;
    }

    .page.active {
      display: block;
    }

    .page-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 36px;
    }

    .page-title {
      font-family: 'Syne', sans-serif;
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -.5px;
    }

    .page-title small {
      display: block;
      font-family: 'DM Sans', sans-serif;
      font-size: 13px;
      font-weight: 400;
      color: var(--muted);
      margin-top: 2px;
    }

    .btn {
      padding: 10px 18px;
      border-radius: 10px;
      border: none;
      cursor: pointer;
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      font-weight: 500;
      transition: all .18s;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      line-height: 1;
    }

    .btn-primary {
      background: var(--accent);
      color: #000;
    }

    .btn-primary:hover {
      background: var(--accent2);
    }

    .btn-ghost {
      background: var(--surface2);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .btn-ghost:hover {
      border-color: var(--accent);
      color: var(--accent);
      transform: translateY(-1px);
    }

    .btn-danger {
      background: transparent;
      color: var(--danger);
      border: 1px solid var(--danger);
    }

    .btn-danger:hover {
      background: var(--danger);
      color: white;
    }

    .btn-sm {
      padding: 6px 12px;
      font-size: 12px;
    }

    .btn:disabled {
      opacity: .5;
      cursor: not-allowed;
    }

    .btn .ico {
      font-size: 12px;
      line-height: 1;
      display: inline-grid;
      place-items: center;
      min-width: 12px;
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 16px;
      margin-bottom: 32px;
    }

    .stat-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
    }

    .stat-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
      margin-bottom: 10px;
    }

    .stat-value {
      font-family: 'Syne', sans-serif;
      font-size: 26px;
      font-weight: 700;
      color: var(--accent);
    }

    .stat-sub {
      font-size: 12px;
      color: var(--muted);
      margin-top: 4px;
    }

    .next-project-widget {
      display: flex;
      align-items: center;
      gap: 24px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 18px 22px;
      margin-bottom: 32px;
      cursor: pointer;
      transition: border-color .15s ease;
    }

    .next-project-widget:hover {
      border-color: var(--accent);
    }

    .next-project-days-block {
      flex: 0 0 auto;
      padding-right: 24px;
      border-right: 1px solid var(--border);
    }

    .next-project-eyebrow {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
      margin-bottom: 6px;
      white-space: nowrap;
    }

    .next-project-days-value {
      font-family: 'Syne', sans-serif;
      font-size: 20px;
      font-weight: 700;
      color: var(--accent);
      white-space: nowrap;
    }

    .next-project-info {
      flex: 1;
      min-width: 0;
    }

    .next-project-name {
      font-weight: 600;
      font-size: 15px;
      color: var(--text);
    }

    .next-project-client {
      font-size: 12px;
      color: var(--muted);
      margin-top: 2px;
    }

    .next-project-progress {
      margin-top: 8px;
      max-width: 360px;
    }

    .table-card {
      background: linear-gradient(180deg, rgba(255, 255, 255, .01), rgba(255, 255, 255, 0)), var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: 0 18px 40px rgba(0, 0, 0, .24);
    }

    .table-header {
      padding: 18px 24px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .table-title {
      font-family: 'Syne', sans-serif;
      font-weight: 600;
      font-size: 15px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    th {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
      font-weight: 500;
      padding: 12px 24px;
      text-align: left;
      border-bottom: 1px solid var(--border);
    }

    td {
      padding: 14px 24px;
      font-size: 14px;
      border-bottom: 1px solid var(--border);
      vertical-align: middle;
    }

    tr:last-child td {
      border-bottom: none;
    }

    tr:hover td {
      background: var(--surface2);
    }

    .badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 10px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .5px;
    }

    .badge-paid {
      background: rgba(66, 212, 140, .15);
      color: var(--success);
    }

    .badge-pending {
      background: rgba(255, 179, 71, .15);
      color: var(--warn);
    }

    .badge-cancelled {
      background: rgba(255, 87, 87, .15);
      color: var(--danger);
    }

    .badge-progress {
      background: rgba(200, 245, 66, .15);
      color: var(--accent);
    }

    .badge-partial {
      background: rgba(77, 171, 247, .15);
      color: #4dabf7;
    }

    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .75);
      z-index: 200;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
    }

    .modal-overlay.open {
      display: flex;
    }

    .modal {
      background: var(--glass-bg);
      border: 1px solid var(--glass-border);
      border-radius: 16px;
      padding: 32px;
      width: 520px;
      max-width: 95vw;
      max-height: 90vh;
      overflow-y: auto;
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      box-shadow: 0 24px 60px var(--glass-shadow);
    }

    .modal-title {
      font-family: 'Syne', sans-serif;
      font-size: 20px;
      font-weight: 700;
      margin-bottom: 24px;
    }

    .form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }

    .form-full {
      grid-column: 1/-1;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .form-label {
      font-size: 12px;
      font-weight: 500;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .5px;
    }

    .form-input,
    .form-select,
    .form-textarea {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 14px;
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      outline: none;
      transition: border-color .15s;
      width: 100%;
    }

    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
      border-color: var(--accent);
    }

    .form-select option {
      background: var(--surface2);
    }

    .form-textarea {
      resize: vertical;
      min-height: 80px;
    }

    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 12px;
      margin-top: 24px;
      padding-top: 24px;
      border-top: 1px solid var(--border);
    }

    .iitems {
      width: 100%;
      border-collapse: collapse;
      margin: 12px 0;
    }

    .iitems th {
      padding: 8px 12px;
      font-size: 11px;
      text-transform: uppercase;
      color: var(--muted);
      text-align: left;
      border-bottom: 1px solid var(--border);
    }

    .iitems td {
      padding: 8px 12px;
    }

    .iitems input {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 6px 10px;
      color: var(--text);
      font-family: 'DM Sans';
      font-size: 13px;
      width: 100%;
    }

    .iitems input:focus {
      outline: none;
      border-color: var(--accent);
    }

    .rib {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--danger);
      font-size: 16px;
      padding: 4px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .empty {
      padding: 60px 24px;
      text-align: center;
      color: var(--muted);
    }

    .empty-icon {
      font-size: 40px;
      margin-bottom: 12px;
      opacity: .4;
      display: flex;
      justify-content: center;
    }
    .empty-icon svg {
      width: 40px;
      height: 40px;
    }

    .empty p {
      font-size: 14px;
    }

    .search-bar {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 9px 14px;
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      outline: none;
      width: 240px;
    }

    .search-bar:focus {
      border-color: var(--accent);
    }

    .row-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }

    .row-actions .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      padding: 0 !important;
      border-radius: 8px;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }

    .row-actions .btn svg {
      width: 15px;
      height: 15px;
      stroke-width: 2.2px;
    }

    /* Clean CSS Tooltip */
    [data-tooltip] {
      position: relative;
    }
    [data-tooltip]::before {
      content: attr(data-tooltip);
      position: absolute;
      bottom: 125%;
      left: 50%;
      transform: translateX(-50%) scale(0.9);
      /* The tooltip bubble is intentionally always dark (in both themes), but its
         text used to follow var(--text) — which is black in light mode, making the
         label unreadable on this same dark background. Pin it to a light color that
         matches the fixed dark background instead of following the theme. */
      background: #121212;
      border: 1px solid #2a2a2a;
      color: #f5f5f5;
      font-size: 11px;
      font-weight: 500;
      padding: 4px 8px;
      border-radius: 4px;
      white-space: nowrap;
      opacity: 0;
      pointer-events: none;
      transition: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 1000;
      box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    }
    [data-tooltip]:hover::before {
      opacity: 1;
      transform: translateX(-50%) scale(1);
      bottom: 135%;
    }

    .toast {
      position: fixed;
      bottom: 30px;
      right: 30px;
      background: var(--surface);
      border: 1px solid var(--accent);
      border-radius: var(--radius-sm);
      padding: 12px 20px;
      font-size: 14px;
      z-index: 2001;
      opacity: 0;
      transform: translateY(10px);
      transition: all .3s;
      pointer-events: none;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .toast-ico {
      display: inline-flex;
      flex-shrink: 0;
    }
    .toast-ico-ok { color: var(--accent); }
    .toast-ico-warn { color: var(--warn); }
    .toast-ico-err { color: var(--danger); }
    .toast-ico-info { color: var(--accent); }

    #advanced_sync_arrow { display: inline-flex; align-items: center; transition: transform .2s ease; }
    #advanced_sync_arrow.expanded { transform: rotate(180deg); }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .divider {
      height: 1px;
      background: var(--border);
      margin: 16px 0;
    }

    .two-col {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 24px;
      margin-bottom: 24px;
    }

    /* Extra breathing room between the stacked dashboard sections below the
       two-col row (Recent projects/invoices, Top clients, Metrics) — these
       .table-card blocks otherwise sit flush against each other. */
    .dash-section-card {
      margin-bottom: 24px;
    }

    .cavatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--accent);
      color: #000;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 13px;
      flex-shrink: 0;
    }

    .ccell {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .sbox {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 16px;
      font-size: 14px;
    }

    .srow {
      display: flex;
      justify-content: space-between;
      padding: 4px 0;
      color: var(--muted);
    }

    .srow.total {
      color: var(--text);
      font-weight: 600;
      padding-top: 10px;
      margin-top: 6px;
      border-top: 1px solid var(--border);
      font-size: 16px;
    }

    .srow.total span:last-child {
      color: var(--accent);
    }

    .lbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: var(--accent);
      z-index: 9999;
      transform: scaleX(0);
      transform-origin: left;
      transition: transform .3s;
    }

    .lbar.show {
      transform: scaleX(.7);
    }

    .lbar.done {
      transform: scaleX(1);
      transition: transform .1s;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .spin {
      width: 14px;
      height: 14px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin .6s linear infinite;
      display: inline-block;
    }

    .auth-screen {
      position: fixed;
      inset: 0;
      background: radial-gradient(circle at top right, #1e1e1e, #0d0d0d 58%);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      z-index: 1000;
    }

    .auth-layout {
      width: min(1160px, 96vw);
      display: grid;
      grid-template-columns: 420px 1fr;
      gap: 18px;
      align-items: stretch;
    }

    .auth-card {
      width: 100%;
      max-width: 100%;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 28px;
    }

    .auth-title {
      font-family: 'Syne', sans-serif;
      font-size: 26px;
      font-weight: 700;
      margin-bottom: 6px;
    }

    .auth-sub {
      font-size: 13px;
      color: var(--muted);
      margin-bottom: 18px;
    }

    .auth-actions {
      display: flex;
      gap: 10px;
      margin-top: 16px;
    }

    .auth-msg {
      margin-top: 12px;
      font-size: 12px;
      line-height: 1.45;
      color: var(--muted);
      min-height: 18px;
    }

    .auth-msg.ok {
      color: var(--success);
    }

    .auth-msg.err {
      color: var(--danger);
    }

    .auth-helper {
      font-size: 12px;
      color: var(--muted);
      margin-top: 12px;
      line-height: 1.5;
    }

    .auth-showcase {
      position: relative;
      overflow: hidden;
      border-radius: 16px;
      border: 1px solid var(--border);
      background:
        radial-gradient(1200px 340px at 0% -20%, rgba(200, 245, 66, .14), transparent 60%),
        radial-gradient(700px 260px at 100% 120%, rgba(66, 212, 140, .10), transparent 60%),
        linear-gradient(160deg, #141414, #111214 70%, #171a1f);
    }

    .auth-showcase-head {
      padding: 20px 22px 10px;
    }

    .auth-showcase-title {
      font-family: 'Syne', sans-serif;
      font-size: 24px;
      line-height: 1.1;
      margin-bottom: 8px;
    }

    .auth-showcase-sub {
      font-size: 13px;
      color: var(--muted);
    }

    .auth-slides {
      position: relative;
      min-height: 360px;
      padding: 8px 16px 16px;
    }

    .auth-slide {
      position: absolute;
      inset: 8px 16px 16px;
      opacity: 0;
      transform: translateX(28px) scale(.99);
      transition: all .6s ease;
      pointer-events: none;
    }

    .auth-slide.active {
      opacity: 1;
      transform: translateX(0) scale(1);
      pointer-events: auto;
    }

    .auth-benefit-card {
      height: 100%;
      border-radius: 14px;
      border: 1px solid var(--border);
      background: rgba(12, 13, 15, .68);
      padding: 18px;
      display: grid;
      grid-template-rows: auto auto 1fr;
      gap: 10px;
    }

    .auth-benefit-kicker {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
    }

    .auth-benefit-title {
      font-family: 'Syne', sans-serif;
      font-size: 20px;
      line-height: 1.15;
    }

    .auth-benefit-desc {
      font-size: 13px;
      color: var(--muted);
    }

    .mini-viz {
      margin-top: 8px;
      display: grid;
      gap: 12px;
    }

    .viz-row {
      display: grid;
      grid-template-columns: 80px 1fr 52px;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--muted);
    }

    .viz-track {
      height: 8px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: #101215;
      overflow: hidden;
    }

    .viz-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--accent), #62dfa6);
    }

    .viz-donut-wrap {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .viz-donut {
      width: 82px;
      height: 82px;
      border-radius: 50%;
      background: conic-gradient(var(--accent) 0 230deg, #62dfa6 230deg 295deg, #2a2a2a 295deg 360deg);
      position: relative;
    }

    .viz-donut::after {
      content: '';
      position: absolute;
      inset: 12px;
      background: #111315;
      border-radius: 50%;
      border: 1px solid var(--border);
    }

    .viz-donut-label {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      font-size: 12px;
      font-weight: 700;
      color: var(--text);
    }

    .viz-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 4px 8px;
      font-size: 11px;
      color: var(--muted);
    }

    .viz-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent);
    }

    .viz-dot.ok {
      background: #62dfa6;
    }

    .viz-spark {
      height: 84px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(200, 245, 66, .08), rgba(0, 0, 0, 0));
      display: flex;
      align-items: flex-end;
      gap: 7px;
      padding: 10px;
    }

    .viz-spark span {
      display: block;
      flex: 1;
      min-width: 7px;
      border-radius: 5px 5px 2px 2px;
      background: linear-gradient(180deg, var(--accent), #a5d940);
    }

    .auth-dots {
      display: flex;
      gap: 8px;
      justify-content: center;
      padding: 0 0 14px;
    }

    .auth-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #2a2d31;
      border: none;
      cursor: pointer;
      transition: .2s;
    }

    .auth-dot.active {
      background: var(--accent);
      transform: scale(1.18);
    }

    .settings-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }

    .settings-grid .table-card {
      padding: 20px;
      overflow: visible;
    }

    .settings-grid .table-title {
      margin-bottom: 14px;
      display: block;
    }

    .settings-section-title {
      grid-column: 1 / -1;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
      margin: 30px 0 -2px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
    }

    .settings-section-title:first-of-type {
      margin-top: 0;
    }

    .settings-section-title svg {
      width: 15px;
      height: 15px;
      stroke-width: 2px;
      opacity: .8;
      flex-shrink: 0;
    }

    .profile-photo-wrap {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .profile-photo-preview {
      width: 56px;
      height: 56px;
      border-radius: 50%;
      border: 1px solid var(--border);
      object-fit: cover;
      background: var(--surface2);
    }

    .profile-photo-fallback {
      width: 56px;
      height: 56px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: var(--accent);
      color: #000;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 16px;
    }

    .switch-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--surface2);
    }

    .switch-label {
      font-size: 13px;
      color: var(--muted);
    }

    .switch {
      position: relative;
      display: inline-block;
      width: 52px;
      height: 30px;
    }

    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      cursor: pointer;
      inset: 0;
      background: #3a3a3a;
      border-radius: 999px;
      transition: .2s;
      border: 1px solid var(--border);
    }

    .slider:before {
      position: absolute;
      content: "";
      height: 22px;
      width: 22px;
      left: 3px;
      top: 3px;
      background: #fff;
      border-radius: 50%;
      transition: .2s;
    }

    .switch input:checked+.slider {
      background: var(--accent);
    }

    .switch input:checked+.slider:before {
      transform: translateX(22px);
    }

    .metrics-wrap {
      margin-top: 24px;
    }

    .metrics-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }

    .metrics-filters {
      display: flex;
      gap: 8px;
    }

    .metrics-filters .btn.active {
      background: var(--accent);
      color: #000;
      border-color: var(--accent);
    }

    .metrics-grid {
      display: grid;
      grid-template-columns: 1.2fr 1fr;
      gap: 16px;
      padding: 16px 18px 18px;
    }

    .metric-card {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 14px;
    }

    .metric-title {
      font-size: 12px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .7px;
      margin-bottom: 10px;
    }

    .metric-kpi {
      font-family: 'Syne', sans-serif;
      font-size: 24px;
      color: var(--accent);
      line-height: 1;
    }

    .metric-sub {
      font-size: 12px;
      color: var(--muted);
      margin-top: 6px;
    }

    .metric-delta {
      font-size: 12px;
      margin-top: 6px;
    }

    .metric-delta.up {
      color: var(--success);
    }

    .metric-delta.down {
      color: var(--danger);
    }

    .metric-delta.flat {
      color: var(--muted);
    }

    .metric-delta .arrow {
      font-weight: 700;
      margin-right: 4px;
      display: inline-flex;
      align-items: center;
      vertical-align: -1px;
    }

    .sparkline {
      margin-top: 10px;
      height: 42px;
      width: 100%;
    }

    .sparkline svg {
      width: 100%;
      height: 100%;
      display: block;
    }

    .sparkline path.line {
      fill: none;
      stroke: var(--accent);
      stroke-width: 2.2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .sparkline path.area {
      fill: rgba(200, 245, 66, .15);
    }

    .rev-bars {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;
      align-items: end;
      height: 130px;
      margin-top: 12px;
    }

    .rev-bar {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }

    .rev-bar-col {
      width: 100%;
      max-width: 28px;
      background: linear-gradient(180deg, var(--accent), var(--accent2));
      border-radius: 8px 8px 4px 4px;
      min-height: 6px;
    }

    .rev-bar-lbl {
      font-size: 10px;
      color: var(--muted);
    }

    .stack-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin: 10px 0 8px;
    }

    .stack-label {
      font-size: 12px;
      color: var(--muted);
    }

    .stack-track {
      height: 8px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 999px;
      overflow: hidden;
      margin-top: 6px;
    }

    .stack-fill {
      height: 100%;
    }

    .stack-fill.success {
      background: var(--success);
    }

    .stack-fill.warn {
      background: var(--warn);
    }

    .status-list {
      display: grid;
      gap: 9px;
      margin-top: 4px;
    }

    .status-row {
      display: grid;
      grid-template-columns: 88px 1fr 44px;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--muted);
    }

    .status-track {
      height: 7px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 999px;
      overflow: hidden;
    }

    .status-fill {
      height: 100%;
    }

    .status-fill.progress {
      background: var(--accent);
    }

    .status-fill.completed {
      background: var(--success);
    }

    .status-fill.pending {
      background: var(--warn);
    }

    .status-fill.cancelled {
      background: var(--danger);
    }

    .kv-list {
      display: grid;
      gap: 8px;
      margin-top: 10px;
    }

    .kv-item {
      display: flex;
      justify-content: space-between;
      font-size: 13px;
      color: var(--muted);
    }

    .kv-item strong {
      color: var(--text);
      font-weight: 600;
    }

    .dash-extra-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 16px;
      margin-top: 16px;
    }

    .dash-info-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }

    .dash-info-body {
      padding: 16px 18px;
    }

    .alerts-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .alerts-filters {
      display: flex;
      gap: 6px;
    }

    .alerts-filters .btn {
      padding: 5px 10px;
      font-size: 11px;
    }

    .alerts-filters .btn.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #000;
    }

    .cashflow-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }

    .cashflow-box {
      border: 1px solid var(--border);
      background: var(--surface2);
      border-radius: 10px;
      padding: 10px;
    }

    .cashflow-box .k {
      font-size: 11px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .5px;
    }

    .cashflow-box .v {
      font-family: 'Syne', sans-serif;
      font-size: 22px;
      color: var(--accent);
      margin-top: 4px;
    }

    .alerts-list {
      display: grid;
      gap: 9px;
    }

    .alert-row {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface2);
      font-size: 12px;
      color: var(--muted);
    }

    .alert-row.clickable {
      cursor: pointer;
      transition: .15s;
    }

    .alert-row.clickable:hover {
      border-color: var(--accent);
      color: var(--text);
    }

    .alert-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      margin-top: 4px;
      flex-shrink: 0;
    }

    .alert-dot.danger {
      background: var(--danger);
    }

    .alert-dot.warn {
      background: var(--warn);
    }

    .alert-dot.ok {
      background: var(--success);
    }

    .row-flash td {
      animation: rowFlash 1.2s ease;
    }

    @keyframes rowFlash {
      0% {
        background: rgba(200, 245, 66, .28);
      }

      100% {
        background: transparent;
      }
    }

    .todo-tabs button.active {
      background: var(--accent) !important;
      color: #000000 !important;
      border-color: var(--accent) !important;
    }

    .todo-list {
      display: grid;
      gap: 12px;
      padding: 18px;
    }

    .todo-item {
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: 16px;
      align-items: center;
      padding: 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--surface2);
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s;
    }
    .todo-item:hover {
      border-color: var(--accent);
      background: rgba(164, 216, 169, 0.05);
    }

    .todo-item input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--accent);
      cursor: pointer;
    }

    .todo-meta {
      font-size: 12px;
      color: var(--muted);
    }

    .todo-price {
      font-weight: 600;
      color: var(--accent);
    }

    .todo-state {
      font-size: 11px;
      color: var(--muted);
    }

    .todo-due-chip {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid var(--border);
      font-size: 10px;
      letter-spacing: .3px;
      color: var(--muted);
    }

    .priority-dot {
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 50%;
    }
    .priority-dot.high { background-color: #ff5757; box-shadow: 0 0 6px rgba(255, 87, 87, 0.4); }
    .priority-dot.medium { background-color: #ffb347; box-shadow: 0 0 6px rgba(255, 179, 71, 0.4); }
    .priority-dot.low { background-color: #42d48c; box-shadow: 0 0 6px rgba(66, 212, 140, 0.4); }

    .spotlight-item {
      padding: 10px 16px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 3px;
      transition: background 0.15s ease;
      border-bottom: 1px solid rgba(255,255,255,0.03);
    }
    .spotlight-item:hover {
      background: var(--surface);
    }
    .spotlight-item:hover div {
      color: var(--accent) !important;
    }

    .todo-priority {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid var(--border);
      font-size: 10px;
      letter-spacing: .4px;
      text-transform: uppercase;
    }

    /* CALENDAR VIEWS */
    .calendar-day-cell {
      min-height: 85px;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 6px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      background: var(--surface2);
      transition: all 0.15s ease;
    }
    .calendar-day-cell.inactive {
      opacity: 0.25;
    }
    .calendar-day-cell.today {
      border-color: var(--accent);
      background: rgba(164, 216, 169, 0.05);
      box-shadow: 0 0 6px rgba(164, 216, 169, 0.15);
    }
    .calendar-day-number {
      font-size: 11px;
      font-weight: 600;
      color: var(--text);
    }
    .calendar-day-events {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 4px;
      flex: 1;
      overflow-y: auto;
    }
    .calendar-event {
      font-size: 9px;
      padding: 2px 4px;
      border-radius: 3px;
      background: var(--surface);
      border-left: 2.5px solid var(--accent);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      cursor: pointer;
      color: var(--text);
      transition: transform 0.1s ease;
    }
    .calendar-event svg { margin-right: 2px; vertical-align: -1px; }
    .calendar-event:hover {
      transform: translateX(1px);
      filter: brightness(1.1);
    }
    .calendar-event.project {
      border-left-color: var(--accent2);
    }
    .calendar-event.invoice {
      border-left-color: var(--warn);
    }
    .calendar-event.subscription {
      border-left-color: #9d8cff;
    }
    .calendar-event.overdue {
      border-left-color: var(--danger);
      background: rgba(220, 38, 38, .08);
    }
    .calendar-event.more {
      background: transparent;
      border-left-color: transparent;
      color: var(--muted);
      font-weight: 600;
      text-align: center;
    }
    .calendar-event.more:hover {
      color: var(--text);
      text-decoration: underline;
    }

    .calendar-layout {
      display: grid;
      grid-template-columns: 2.2fr 1fr;
      gap: 16px;
      align-items: start;
    }

    .calendar-weekday-row .cal-weekend {
      color: var(--accent2);
    }

    .calendar-day-cell.weekend {
      background: color-mix(in srgb, var(--surface2) 92%, var(--accent2) 8%);
    }

    .calendar-day-cell.today .calendar-day-number {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: var(--accent);
      color: var(--bg);
      font-size: 10px;
    }

    .calendar-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      margin: -6px 0 16px;
      font-size: 12px;
      color: var(--muted);
    }
    .calendar-legend .legend-item {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .legend-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      display: inline-block;
      flex-shrink: 0;
    }
    .legend-dot-task { background: var(--accent); }
    .legend-dot-project { background: var(--accent2); }
    .legend-dot-invoice { background: var(--warn); }
    .legend-dot-subscription { background: #9d8cff; }
    .legend-dot-overdue { background: var(--danger); }

    .calendar-upcoming-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 12px;
    }
    .calendar-upcoming-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 8px;
      border-radius: 8px;
      cursor: pointer;
      transition: background .15s ease;
    }
    .calendar-upcoming-item:hover {
      background: var(--surface2);
    }
    .calendar-upcoming-item .cu-icon {
      width: 26px;
      height: 26px;
      border-radius: 7px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      background: var(--surface2);
      color: var(--muted);
    }
    .calendar-upcoming-item.overdue .cu-icon {
      background: rgba(220, 38, 38, .12);
      color: var(--danger);
    }
    .calendar-upcoming-item .cu-body {
      flex: 1;
      min-width: 0;
    }
    .calendar-upcoming-item .cu-title {
      font-size: 12.5px;
      font-weight: 600;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .calendar-upcoming-item .cu-date {
      font-size: 11px;
      color: var(--muted);
    }
    .calendar-upcoming-item.overdue .cu-date {
      color: var(--danger);
    }
    .calendar-upcoming-empty {
      font-size: 12.5px;
      color: var(--muted);
      padding: 10px 4px;
    }

    .calendar-daymodal-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 16px 20px 20px;
      max-height: 60vh;
      overflow-y: auto;
    }

    .todo-priority.high {
      color: #ff9e9e;
      border-color: rgba(220, 38, 38, .5);
      background: rgba(220, 38, 38, .12);
    }

    .todo-priority.medium {
      color: #ffd485;
      border-color: rgba(217, 119, 6, .5);
      background: rgba(217, 119, 6, .12);
    }

    .todo-priority.low {
      color: #9ae6b4;
      border-color: rgba(22, 163, 74, .5);
      background: rgba(22, 163, 74, .12);
    }

    @media (max-width: 980px) {
      .settings-grid {
        grid-template-columns: 1fr;
      }

      .calendar-layout {
        grid-template-columns: 1fr;
      }

      .metrics-grid {
        grid-template-columns: 1fr;
      }

      .dash-extra-grid {
        grid-template-columns: 1fr;
      }

      .cashflow-grid {
        grid-template-columns: 1fr;
      }

      .auth-layout {
        grid-template-columns: 1fr;
        max-width: 460px;
      }

      .auth-showcase {
        display: none;
      }
    }

    /* KANBAN BOARD & EXPENSES STYLES */
    .kanban-board {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-top: 10px;
    }
    @media (max-width: 900px) {
      .kanban-board {
        grid-template-columns: 1fr;
      }
    }
    .kanban-column {
      background: var(--surface2);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      padding: 12px;
      display: flex;
      flex-direction: column;
      min-height: 400px;
    }
    .kanban-column-header {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 12px;
      padding-bottom: 6px;
      border-bottom: 2px solid var(--border);
    }
    .kanban-column-header.progress { border-color: #3b82f6; color: #3b82f6; }
    .kanban-column-header.completed { border-color: #10b981; color: #10b981; }
    .kanban-column-header.pending { border-color: #f59e0b; color: #f59e0b; }
    .kanban-column-header.cancelled { border-color: #ef4444; color: #ef4444; }
    
    .kanban-cards {
      display: flex;
      flex-direction: column;
      gap: 10px;
      flex-grow: 1;
      overflow-y: auto;
    }
    .kanban-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px;
      cursor: grab;
      transition: transform 0.2s, box-shadow 0.2s;
    }
    .kanban-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    }
    .kanban-card:active {
      cursor: grabbing;
    }
    .kanban-card-title {
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 4px;
    }
    .kanban-card-client {
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 8px;
    }
    .kanban-card-price {
      font-size: 12px;
      font-weight: 700;
      color: var(--accent);
    }
    .kanban-card-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 8px;
      border-top: 1px solid var(--border);
      padding-top: 6px;
    }
    .kanban-card-moves {
      display: flex;
      gap: 4px;
    }
    .kanban-move-btn {
      background: transparent;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 11px;
      padding: 2px 4px;
      border-radius: 4px;
    }
    .kanban-move-btn:hover {
      color: var(--text);
      background: var(--border);
    }
    .chart-wide-card {
      grid-column: span 2;
    }
    @media (max-width: 768px) {
      .chart-wide-card {
        grid-column: span 1;
      }
    }

    /* MOBILE HEADER STYLES */
    .mobile-header {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 56px;
      background: rgba(10, 10, 10, 0.95);
      border-bottom: 1px solid var(--border);
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      z-index: 1000;
      backdrop-filter: blur(8px);
    }
    html[data-theme="light"] .mobile-header {
      background: rgba(249, 249, 249, 0.95);
    }
    .mobile-menu-btn {
      background: transparent;
      border: none;
      color: var(--text);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 8px;
    }
    .mobile-menu-btn:hover {
      background: var(--surface2);
    }
    .mobile-logo {
      font-family: 'Syne', sans-serif;
      font-weight: 800;
      font-size: 18px;
      color: var(--accent);
      letter-spacing: -.5px;
    }
    .mobile-logo span {
      color: var(--text);
    }
    .mobile-user-avatar {
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .mobile-user-avatar .user-avatar,
    .mobile-user-avatar .user-avatar-fallback {
      width: 32px;
      height: 32px;
      border-radius: 50%;
    }
    .mobile-user-avatar .user-avatar-fallback {
      font-size: 11px;
    }

    /* SIDEBAR OVERLAY */
    .sidebar-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(4px);
      z-index: 998;
    }
    .sidebar-overlay.open {
      display: block;
    }

    /* RESPONSIVE LAYOUTS & COMPONENT OVERRIDES */
    @media (max-width: 768px) {
      .mobile-header.logged-in {
        display: flex;
      }
      .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 999;
        height: 100vh;
        min-height: 100vh;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
      }
      .sidebar.open {
        transform: translateX(0);
      }
      .main {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding: 72px 16px 36px !important;
      }
      .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 24px !important;
      }
      .next-project-widget {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
      }
      .next-project-days-block {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 12px;
      }
      .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 24px;
      }
      .page-header .btn,
      .page-header .search-bar {
        width: 100%;
      }
      /* Pages with two action buttons in the header (TO-DO, Quotes, Invoices)
         wrap them in their own flex row; the width:100% rule above then makes
         both buttons fight for the same line and squeeze/wrap mid-word. Stack
         them instead so each gets its own full-width row. */
      .page-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
      }
      .page-title {
        font-size: 24px;
      }
      /* Table-card headers (title + search/filter/archive controls) don't wrap
         by default; on narrow screens the controls get squeezed and clipped by
         the card's overflow:hidden (e.g. Clients/Projects "View archived"
         button becoming invisible). Let the row wrap and push controls to
         their own full-width line. */
      .table-header {
        flex-wrap: wrap;
        row-gap: 10px;
      }
      .table-header-controls {
        width: 100%;
        flex-wrap: wrap;
      }
      .table-header-controls .search-bar {
        flex: 1 1 140px;
        min-width: 0;
      }
      .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }
      .two-col {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
      }
      .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
      }
      .modal {
        width: 94vw !important;
        padding: 20px 16px !important;
        max-height: 85vh !important;
      }
      .modal-title {
        font-size: 18px !important;
        margin-bottom: 16px !important;
      }
      .modal-actions {
        margin-top: 16px !important;
        padding-top: 16px !important;
      }
      .table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }
      /* .settings-grid .table-card sets overflow:visible for desktop (specificity
         beats the rule above); on narrow screens that lets long select/input
         content (e.g. a long project name in the Time Tracker) blow the card past
         its grid track and force horizontal scroll on the whole page. Re-assert
         scroll-contained + shrinkable here so it can't escape its column. */
      .settings-grid .table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
      }
      .calendar-day-cell {
        min-height: 64px !important;
        padding: 4px !important;
      }
      .calendar-event {
        font-size: 9px !important;
        padding: 1px 2px !important;
      }
      .calendar-day-number {
        font-size: 11px !important;
      }
      .todo-tabs button {
        flex-shrink: 0;
      }
      /* Today / prev / month-year / next / export-iCal controls don't fit one
         row under 375px wide (min-width:140px label alone plus 4 buttons); let
         them wrap instead of forcing the page wider than the viewport. */
      .calendar-header-controls {
        flex-wrap: wrap;
        row-gap: 8px;
      }
      #calendar-month-year {
        min-width: 0 !important;
      }
    }

    @media (max-width: 480px) {
      .stats-grid {
        grid-template-columns: 1fr !important;
      }
      .row-actions {
        justify-content: flex-end;
      }
      .auth-card {
        padding: 20px 16px !important;
      }
      .auth-title {
        font-size: 28px !important;
      }
    }

    /* Clean up sidebar - hide the settings navigation section, settings nav item, and logout button */
    #nav-section-settings,
    #nav-settings,
    .sidebar button[onclick="logout()"] {
      display: none !important;
    }

    /* Profile Dropdown Menu */
    .profile-dropdown {
      position: fixed;
      display: none;
      width: 280px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
      z-index: 1001;
      animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes dropdownFadeIn {
      from {
        opacity: 0;
        transform: translateY(-8px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    .profile-dropdown.open {
      display: block;
    }
    .profile-dropdown-header {
      padding: 16px;
      border-bottom: 1px solid var(--border);
    }
    .profile-dropdown-user {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .profile-dropdown-user-info {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .profile-dropdown-name {
      font-weight: 600;
      color: var(--text);
      font-size: 14px;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }
    .profile-dropdown-email {
      font-size: 11px;
      color: var(--muted);
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }
    .profile-dropdown-menu {
      padding: 8px;
    }
    .profile-dropdown-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 10px 12px;
      background: transparent;
      border: none;
      color: var(--text);
      font-family: inherit;
      font-size: 13px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      text-align: left;
      transition: background 0.15s ease, color 0.15s ease;
    }
    .profile-dropdown-item:hover {
      background: var(--surface2);
    }
    .profile-dropdown-item svg {
      opacity: 0.7;
    }
    .profile-dropdown-item.text-danger {
      color: var(--danger);
    }
    .profile-dropdown-item.text-danger:hover {
      background: rgba(230, 57, 70, 0.08);
    }
    .profile-dropdown-divider {
      height: 1px;
      background: var(--border);
    }
    .profile-dropdown-notifications {
      padding: 12px 16px 16px;
      max-height: 250px;
      display: flex;
      flex-direction: column;
    }
    .profile-dropdown-notifications-title {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--muted);
      margin-bottom: 8px;
      font-weight: 700;
    }
    .profile-dropdown-notifications-list {
      overflow-y: auto;
      max-height: 180px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .profile-dropdown-notifications-list::-webkit-scrollbar {
      width: 4px;
    }
    .profile-dropdown-notifications-list::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 2px;
    }
    
    /* Dropdown notification alert rows */
    .profile-dropdown .alert-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px;
      font-size: 12px;
      color: var(--text);
      border-radius: var(--radius-sm);
      border: 1px solid transparent;
    }
    .profile-dropdown .alert-row.clickable {
      cursor: pointer;
      transition: background 0.15s ease, border-color 0.15s ease;
    }
    .profile-dropdown .alert-row.clickable:hover {
      background: var(--surface2);
      border-color: var(--border);
    }

    /* Hide user email in sidebar footer */
    #usrMail {
      display: none !important;
    }

    /* Subscriptions UI Sub-tabs */
    .sub-tabs {
      display: flex;
      gap: 8px;
      margin: 16px 24px;
      border-bottom: 1px solid var(--border);
      padding-bottom: 12px;
      flex-wrap: wrap;
    }
    
    /* iOS App-style Mosaics/Cards for Subscriptions */
    .ios-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 16px;
      padding: 16px 24px;
    }
    .ios-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 18px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      text-align: center;
      position: relative;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
      min-height: 180px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    .ios-card:hover {
      transform: translateY(-4px);
      border-color: var(--accent);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
    .ios-card-logo-container {
      width: 54px;
      height: 54px;
      border-radius: 12px;
      background: var(--surface2);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 12px;
      overflow: hidden;
      border: 1px solid var(--border);
      padding: 6px;
      transition: background 0.2s ease;
    }
    .ios-card-logo {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
    }
    .ios-card-logo svg {
      width: 100%;
      height: 100%;
      display: block;
    }
    .ios-card-name {
      font-weight: 600;
      font-size: 14px;
      color: var(--text);
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: 100%;
    }
    .ios-card-amount {
      font-size: 16px;
      font-weight: 700;
      color: var(--accent);
      margin-bottom: 6px;
    }
    .ios-card-date {
      font-size: 10px;
      color: var(--muted);
      margin-bottom: 12px;
    }
    .ios-card-status {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 8px;
      height: 8px;
      border-radius: 50%;
    }
    .ios-card-status.active {
      background: var(--accent);
      box-shadow: 0 0 8px var(--accent);
    }
    .ios-card-status.inactive {
      background: var(--muted);
    }
    .ios-card-actions {
      display: flex;
      gap: 6px;
      width: 100%;
      justify-content: center;
    }

    /* Projects Filter Bar styling */
    .projects-filter-bar {
      display: flex;
      gap: 12px;
      padding: 12px 24px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-wrap: wrap;
      align-items: center;
    }
    .projects-filter-bar select {
      background: var(--background);
      border: 1px solid var(--border);
      color: var(--text);
      border-radius: var(--radius-sm);
      padding: 6px 12px;
      font-size: 12px;
      height: 32px;
      min-width: 140px;
      outline: none;
      transition: border-color 0.15s ease;
    }
    .projects-filter-bar select:focus {
      border-color: var(--accent);
    }
    .projects-filter-bar label {
      font-size: 12px;
      color: var(--muted);
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    /* Visual guide enhancements styling */
    .guide-timeline {
      position: relative;
      padding-left: 32px;
      margin-left: 16px;
      border-left: 2px dashed var(--border);
    }
    .guide-timeline-item {
      position: relative;
      margin-bottom: 24px;
    }
    .guide-timeline-badge {
      position: absolute;
      left: -44px;
      top: 0;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: var(--surface2);
      border: 2px solid var(--accent);
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 11px;
    }
    .guide-timeline-badge.pink {
      border-color: var(--accent2);
    }
    .guide-card-regime {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      transition: border-color 0.2s ease;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .guide-card-regime:hover {
      border-color: var(--accent);
    }
    .guide-card-regime.pink:hover {
      border-color: var(--accent2);
    }
    .checkmark-list {
      list-style: none;
      padding-left: 0;
      margin-top: 10px;
    }
    .checkmark-list li {
      position: relative;
      padding-left: 22px;
      margin-bottom: 8px;
      font-size: 12.5px;
      line-height: 1.5;
      color: var(--text);
    }
    .checkmark-list li::before {
      content: "";
      position: absolute;
      left: 0;
      top: 3px;
      width: 14px;
      height: 14px;
    }
    .checkmark-list.yes li::before {
      background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2342d48c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center/contain;
    }
    .checkmark-list.no li::before {
      background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5757' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E") no-repeat center/contain;
    }

    /* PDF preview icon-only adjustments */
    #ipm .row-actions button {
      position: relative;
      width: 32px;
      height: 32px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: var(--radius-sm);
    }
    #ipm .row-actions button span.ico-svg {
      margin-right: 0 !important;
    }

    /* Slide-out Client Details Drawer */
    .drawer-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(4px);
      z-index: 1100;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease;
    }
    .drawer-overlay.open {
      opacity: 1;
      pointer-events: auto;
    }
    .drawer {
      position: fixed;
      top: 0;
      right: -460px;
      width: 460px;
      max-width: 90%;
      height: 100%;
      background: var(--background);
      border-left: 1px solid var(--border);
      box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
      z-index: 1200;
      transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      flex-direction: column;
      color: var(--text);
    }
    .drawer.open {
      right: 0;
    }
    .drawer-header {
      padding: 20px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .drawer-title {
      font-size: 18px;
      font-weight: 600;
      color: var(--text);
    }
    .drawer-close {
      background: none;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 20px;
      padding: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: color 0.15s ease;
    }
    .drawer-close:hover {
      color: var(--text);
    }
    .drawer-content {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
    }
    .drawer-section {
      margin-bottom: 24px;
    }
    .drawer-section-title {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted);
      margin-bottom: 12px;
      font-weight: 600;
    }
    .client-gauge-container {
      display: flex;
      align-items: center;
      gap: 16px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 20px;
    }
    .client-gauge-svg {
      width: 70px;
      height: 70px;
      transform: rotate(-90deg);
    }
    .client-gauge-circle-bg {
      fill: none;
      stroke: var(--border);
      stroke-width: 6;
    }
    .client-gauge-circle-val {
      fill: none;
      stroke: var(--accent); /* Matcha green */
      stroke-width: 6;
      stroke-linecap: round;
      stroke-dasharray: 200.96; /* 2 * PI * 32 */
      stroke-dashoffset: 200.96;
      transition: stroke-dashoffset 0.5s ease;
    }
    .client-gauge-text {
      display: flex;
      flex-direction: column;
    }
    .client-gauge-percent {
      font-size: 20px;
      font-weight: 700;
      color: var(--text);
    }
    .client-gauge-label {
      font-size: 11px;
      color: var(--muted);
    }
    .client-meta-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
      margin-bottom: 20px;
    }
    .client-meta-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px;
    }
    .client-meta-label {
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 4px;
    }
    .client-meta-value {
      font-size: 15px;
      font-weight: 600;
    }
    .client-detail-list-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
      font-size: 13px;
    }
    .client-detail-list-item:last-child {
      border-bottom: none;
    }
    .client-detail-list-name {
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 260px;
    }
    .client-detail-list-val {
      font-weight: 600;
    }

    /* Advanced CRM Features Upgrades Styles */
    .canvas-wrap {
      border: 1px dashed var(--border);
      border-radius: var(--radius-sm);
      background: #000000;
      position: relative;
      margin-top: 8px;
      overflow: hidden;
      height: 200px;
    }
    .signature-canvas {
      display: block;
      width: 100%;
      height: 100%;
      cursor: crosshair;
    }
    .hours-progress-wrap {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 6px;
      width: 100%;
    }
    .hours-progress-bar {
      height: 6px;
      border-radius: 3px;
      background: var(--surface2);
      width: 100%;
      overflow: hidden;
    }
    .hours-progress-fill {
      height: 100%;
      border-radius: 3px;
      transition: width 0.3s ease;
    }
    .hours-progress-fill.ok {
      background: var(--accent);
    }
    .hours-progress-fill.over {
      background: var(--accent2);
    }
    .hours-progress-text {
      font-size: 11px;
      color: var(--muted);
      display: flex;
      justify-content: space-between;
    }
    .receipt-view-btn {
      padding: 4px;
      background: transparent;
      border: none;
      color: var(--accent);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      transition: background 0.2s;
    }
    .receipt-view-btn:hover {
      background: var(--surface2);
    }
    /* Client Portal View */
    #client-portal-view {
      display: none;
      min-height: 100vh;
      background: #000000;
      color: #ffffff;
      font-family: inherit;
    }
    #client-portal-view.active {
      display: block;
    }
    .portal-container {
      max-width: 900px;
      margin: 0 auto;
      padding: 40px 20px;
    }
    .portal-header {
      border-bottom: 1px solid var(--border);
      padding-bottom: 24px;
      margin-bottom: 30px;
    }
    .portal-title {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -0.5px;
      margin: 0 0 8px 0;
    }
    .portal-subtitle {
      font-size: 14px;
      color: var(--muted);
      margin: 0;
    }
    .portal-grid {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 30px;
    }
    @media (max-width: 768px) {
      .portal-grid {
        grid-template-columns: 1fr;
      }
    }
    .portal-card {
      background: var(--surface1);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 24px;
      margin-bottom: 24px;
    }
    .portal-card-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 16px;
      color: var(--accent);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .portal-todo-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
    }
    .portal-todo-item:last-child {
      border-bottom: none;
    }
    .portal-todo-check {
      accent-color: var(--accent);
      margin-top: 3px;
      cursor: pointer;
    }
    .portal-todo-text {
      font-size: 13px;
      line-height: 1.5;
    }
    .portal-todo-text.done {
      text-decoration: line-through;
      color: var(--muted);
    }
    .runway-value-display {
      font-size: 32px;
      font-weight: 700;
      letter-spacing: -1px;
      margin: 12px 0;
      display: flex;
      align-items: baseline;
      gap: 6px;
    }
    .runway-value-display small {
      font-size: 14px;
      font-weight: 500;
      color: var(--muted);
    }
    .runway-status-risk {
      color: var(--accent2);
    }
    .runway-status-healthy {
      color: #ffffff;
    }
    .runway-status-excellent {
      color: var(--accent);
    }
    .todo-timer-btn {
      background: transparent;
      border: none;
      color: var(--muted);
      cursor: pointer;
      padding: 4px;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: color 0.2s, background-color 0.2s;
    }
    .todo-timer-btn:hover {
      color: var(--accent);
      background-color: var(--surface2);
    }
    .todo-timer-btn.active {
      color: var(--accent2);
      animation: pulse-timer 1.5s infinite;
    }
    @keyframes pulse-timer {
      0% { opacity: 1; }
      50% { opacity: 0.5; }
      100% { opacity: 1; }
    }

/* Tomato Pomodoro Timer */
.tomato-timer-wrap {
  position: relative;
  width: 240px;
  height: 258px;
  margin: 4px auto 18px;
}
.tomato-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
#t_ring_progress {
  transition: stroke-dashoffset 0.3s linear;
}
#t_ring_head {
  transition: cx 0.3s linear, cy 0.3s linear, opacity 0.4s ease;
  filter: drop-shadow(0 0 5px rgba(164, 216, 169, 0.75));
}
.tomato-face-content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 138px;
  text-align: center;
  pointer-events: none;
}
.tomato-face-content #t_clock {
  font-family: monospace;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  line-height: 1.1;
  display: inline-block;
  transition: color 0.3s ease;
}
/* Tiny per-second "heartbeat" on the digits, restarted from app.js whenever the
   displayed time actually changes. Purely decorative — no layout shift. */
.tomato-face-content #t_clock.tomato-clock-tick {
  animation: tomatoClockTick 0.4s ease-out;
}
@keyframes tomatoClockTick {
  0% { transform: scale(1.07); opacity: 0.82; }
  100% { transform: scale(1); opacity: 1; }
}
.tomato-face-content #t_status_indicator {
  font-size: 9px;
  color: var(--muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}
.tomato-face-content #t_money_container {
  font-size: 12px;
  color: var(--accent);
  margin-top: 7px;
  font-weight: 500;
}
.tomato-face-content #t_accrued_money {
  font-weight: 700;
}
/* One-shot "pop" when the timer transitions into a running state (start/resume) —
   the class is only re-applied when tomato-running actually toggles on, not on
   every per-second visual refresh, so this plays once per start, not every tick. */
.tomato-timer-wrap.tomato-running {
  animation: tomatoStartPop 0.5s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes tomatoStartPop {
  0% { transform: scale(0.94); }
  55% { transform: scale(1.035); }
  100% { transform: scale(1); }
}
.tomato-timer-wrap.tomato-running .tomato-svg {
  animation: tomatoPulse 1.8s ease-in-out infinite;
}
@keyframes tomatoPulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(164, 216, 169, 0)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 16px rgba(164, 216, 169, 0.45)); transform: scale(1.012); }
}
/* Brief celebratory flash when a pomodoro completes naturally, toggled from
   app.js alongside the alarm sound — purely visual, no functional change. */
.tomato-timer-wrap.tomato-complete-flash .tomato-svg {
  animation: tomatoCompleteFlash 0.9s ease-out;
}
@keyframes tomatoCompleteFlash {
  0% { filter: drop-shadow(0 0 0 rgba(164, 216, 169, 0)); transform: scale(1); }
  30% { filter: drop-shadow(0 0 26px rgba(164, 216, 169, 0.85)); transform: scale(1.045); }
  100% { filter: drop-shadow(0 0 0 rgba(164, 216, 169, 0)); transform: scale(1); }
}
@media (max-width: 480px) {
  .tomato-timer-wrap { width: 190px; height: 204px; }
  .tomato-face-content { width: 108px; }
  .tomato-face-content #t_clock { font-size: 19px; }
}

/* Notes Module */
.notes-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 20px 4px 16px;
}
.note-card {
  min-height: 170px;
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}
/* Slight scattered rotation so the grid still reads like real post-its */
.notes-grid-view .note-card:nth-child(4n+1) { transform: rotate(-1.4deg); }
.notes-grid-view .note-card:nth-child(4n+2) { transform: rotate(1deg); }
.notes-grid-view .note-card:nth-child(4n+3) { transform: rotate(-0.6deg); }
.notes-grid-view .note-card:nth-child(4n+4) { transform: rotate(1.6deg); }
.note-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 14px 14px 0;
  border-color: transparent rgba(0,0,0,0.14) transparent transparent;
  border-radius: 0 var(--radius) 0 6px;
  pointer-events: none;
}
.note-card:hover {
  transform: translateY(-6px) scale(1.03) rotate(0deg) !important;
  box-shadow: 0 12px 24px rgba(0,0,0,0.24);
  z-index: 2;
}
.note-card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
  color: #111;
  padding-right: 10px;
}
.note-card-content {
  font-size: 12px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
}
.note-card-content ul, .note-card-content ol { padding-left: 18px; margin: 4px 0; }
.note-card-meta {
  font-size: 10px;
  color: rgba(0,0,0,0.5);
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(0,0,0,0.05);
  padding-top: 8px;
}
html[data-theme="light"] .note-card {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
/* Note Colors */
.note-color-matcha { background: #d3ead6; color: #111; }
.note-color-pink { background: #ffe4e9; color: #111; }
.note-color-yellow { background: #fff0c7; color: #111; }
.note-color-blue { background: #d7efff; color: #111; }
.note-color-gray { background: #f0f0f0; color: #111; }
.note-color-dark { background: #222; color: #fff; }
.note-color-dark .note-card-title { color: #fff; }
.note-color-dark .note-card-content { color: #ddd; }
.note-color-dark .note-card-meta { color: rgba(255,255,255,0.5); border-top-color: rgba(255,255,255,0.1); }

/* Note stacks: multiple notes grouped by project, shown as a post-it pile */
.note-stack-outer { position: relative; cursor: pointer; }
.note-stack-outer .note-card { position: relative; z-index: 1; }
.note-stack-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  transition: transform 0.2s;
}
.note-stack-layer-1 { transform: rotate(4deg) translate(5px, 4px); z-index: 0; }
.note-stack-layer-2 { transform: rotate(-5deg) translate(-4px, 6px); z-index: -1; opacity: 0.92; }
.note-stack-outer:hover .note-stack-layer-1 { transform: rotate(7deg) translate(9px, 7px); }
.note-stack-outer:hover .note-stack-layer-2 { transform: rotate(-8deg) translate(-9px, 10px); }
.note-stack-badge {
  position: absolute;
  top: -9px; right: -9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 2;
}

.color-picker-circles { display: flex; gap: 8px; margin-top: 6px; }
.color-circle {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.2s;
}
.color-circle:hover { transform: scale(1.1); }
.color-circle.selected { border-color: var(--accent); transform: scale(1.2); }

/* Note editor modal */
.modal-note { width: 640px; }
.note-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 6px 8px;
}
.note-tb-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .15s;
}
.note-tb-btn:hover { background: var(--border); }
.note-tb-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.note-tb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

.note-editor {
  min-height: 150px;
  max-height: 340px;
  overflow-y: auto;
  line-height: 1.5;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
  border-top: none !important;
}
.note-editor:focus { border-color: var(--accent); }
.note-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.note-editor ul, .note-editor ol { padding-left: 22px; margin: 6px 0; }
.note-editor li { margin-bottom: 2px; }

/* Empty state for the notes page */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .ico {
  display: block;
  font-size: 36px;
  margin-bottom: 10px;
}
.empty-state p { font-size: 13px; margin: 2px 0; }

@media (max-width: 640px) {
  .notes-grid-view {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
}
