@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Motion IT brand gold scale */
  --gold-1: #B8A574;
  --gold-2: #8B7D5F;
  --gold-3: #6B6345;

  /* Kept as the "primary accent" variable used throughout component rules;
     gold-deep is used here (not the lighter primary gold) specifically so
     that white text/icons placed directly on it stay WCAG AA compliant —
     verified at 6:1, well clear of the 4.5:1 minimum. */
  --indigo: #6B6345;
  --indigo-tint: #F3ECDD;
  --teal: #27AE60;
  --teal-tint: #E7F6EE;
  --coral: #E74C3C;
  --coral-tint: #FCEBE9;
  --violet: #3498DB;
  --violet-tint: #E8F2FB;

  --shadow: 0 1px 3px rgba(43,43,43,0.08);
  --shadow-lg: 0 8px 24px rgba(43,43,43,0.15);

  --page-bg: #F9F8F6;
  --ink: #2B2B2B;
  --ink-soft: #3F3F3F;
  --muted: #5A5A5A;
  --hairline: #E8E8E8;
  --card: #FFFFFF;
  --card-border: #E8E8E8;

  --sidebar-bg: #FFFFFF;
  --sidebar-border: #E8E8E8;
  --sidebar-text: #5A5A5A;
  --sidebar-text-dim: #5A5A5A;
  --sidebar-heading: #8B7D5F;
  --sidebar-active-bg: #F3ECDD;
  --sidebar-active-text: #6B6345;
  --sidebar-hover: #F9F8F6;
  --sidebar-glow: none;

  --hero-bg: linear-gradient(140deg, #20232A 0%, #2C3037 48%, #161A20 100%);
  --hero-text: #FFFFFF;
  --hero-sub: rgba(255,255,255,0.72);
  --hero-glow: radial-gradient(120% 140% at 88% 8%, rgba(184,165,116,0.22) 0%, transparent 42%);
  --hero-pill-bg: rgba(255,255,255,0.1);
  --hero-pill-border: rgba(184,165,116,0.3);

  --chip-icon-btn: #FFFFFF;

  --gold: var(--indigo);
  --gold-light: #B8A574;
  --gold-dark: var(--indigo);
  --dark: #2B2B2B;
  --dark-light: #3A3A3A;
  --cream: transparent;
  --white: var(--card);
  --surface-2: #F9F8F6;
  --kanban-bg: #F9F8F6;
  --line: var(--hairline);
  --text-strong: var(--ink);
  --hover-bg: #F9F8F6;
  --hover-tint: var(--indigo-tint);
  --danger: var(--coral);
  --danger-bg: var(--coral-tint);
  --danger-text: #B5341F;
  --success: var(--teal);
  --success-bg: var(--teal-tint);
  --success-text: #1C7A44;
  --warn-bg: #FDF1DF;
  --badge-neutral-bg: var(--indigo-tint);
  --badge-neutral-text: var(--indigo);
  --badge-medium-bg: #FDF1DF;
  --badge-medium-text: #A76A08;
  --status-invoiced-bg: #F5EDD8;
  --status-invoiced-text: #7A5D15;
  --status-expired-bg: #EDEBE7;
  --status-expired-text: #575757;
  --status-draft-bg: #EDEBE7;
  --status-draft-text: #5A5A5A;
  --docref-color: #1F6FA8;
  --pill-orange-bg: #FDF1DF;
  --pill-orange-text: #A76A08;
  --pill-purple-bg: var(--violet-tint);
  --pill-purple-text: #1F6FA8;
  --pill-amber-bg: #FDF1DF;
  --pill-amber-text: #A76A08;
  --sidebar-w: 250px;
  --radius: 12px;
  --radius-sm: 6px;
  color-scheme: light;
}

body.dark-mode {
  --page-bg: #15171B;
  --ink: #EDEEF0;
  --ink-soft: #C7C9CD;
  --muted: #A6AAB2;
  --hairline: #2C3037;
  --card: #1D2025;
  --card-border: #2C3037;

  --indigo-tint: #2E2A20;
  --teal-tint: #12301F;
  --coral-tint: #331A16;
  --violet-tint: #152A3B;

  --sidebar-bg: #1A1D22;
  --sidebar-border: #2C3037;
  --sidebar-text: #A6AAB2;
  --sidebar-text-dim: #A6AAB2;
  --sidebar-heading: #D6C393;
  --sidebar-active-bg: #2E2A20;
  --sidebar-active-text: #D6C393;
  --sidebar-hover: #22262C;
  --sidebar-glow: none;

  --hero-bg: linear-gradient(140deg, #181B21 0%, #22262E 48%, #0E1015 100%);
  --hero-text: #F5F2FF;
  --hero-sub: rgba(245,242,255,0.72);
  --hero-glow: radial-gradient(120% 140% at 88% 8%, rgba(184,165,116,0.18) 0%, transparent 42%);
  --hero-pill-bg: rgba(255,255,255,0.08);
  --hero-pill-border: rgba(184,165,116,0.22);

  --chip-icon-btn: #22262C;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);

  --dark: #15171B;
  --dark-light: #1D2025;
  --white: var(--card);
  --surface-2: #22262C;
  --kanban-bg: #22262C;
  --hover-bg: #22262C;
  --hover-tint: var(--indigo-tint);
  --danger-text: #E8796A;
  --success-text: #5BD08A;
  --badge-neutral-bg: var(--indigo-tint);
  --badge-neutral-text: #D6C393;
  --badge-medium-bg: #332611;
  --badge-medium-text: #E0A93E;
  --status-invoiced-bg: #332A14;
  --status-invoiced-text: #E0C170;
  --status-expired-bg: #2A2D32;
  --status-expired-text: #ABAFB6;
  --status-draft-bg: #2C3037;
  --status-draft-text: #B0B4BA;
  --docref-color: #6FB4E8;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode):not(.dark-mode) {
    --page-bg: #15171B;
    --ink: #EDEEF0; --ink-soft: #C7C9CD; --muted: #A6AAB2; --hairline: #2C3037;
    --card: #1D2025; --card-border: #2C3037;
    --indigo-tint: #2E2A20; --teal-tint: #12301F; --coral-tint: #331A16; --violet-tint: #152A3B;
    --sidebar-bg: #1A1D22;
    --sidebar-border: #2C3037; --sidebar-text: #A6AAB2; --sidebar-text-dim: #A6AAB2; --sidebar-heading: #D6C393;
    --sidebar-active-bg: #2E2A20; --sidebar-active-text: #D6C393;
    --sidebar-hover: #22262C; --sidebar-glow: none;
    --hero-bg: linear-gradient(140deg, #181B21 0%, #22262E 48%, #0E1015 100%); --hero-text: #F5F2FF; --hero-sub: rgba(245,242,255,0.72);
    --hero-glow: radial-gradient(120% 140% at 88% 8%, rgba(184,165,116,0.18) 0%, transparent 42%);
    --hero-pill-bg: rgba(255,255,255,0.08); --hero-pill-border: rgba(184,165,116,0.22); --chip-icon-btn: #22262C;
    --dark: #15171B; --dark-light: #1D2025; --white: var(--card); --surface-2: #22262C; --kanban-bg: #22262C;
    --hover-bg: #22262C;
    --badge-medium-bg: #332611; --badge-medium-text: #E0A93E; --badge-neutral-bg: var(--indigo-tint); --badge-neutral-text: #D6C393;
    --status-invoiced-bg: #332A14; --status-invoiced-text: #E0C170;
    --status-expired-bg: #2A2D32; --status-expired-text: #ABAFB6;
    --status-draft-bg: #2C3037; --status-draft-text: #B0B4BA;
    --docref-color: #6FB4E8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: 'Inter', -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, .btn, .stat-value, .panel-title, .crumb { font-family: 'Inter', sans-serif; font-weight: 600; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--sidebar-border);
  z-index: 30;
  overflow: hidden;
}
.sidebar::before { content: ""; position: absolute; inset: 0; background: var(--sidebar-glow); pointer-events: none; }

.sidebar-brand { padding: 24px 20px 18px; position: relative; }
.sidebar-brand img { display: block; max-width: 100%; height: auto; margin: 0 auto; }

.sidebar-nav { flex: 1; padding: 6px 16px; overflow-y: auto; position: relative; }
.sidebar-nav .nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; font-weight: 700;
  color: var(--sidebar-heading); padding: 16px 10px 8px;
}
.sidebar-nav .nav-section:first-child { padding-top: 4px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; border-radius: 11px; margin-bottom: 2px;
  color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: background .15s ease;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); text-decoration: none; }
.sidebar-nav a.active {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600;
  box-shadow: inset 2.5px 0 0 var(--indigo);
}
.sidebar-nav a .icon {
  width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.icon-svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--sidebar-border); font-size: 12.5px; position: relative; }
.sidebar-foot .user-name { color: var(--ink); font-weight: 600; }
.sidebar-foot .user-role { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .8px; }
.sidebar-foot a { color: var(--muted); font-size: 12px; }

.theme-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 20px 14px; }
.theme-toggle .label { color: var(--sidebar-text); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--hairline); border-radius: 20px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 15px; width: 15px; left: 2.5px; bottom: 2.5px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .slider { background: linear-gradient(90deg, var(--indigo), var(--violet)); }
.switch input:checked + .slider::before { transform: translateX(16px); background: #F5F2FF; }

.hamburger-btn { display: none; background: none; border: none; cursor: pointer; padding: 8px; margin: -8px; }
.hamburger-btn span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }
.sidebar-overlay { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: transparent; border-bottom: none;
  padding: 26px 34px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.topbar .breadcrumb { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 15px; color: var(--ink); }
.topbar .breadcrumb strong { color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.content { padding: 22px 34px 40px; max-width: 1400px; width: 100%; margin: 0 auto; }

h1 { font-size: 25px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.2px; overflow-wrap: break-word; }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 15.5px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
h4 { font-size: 13px; font-weight: 700; margin: 16px 0 8px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; width: 100%; box-sizing: border-box; }
.page-header > div { min-width: 0; max-width: 100%; }
.page-subtitle { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.6px; font-size: 10.5px; color: var(--indigo); font-weight: 700; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-flat { border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 18px 20px; background: var(--card); }
.stat-card { text-align: left; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 11px 6px; border-bottom: 1px solid var(--hairline); text-align: left; }
table th { background: transparent; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .8px; font-weight: 700; }
table tr:hover td { background: var(--hover-bg); }
.table-wrap { border: 1px solid var(--card-border); border-radius: var(--radius); overflow-x: auto; }
.table-wrap table { margin: 0; min-width: 560px; padding: 0 6px; }
.table-wrap .card { box-shadow: none; border: none; margin: 0; padding: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--indigo);
  background: linear-gradient(145deg, #bda675, #a08a5f); color: #1B1720; cursor: pointer;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  transition: all .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); text-decoration: none; }
.btn-outline { background: transparent; color: var(--indigo); border-color: var(--indigo); }
.btn-outline:hover { background: var(--indigo-tint); }
.btn-danger { background: linear-gradient(145deg, #F27C72, #E24F45); border-color: var(--coral); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--card-border); }
.btn-secondary:hover { background: var(--hover-bg); }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-dark { background: linear-gradient(145deg, var(--gold-1), var(--gold-3)); border-color: var(--gold-2); color: #3A2C10; }

.badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 800;
  background: var(--badge-neutral-bg); color: var(--badge-neutral-text);
}
.badge-draft { background: var(--indigo-tint); color: var(--indigo); }
.badge-issued, .badge-in_progress, .badge-viewed, .badge-waiting_customer, .badge-waiting_approval, .badge-high { background: var(--badge-medium-bg); color: var(--badge-medium-text); }
.badge-approved, .badge-client_approved, .badge-executed, .badge-closed_won, .badge-resolved, .badge-closed { background: var(--teal-tint); color: var(--teal); }
.badge-rejected, .badge-client_rejected, .badge-closed_lost, .badge-expired, .badge-critical { background: var(--coral-tint); color: var(--coral); }
.badge-medium { background: var(--badge-medium-bg); color: var(--badge-medium-text); }
.badge-low, .badge-new { background: var(--indigo-tint); color: var(--indigo); }
.badge-triaged, .badge-investigating, .badge-scheduled, .badge-submitted, .badge-cab_review, .badge-identified, .badge-monitoring, .badge-implementation, .badge-post_implementation_review { background: var(--violet-tint); color: var(--violet); }
.badge-outline { background: var(--card); border: 1px solid var(--card-border); color: var(--muted); }
body.dark-mode .badge-medium, body.dark-mode .badge-issued, body.dark-mode .badge-in_progress, body.dark-mode .badge-high { color: #F0CE7E; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
  padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; text-decoration: none; margin-bottom: -1px; white-space: nowrap;
}
.tabs a.active { color: var(--ink); border-bottom-color: var(--indigo); }
.tabs a:hover { color: var(--ink); text-decoration: none; }
/* Pill-style tabs: colored, filled when active — used where tabs represent
   distinct status groups (Draft/Issued/Accepted/Agreed/...) and benefit
   from being visually distinct at a glance rather than plain text tabs. */
.tabs-pill { display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto; border-bottom: none; flex-wrap: wrap; }
.tabs-pill a {
  padding: 8px 16px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  border-radius: 20px; text-decoration: none; border: 1.5px solid var(--card-border);
  color: var(--ink-soft); background: var(--card); transition: all .15s ease;
}
.tabs-pill a:hover { text-decoration: none; border-color: var(--tab-color, var(--indigo)); color: var(--ink); }
.tabs-pill a.active { background: var(--tab-color, var(--indigo)); border-color: var(--tab-color, var(--indigo)); color: #fff; box-shadow: var(--shadow); }

.form-group { margin-bottom: 15px; min-width: 0; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; background: var(--card); color: var(--ink);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(107,99,69,0.18);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.flash-success { background: var(--teal-tint); border: 1px solid var(--teal); color: var(--success-text); padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13.5px; }
.flash-error { background: var(--coral-tint); border: 1px solid var(--coral); color: var(--danger-text); padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13.5px; }

.line-items-table { table-layout: fixed; width: 100%; }
.line-items-table input { border: 1px solid var(--card-border); padding: 7px; width: 100%; border-radius: 8px; background: var(--card); color: var(--ink); box-sizing: border-box; }
.line-items-table select { width: 100%; box-sizing: border-box; }
.line-items-table td:not(:first-child) { overflow: hidden; }
.catalog-search { max-width: 100%; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); font-size: 13px; }
.mono { font-family: "SF Mono", "Courier New", monospace; letter-spacing: .3px; font-size: 12.5px; }

.welcome-banner {
  position: relative; border-radius: 24px; padding: 30px 34px;
  background: var(--hero-glow), var(--hero-bg); color: var(--hero-text);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  box-shadow: var(--shadow-lg); margin-bottom: 26px; overflow: hidden;
}
.welcome-banner > * { position: relative; z-index: 1; }
.welcome-banner h1 { color: var(--hero-text); margin-bottom: 6px; font-family: 'Inter', sans-serif; }
.welcome-banner p { color: var(--hero-sub); margin: 0; font-size: 14px; max-width: 480px; }
.welcome-banner .date-chip { background: var(--hero-pill-bg); border: 1px solid var(--hero-pill-border); border-radius: 12px; padding: 9px 16px; font-size: 12.5px; font-weight: 600; color: var(--hero-text); backdrop-filter: blur(4px); white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.quick-action {
  background: var(--card); border-radius: 18px; padding: 18px;
  display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); border: 1px solid var(--card-border);
  transition: transform .15s ease, box-shadow .15s ease;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.quick-action .qa-icon { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--indigo-tint); color: var(--indigo); }
.quick-action .qa-icon .icon-svg { width: 20px; height: 20px; }
.quick-action .qa-label { font-weight: 700; font-size: 14px; }
.quick-action .qa-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-tile { border-radius: 20px; padding: 20px 20px 18px; box-shadow: var(--shadow); border: 1px solid var(--card-border); position: relative; overflow: hidden; min-width: 0; }
.main-tile-pipeline { background: var(--indigo-tint); }
.main-tile-won { background: var(--teal-tint); }
.main-tile-tickets { background: var(--violet-tint); }
.main-tile-customers { background: var(--badge-medium-bg); }
.main-tile-pipeline .stat-icon { background: rgba(107,99,69,0.16); color: var(--indigo); }
.main-tile-won .stat-icon { background: rgba(39,174,96,0.16); color: var(--success-text); }
.main-tile-tickets .stat-icon { background: rgba(52,152,219,0.16); color: var(--pill-purple-text); }
.main-tile-customers .stat-icon { background: rgba(139,125,95,0.18); color: var(--indigo); }
.stat-tile .stat-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; background: var(--indigo-tint); color: var(--indigo); }
.stat-tile .stat-icon .icon-svg { width: 18px; height: 18px; }
.stat-tile .stat-label { font-size: 11.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .7; }
.stat-tile .stat-value { font-family: 'Inter', sans-serif; font-size: 28px; font-weight: 700; margin: 6px 0 4px; color: var(--ink); }
.stat-tile .stat-trend { font-size: 12px; opacity: .75; }

/* Timesheet Dashboard */
.ts-total-highlight { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, var(--indigo-tint), var(--teal-tint)); border: 1px solid var(--card-border); margin-bottom: 20px; }
.ts-total-icon { width: 54px; height: 54px; border-radius: 14px; background: var(--indigo); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ts-total-icon .icon-svg { width: 26px; height: 26px; }
.ts-total-value { font-size: 34px; font-weight: 800; color: var(--ink); margin: 4px 0 2px; }
.ts-tile-regular { background: var(--indigo-tint); }
.ts-tile-project { background: var(--badge-medium-bg); }
.ts-tile-remote { background: var(--violet-tint); }
.ts-tile-onsite { background: var(--coral-tint); }
.ts-tile-total { background: var(--indigo-tint); }
.ts-tile-total .stat-icon { background: rgba(107,99,69,0.16); color: var(--indigo); }

.inv-tile-total { background: var(--indigo-tint); }
.inv-tile-quotes { background: var(--violet-tint); }
.inv-tile-tickets { background: var(--badge-medium-bg); }
.inv-tile-timesheets { background: var(--teal-tint); }
.inv-tile-total .stat-icon { background: rgba(107,99,69,0.16); color: var(--indigo); }
.inv-tile-quotes .stat-icon { background: rgba(52,152,219,0.16); color: var(--pill-purple-text); }
.inv-tile-tickets .stat-icon { background: rgba(167,106,8,0.16); color: var(--badge-medium-text); }
.inv-tile-timesheets .stat-icon { background: rgba(39,174,96,0.16); color: var(--success-text); }
.ts-tile-regular .stat-icon { background: rgba(107,99,69,0.16); color: var(--indigo); }
.ts-tile-project .stat-icon { background: rgba(167,106,8,0.16); color: var(--badge-medium-text); }
.ts-tile-remote .stat-icon { background: rgba(52,152,219,0.16); color: var(--pill-purple-text); }
.ts-tile-onsite .stat-icon { background: rgba(231,76,60,0.14); color: var(--danger-text); }

.engagement-details-compact h4 { margin: 14px 0 8px; }
.engagement-details-compact h4:first-of-type { margin-top: 4px; }
.engagement-details-compact .form-group { margin-bottom: 10px; }
.engagement-details-compact .grid-3, .engagement-details-compact .grid-2 { gap: 12px; margin-bottom: 4px; }

.ts-cat-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.ts-cat-bar > div { height: 100%; transition: width 0.2s ease; }
.ts-cat-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.ts-cat-legend span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.ts-cat-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

.key-chip { display: inline-block; font-family: monospace; font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 6px; background: #1B1720; color: #6fb4e8; text-decoration: none; }
.key-chip:hover { background: #2E2A38; color: #8FC5EE; }

/* Quote Builder section styling - replaces the previous plain black/white
   look with a colored left-border + tinted header per section, cycling
   through the app's established brand palette for visual variety. */
.qb-section { border-left: 4px solid var(--qb-accent, var(--indigo)); background: var(--qb-tint, var(--indigo-tint)); border-radius: 8px; padding: 14px 16px 18px; margin-bottom: 18px; }
.qb-section > h3 { margin-top: 0; margin-bottom: 4px; color: var(--qb-accent-text, var(--indigo)); }
.qb-section input:not([type=hidden]), .qb-section select, .qb-section textarea {
  background: var(--card); border-color: var(--qb-accent, var(--indigo)); border-width: 1px;
}
.qb-section input:not([type=hidden]):focus, .qb-section select:focus, .qb-section textarea:focus {
  outline: none; box-shadow: 0 0 0 3px var(--qb-tint, var(--indigo-tint));
}
.qb-1 { --qb-accent: var(--indigo); --qb-tint: var(--indigo-tint); --qb-accent-text: var(--indigo); }
.qb-2 { --qb-accent: var(--badge-medium-text); --qb-tint: var(--badge-medium-bg); --qb-accent-text: var(--badge-medium-text); }
.qb-3 { --qb-accent: var(--pill-purple-text); --qb-tint: var(--violet-tint); --qb-accent-text: var(--pill-purple-text); }
.qb-4 { --qb-accent: var(--success-text); --qb-tint: var(--teal-tint); --qb-accent-text: var(--success-text); }

.drop-zone { border: 2px dashed var(--card-border); border-radius: 10px; padding: 18px; text-align: center; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; background: var(--surface-2); }
.drop-zone:hover { border-color: var(--indigo); }
.drop-zone.drag-active { border-color: var(--indigo); background: var(--indigo-tint); }
.drop-zone .drop-zone-icon { color: var(--muted); margin-bottom: 6px; }
.drop-zone.drag-active .drop-zone-icon { color: var(--indigo); }
.drop-zone-label { font-size: 13px; color: var(--muted); }
.drop-zone-label strong { color: var(--indigo); }
.drop-zone-filename { font-size: 12px; color: var(--ink); margin-top: 6px; font-weight: 600; }

/* IT Audit Dashboard */
.aud-tile-total { background: var(--indigo-tint); }
.aud-tile-total .stat-icon { background: rgba(107,99,69,0.16); color: var(--indigo); }
.aud-tile-pass { background: var(--teal-tint); }
.aud-tile-defects { background: var(--badge-medium-bg); }
.aud-tile-fail { background: var(--coral-tint); }
.aud-tile-pass .stat-icon { background: rgba(39,174,96,0.16); color: var(--success-text); }
.aud-tile-defects .stat-icon { background: rgba(167,106,8,0.16); color: var(--badge-medium-text); }
.aud-tile-fail .stat-icon { background: rgba(231,76,60,0.16); color: var(--danger-text); }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.bar-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink); }
.bar-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }

.ts-split-grid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; align-items: start; margin-bottom: 20px; }
@media (max-width: 760px) { .ts-split-grid { grid-template-columns: 1fr; } }

.kanban { display: grid; gap: 10px; align-items: start; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 4px; }
.project-card {
  display: block; background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.pc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pc-name { font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 4px; line-height: 1.35; }
.pc-customer { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
.pc-progress-track { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-bottom: 10px; }
.pc-progress-fill { height: 100%; border-radius: 4px; }
.pc-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.pc-amount { font-weight: 700; color: var(--ink); }
.pc-due { font-size: 11px; margin-top: 8px; }
.pc-view-btn { display: block; width: 100%; box-sizing: border-box; text-align: center; margin-top: 14px; }
.proj-tile-active { background: var(--indigo-tint); }
.proj-tile-planning { background: var(--badge-medium-bg); }
.proj-tile-budget { background: var(--violet-tint); }
.proj-tile-total { background: var(--teal-tint); }
@media (max-width: 640px) { .project-grid { grid-template-columns: 1fr; } }
.xero-zone {
  background: linear-gradient(180deg, rgba(19,181,234,0.06), rgba(19,181,234,0.02));
  border: 1.5px solid rgba(19,181,234,0.28) !important;
  border-radius: var(--radius);
  position: relative;
  padding-left: 26px !important;
}
body.dark-mode .xero-zone { background: linear-gradient(180deg, rgba(19,181,234,0.12), rgba(19,181,234,0.04)); }
@media (prefers-color-scheme: dark) {
  body:not(.light-mode):not(.dark-mode) .xero-zone { background: linear-gradient(180deg, rgba(19,181,234,0.12), rgba(19,181,234,0.04)); }
}

.xero-zone::before {
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px;
  background: #13B5EA; border-radius: 0 4px 4px 0;
}
.xero-badge {
  display: inline-flex; align-items: center; gap: 6px; background: #13B5EA; color: #fff;
  padding: 4px 11px; border-radius: 20px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px;
  vertical-align: middle; margin-left: 8px;
}
.xero-zone input, .xero-zone select, .xero-zone textarea { border-color: rgba(19,181,234,0.25) !important; }
.xero-zone input:focus, .xero-zone select:focus { border-color: #13B5EA !important; box-shadow: 0 0 0 3px rgba(19,181,234,0.14) !important; }
.xero-zone .btn { background: #13B5EA !important; }

.catalog-results-dropdown {
  position: absolute; top: 100%; left: 0; min-width: 260px; max-width: 320px; z-index: 20;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.14); max-height: 220px; overflow-y: auto; margin-top: 2px;
}
.catalog-results-dropdown.hidden { display: none; }
.cr-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.cr-item:hover { background: rgba(107,99,69,0.08); }
.cr-item .cr-price { color: var(--muted); font-family: monospace; flex-shrink: 0; }
.cr-empty { padding: 8px 10px; font-size: 12px; color: var(--muted); }

.ts-group-card { padding: 0; overflow: hidden; margin-bottom: 16px; }
.ts-group-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; }
.ts-group-head .count-pill { background: rgba(255,255,255,0.35); border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.ts-list-table { width: 100%; }
.ts-row { cursor: pointer; transition: background 0.1s ease; }
.ts-row:hover { background: rgba(107,99,69,0.045); }
.ts-row-logo { max-width: 40px; max-height: 34px; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.ts-company-name { font-weight: 700; color: var(--ink); font-size: 13.5px; }
.ts-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.qd-search-box { position: relative; max-width: 420px; }
.qd-search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.qd-search-box input { width: 100%; padding: 10px 14px 10px 36px; border: 1.5px solid var(--card-border); border-radius: 10px; background: var(--card); font-size: 13.5px; color: var(--ink); }
.qd-search-box input:focus { outline: none; border-color: var(--indigo, #6B6345); box-shadow: 0 0 0 3px rgba(107,99,69,0.14); }
.qd-table-card { padding: 0; overflow: hidden; }
.qd-table-card table { width: 100%; }
.qd-row { cursor: pointer; transition: background 0.1s ease; }
.qd-row:hover { background: rgba(107,99,69,0.05); }
.qd-docref { display: inline-block; font-family: monospace; font-weight: 800; color: var(--docref-color); font-size: 12.5px; letter-spacing: 0.2px; padding: 4px 10px; border-radius: 6px; background: var(--violet-tint); }
.qd-cust-cell { display: flex; align-items: center; gap: 10px; }
.qd-cust-name { font-weight: 600; }
.qd-price { font-weight: 700; font-family: monospace; }
.qd-mobile-card { display: block; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 13px; text-decoration: none; color: inherit; box-shadow: var(--shadow); margin-bottom: 10px; }
.qd-mobile-card:active { background: var(--surface-2); }
.qd-mc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.qd-mc-price { font-weight: 800; font-size: 14px; font-family: monospace; color: var(--ink); }
.qd-mc-cust { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.qd-mc-bottom { display: flex; justify-content: space-between; align-items: center; }

.mobile-card-list { display: none; }
.inv-card-list { display: none; }

@media (max-width: 640px) {
  .mobile-hide-table { display: none; }
  .mobile-card-list { display: flex; flex-direction: column; gap: 10px; }
  .inv-card-list { display: flex; flex-direction: column; gap: 10px; }
  .inv-card { display: block; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
  .inv-card:active { background: var(--surface-2); }
  .inv-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .inv-tag { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 12px; }
  .inv-amount { font-weight: 800; font-size: 15px; font-family: monospace; color: var(--ink); }
  .inv-ref { font-family: monospace; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
  .inv-customer { font-weight: 600; font-size: 13.5px; color: var(--ink); margin-bottom: 6px; }
  .inv-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .mobile-ticket-card {
    display: block; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px;
    padding: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  }
  .mobile-ticket-card:active { background: var(--surface-2); }
  .mtc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .mtc-key { font-size: 11px; color: var(--muted); }
  .mtc-subject { font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 10px; line-height: 1.35; }
  .mtc-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
  .mtc-customer { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
  .mtc-badges { display: flex; gap: 6px; flex-wrap: wrap; }

  .kanban { grid-auto-flow: column; grid-auto-columns: 85vw; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
  .kanban-col { scroll-snap-align: start; }
  .kanban-card { padding: 14px; font-size: 13px; }
  .kanban-card .kc-subject { font-size: 14px; }
}
.kanban-col { min-width: 0; background: var(--kanban-bg); border-radius: var(--radius-sm); padding: 10px; border-top: 3px solid var(--hairline); transition: background 0.12s ease; }
.kanban-col.kanban-col-dragover { background: var(--indigo-tint); }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-col[data-stage="early"] { border-top-color: var(--muted); }
.kanban-col[data-stage="progress"] { border-top-color: var(--gold-1); }
.kanban-col[data-stage="done"] { border-top-color: var(--teal); }
.kanban-col-head { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 4px 4px 8px; display: flex; justify-content: space-between; gap: 4px; }
.kanban-col-head .count-pill { background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 1px 9px; font-size: 10.5px; font-weight: 700; color: var(--ink); }
.kanban-card { background: var(--card); border: 1px solid var(--card-border); border-left: 3px solid var(--hairline); border-radius: 10px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); font-size: 11.5px; min-width: 0; }
.kanban-card[data-priority="critical"] { border-left-color: var(--coral); }
.kanban-card[data-priority="high"] { border-left-color: var(--gold-1); }
.kanban-card[data-priority="medium"] { border-left-color: var(--gold-2); }
.kanban-card[data-priority="low"] { border-left-color: var(--muted); }
.kanban-card:hover { box-shadow: var(--shadow-lg); }
.kanban-card .kc-key { font-family: monospace; color: var(--muted); font-size: 10px; }
.kanban-card .kc-subject { font-weight: 600; margin: 4px 0 8px; color: var(--ink); overflow-wrap: break-word; line-height: 1.35; }

.kanban-card-sub { margin-left: 22px; position: relative; }
.kanban-card-sub::before {
  content: ''; position: absolute; left: -14px; top: -9px; width: 12px; height: 22px;
  border-left: 2px solid var(--indigo); border-bottom: 2px solid var(--indigo);
  border-radius: 0 0 0 8px; opacity: 0.55;
}
.kanban-card-sub-label { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--indigo); font-weight: 600; margin-bottom: 4px; }

.task-checklist-popup {
  position: fixed; z-index: 200; background: var(--card); border: 1px solid var(--card-border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 12px 14px; width: 240px; max-height: 280px; overflow-y: auto;
  pointer-events: auto;
}
.task-checklist-popup.hidden { display: none; }
.task-checklist-popup .tcp-title { font-size: 11.5px; font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.task-checklist-popup .tcp-item { display: flex; align-items: flex-start; gap: 7px; padding: 4px 0; font-size: 12px; }
.task-checklist-popup .tcp-item input[type=checkbox] { margin-top: 2px; cursor: pointer; }
.task-checklist-popup .tcp-item span.done { text-decoration: line-through; color: var(--muted); }
.task-checklist-popup .tcp-empty { font-size: 12px; color: var(--muted); }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0; text-transform: uppercase; font-family: 'Inter', sans-serif; }
.avatar-lg { width: 38px; height: 38px; font-size: 13px; }

.board-group { margin-bottom: 18px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--card-border); }
.board-group-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: #fff; }
.board-group-head .count { background: rgba(255,255,255,0.25); border-radius: 20px; padding: 1px 10px; font-size: 11px; }
.board-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--card); border-bottom: 1px solid var(--hairline); transition: background .1s ease; }
.board-row:last-child { border-bottom: none; }
.board-row:hover { background: var(--hover-bg); }
.board-row .br-main { flex: 1; min-width: 0; }
.board-row .br-title { font-weight: 700; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .br-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.board-row .br-meta { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.board-row .br-amount { font-weight: 700; font-size: 13.5px; min-width: 90px; text-align: right; }

@media (max-width: 1024px) {
  .content { padding: 18px 24px 32px; }
  .quick-actions, .stat-grid, .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .hamburger-btn { display: block; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: -290px; width: 272px; transition: left .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 25; }
  .sidebar-overlay.open { display: block; }
  .topbar { padding: 16px 18px 0; }
  .content { padding: 16px 18px 28px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  table th, table td { padding: 9px 6px; font-size: 12.5px; }
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .welcome-banner { flex-direction: column; align-items: flex-start; }
  .tabs { -webkit-mask-image: linear-gradient(to right, black 88%, transparent 100%); mask-image: linear-gradient(to right, black 88%, transparent 100%); }
}

@media (max-width: 700px) {
  .board-row { flex-wrap: wrap; }
  .board-row .br-meta { width: 100%; justify-content: space-between; margin-top: 6px; }
}

@media (max-width: 560px) {
  html, body { font-size: 13.5px; }
  .card { padding: 16px; }
  h1 { font-size: 21px; }
  .quick-actions, .stat-grid, .stat-grid-4 { grid-template-columns: 1fr; }
  .btn, .form-group input, .form-group select, .form-group textarea, .sidebar-nav a { min-height: 42px; }
  .btn { width: 100%; justify-content: center; }
  .page-header .btn { width: auto; }
  .payment-stage { width: 100% !important; margin-right: 0 !important; margin-bottom: 10px; }
  .party-box, .sig-box { padding: 14px; }
}

@media print {
  .sidebar, .topbar, .hamburger-btn { display: none !important; }
}

/* Project phases */
.phase-section { margin-bottom: 22px; }
.phase-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; padding:10px 14px; margin-bottom:10px; border-left:4px solid #bda675; background:var(--surface-2, rgba(189,166,117,.08)); border-radius:6px; }
.phase-head-main { min-width:0; flex:1 1 260px; }
.phase-title { font-size:15px; font-weight:700; display:flex; align-items:center; gap:8px; }
.phase-num { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:#1B1720; color:#bda675; font-size:12px; font-weight:700; }
.phase-actions { display:flex; gap:6px; flex-wrap:wrap; }
.phase-actions form { margin:0; }
.phase-row td { background:var(--surface-2, rgba(189,166,117,.08)); border-left:4px solid #bda675; }
