/* v2 - edit lead + create lead upload */
:root{
  --navy:#0f172a; --navy2:#1e293b; --orange:#ff9f2e; --orange2:#f97316;
  --bg:#f4f6f9; --card:#ffffff; --border:#e5e7eb; --text:#111827;
  --muted:#64748b; --green:#16a34a; --red:#dc2626; --blue:#2563eb;
  --purple:#7c3aed; --cyan:#0891b2;
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,Arial,sans-serif;background:var(--bg);color:var(--text)}
.app-shell{display:flex;min-height:100vh}
.sidebar{width:280px;background:linear-gradient(180deg,var(--navy),#111827);color:white;padding:25px;display:flex;flex-direction:column;justify-content:space-between}
.brand{display:flex;gap:12px;align-items:center;margin-bottom:30px}
.brand-mark{background:var(--orange);color:#111827;font-weight:900;border-radius:14px;padding:14px 12px}
.brand h1{margin:0;color:var(--orange);font-size:22px}.brand p{margin:4px 0 0;color:#cbd5e1;font-size:12px}
.nav-btn{width:100%;background:var(--navy2);color:white;border:0;border-radius:12px;padding:14px;margin-bottom:10px;cursor:pointer;font-weight:800;text-align:left}
.nav-btn:hover,.nav-btn.active{background:var(--orange);color:#111827}
.sidebar-footer{border-top:1px solid rgba(255,255,255,.15);padding-top:20px;color:#cbd5e1;font-size:13px}.sidebar-footer strong{display:block;color:white;margin-top:4px}
.main{flex:1;padding:30px 34px;overflow-x:hidden}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px}
.topbar h2{margin:0;font-size:32px}.topbar p{color:var(--muted);margin:5px 0 0}
.primary-btn,.close-btn{background:linear-gradient(135deg,var(--orange),var(--orange2));color:#111827;border:0;border-radius:12px;padding:14px 20px;cursor:pointer;font-weight:900}
.secondary-btn{background:#e8eef5;color:#111827;border:1px solid #d6dee9;border-radius:12px;padding:14px 20px;cursor:pointer;font-weight:900}
.page{display:none}.page.active{display:block}
.kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin-bottom:20px}
.kpi-card,.panel,.form-panel,.placeholder-panel,.lead-table-card{background:white;border:1px solid var(--border);border-radius:18px;box-shadow:0 8px 22px rgba(15,23,42,.05)}
.kpi-card{padding:22px}.kpi-card span{color:var(--muted);font-size:13px}.kpi-card strong{display:block;font-size:40px;margin:8px 0}
.dashboard-grid{display:grid;grid-template-columns:2fr 1fr;gap:20px}.panel,.form-panel,.placeholder-panel{padding:20px}
.panel-head,.section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.panel-head h3,.section-head h3{margin:0}.panel-head span,.section-head p{color:var(--muted);font-size:13px}
.pipeline-board{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.pipeline-card{background:#f8fafc;border:1px solid var(--border);border-radius:12px;padding:16px}.pipeline-card span{color:var(--muted);font-size:12px}.pipeline-card strong{display:block;font-size:28px;margin-top:8px}
.focus-list{display:grid;gap:10px}.focus-list div{display:flex;gap:12px;align-items:center;background:#f8fafc;border:1px solid var(--border);border-radius:12px;padding:12px}.focus-list strong{background:var(--navy);color:white;width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center}
.type-tabs{display:flex;gap:10px;margin-bottom:18px}.type-tab{border:1px solid #d6dee9;border-radius:10px;background:#e8eef5;color:#0f172a;padding:11px 16px;cursor:pointer;font-weight:900}.type-tab:hover,.type-tab.active{background:var(--orange);border-color:var(--orange)}
.browser-tabs{display:flex;align-items:flex-end;gap:0;border-bottom:2px solid #cbd5e1;margin:10px 0 0;padding-left:8px;overflow-x:auto}.browser-tab{position:relative;border:1px solid #cbd5e1;border-bottom:none;background:#e8eef5;color:#0f172a;padding:13px 22px;min-width:110px;cursor:pointer;font-weight:900;border-radius:14px 14px 0 0;margin-right:4px;top:2px}.browser-tab:hover{background:#f8fafc}.browser-tab.active{background:#fff;color:#111827;border-color:#cbd5e1;z-index:2;box-shadow:0 -4px 12px rgba(15,23,42,.05)}.browser-tab.active::after{content:"";position:absolute;left:0;right:0;bottom:-2px;height:3px;background:#fff}
.lead-table-card{border-radius:0 18px 18px 18px;overflow:hidden}.lead-table-scroll{overflow-x:auto;width:100%}
.lead-table-head,.lead-row{display:grid;grid-template-columns:120px 170px 125px 220px 120px 160px 110px 165px 120px 130px 135px 120px 150px;gap:10px;min-width:1840px;align-items:center}
.lead-table-head{color:var(--muted);font-size:13px;font-weight:900;border-bottom:1px solid var(--border);padding:18px 24px}
.lead-row{padding:18px 24px;border-bottom:1px solid var(--border);cursor:pointer;font-size:15px}.lead-row:hover{background:#f8fafc}
.row-actions{display:flex;gap:6px}.row-actions button,.lead-row button{background:#0f172a;color:white;border:0;border-radius:8px;padding:9px 12px;cursor:pointer;font-weight:800}.row-actions .edit{background:var(--orange);color:#111827}
.badge{display:inline-block;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:900;text-transform:capitalize}.badge.domestic{background:#dcfce7;color:#166534}.badge.commercial{background:#dbeafe;color:#1e40af}
.status-active{color:var(--green);font-weight:900}.status-cancelled{color:var(--red);font-weight:900}.status-postponed{color:var(--orange2);font-weight:900}

.lead-status-accent,
[data-status-color]{
  --lead-status-color:#94a3b8;
  box-shadow:inset 4px 0 0 var(--lead-status-color);
}

.lead-sub-status-badge{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  padding:3px 8px;
  border:1px solid #d1d5db;
  border-color:color-mix(in srgb, var(--lead-status-color) 45%, #ffffff);
  border-left:4px solid var(--lead-status-color);
  border-radius:6px;
  background:#f8fafc;
  background:color-mix(in srgb, var(--lead-status-color) 12%, #ffffff);
  color:#1f2937;
  font-weight:700;
  line-height:1.35;
}

/* Whole lead row colour based on current stage/sub-status */
.lead-row-status-color {
  position: relative;
  background: #ffffff;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--lead-status-color) 50%, #ffffff) 0%,
      color-mix(in srgb, var(--lead-status-color) 35%, #ffffff) 45%,
      color-mix(in srgb, var(--lead-status-color) 20%, #ffffff) 100%
    );
  border-left: 5px solid var(--lead-status-color) !important;
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.lead-row-status-color:hover {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--lead-status-color) 22%, #ffffff) 0%,
      color-mix(in srgb, var(--lead-status-color) 12%, #ffffff) 45%,
      color-mix(in srgb, var(--lead-status-color) 6%, #ffffff) 100%
    );
  box-shadow: inset 5px 0 0 var(--lead-status-color);
}

/* Fallback for browsers without color-mix support */
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .lead-row-status-color {
    background: #f8fafc;
  }
}

.form-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:20px}.form-grid.two-col{grid-template-columns:repeat(2,1fr)}.span-2{grid-column:1 / -1}
input,select,textarea{width:100%;padding:12px;border:1px solid var(--border);border-radius:10px;background:#fff}.create-lead-panel{max-width:980px;margin:auto}.create-section{border:1px solid #dce4ef;border-radius:16px;padding:18px;margin-bottom:18px;background:#fff}.create-section h4{margin:0 0 12px}.form-actions{display:flex;justify-content:flex-end;gap:10px}.muted-text{color:var(--muted);font-size:13px}
.call-list{display:grid;gap:12px}.call-card{background:white;border:1px solid var(--border);border-radius:12px;padding:16px}
.hidden{display:none}.modal{position:fixed;inset:0;z-index:1000}.modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.58)}
.lead-workspace{position:absolute;inset:28px 34px;background:white;border-radius:18px;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 28px 80px rgba(0,0,0,.35)}
.workspace-header{background:var(--navy);color:white;padding:18px 22px;display:flex;justify-content:space-between;align-items:center}.workspace-header h3{margin:0}.workspace-header p{margin:4px 0 0;color:#cbd5e1;font-size:13px}
.workspace-tabs{background:#f8fafc;border-bottom:1px solid var(--border);display:flex;gap:8px;padding:12px 18px 0;overflow-x:auto}.workspace-tab{border:1px solid #cbd5e1;border-bottom:none;background:#e8eef5;padding:12px 18px;border-radius:12px 12px 0 0;font-weight:900;cursor:pointer}.workspace-tab.active{background:white;position:relative;top:1px}
.workspace-body{overflow-y:auto;padding:20px;flex:1;background:#f8fafc}.lead-tab{display:none}.lead-tab.active{display:block}
.workspace-section{background:white;border:1px solid var(--border);border-radius:16px;padding:18px;margin-bottom:18px}.workspace-section h4{margin:0 0 14px}
.info-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.info-card{background:#f8fafc;border:1px solid #dce4ef;border-radius:12px;padding:14px;min-height:58px}.info-card.wide{grid-column:1 / -1}.info-card span{display:block;text-transform:uppercase;font-size:11px;letter-spacing:.04em;color:#486178;font-weight:900;margin-bottom:6px}.info-card strong{font-size:15px}
.action-bar{display:flex;flex-wrap:wrap;gap:9px}.action-bar button,.small-orange-btn{background:var(--orange);color:#111827;border:0;padding:10px 13px;border-radius:10px;font-weight:900;cursor:pointer}
.update-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;align-items:start}.edit-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.edit-grid .wide{grid-column:1 / -1}
.note-list{margin-top:14px;display:grid;gap:10px}.note-item{border:1px solid var(--border);background:#f8fafc;border-radius:12px;padding:12px}.note-item small{display:block;color:var(--muted);margin-top:6px}
.left-accent-purple{border-left:5px solid var(--purple)}.left-accent-cyan{border-left:5px solid var(--cyan)}
@media(max-width:1400px){.kpi-grid,.pipeline-board,.form-grid,.form-grid.two-col,.info-grid,.update-grid,.edit-grid{grid-template-columns:1fr}.dashboard-grid{grid-template-columns:1fr}}

/* v3 inline expanded lead workspace */
.inline-workspace-wrap{
  position:relative;
  margin-top:22px;
  z-index:10;
}
.inline-workspace-wrap.hidden{display:none}
.inline-workspace{
  position:relative !important;
  inset:auto !important;
  width:100%;
  max-height:none;
  min-height:520px;
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 14px 35px rgba(15,23,42,.14);
}
.inline-workspace .workspace-body{
  max-height:none;
  overflow:visible;
}
.inline-workspace .workspace-header{
  position:sticky;
  top:0;
  z-index:3;
}
.modal-backdrop{display:none !important}
.row-actions .edit{display:none}
.staff-role-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:10px;
}
.staff-role-grid label{
  background:#f8fafc;
  border:1px solid #dce4ef;
  border-radius:10px;
  padding:10px;
}
.staff-list{
  display:grid;
  gap:10px;
}
.staff-card{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:10px;
  background:#f8fafc;
  border:1px solid #dce4ef;
  border-radius:10px;
  padding:12px;
}
@media(max-width:900px){
  .staff-role-grid,.staff-card{grid-template-columns:1fr}
}

.hidden-field{display:none !important}

.filter-panel{background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:14px;display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin-bottom:16px}
@media(max-width:1200px){.filter-panel{grid-template-columns:1fr 1fr}}
@media(max-width:700px){.filter-panel{grid-template-columns:1fr}}

.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#071225,#132238);padding:24px}.login-card{width:100%;max-width:420px;background:#fff;border-radius:24px;padding:34px;box-shadow:0 30px 70px rgba(0,0,0,.35)}.login-logo{width:64px;height:64px;border-radius:18px;background:#ff9828;color:#071225;display:flex;align-items:center;justify-content:center;font-weight:900;margin-bottom:18px}.login-card h1{margin:0 0 6px;color:#071225}.login-card p{margin:0 0 20px;color:#5d718c}.login-card input{width:100%;margin-bottom:12px}.full-btn{width:100%}.login-message{color:#b42318;margin-top:12px;font-weight:700}.logout-btn{background:#ff9828!important;color:#071225!important;margin-bottom:16px}.logged-user-dynamic{color:#fff;display:grid;gap:3px}.logged-user-dynamic span,.logged-user-dynamic small{color:#cbd5e1}input:disabled,select:disabled{background:#eef3f8;color:#475569;cursor:not-allowed}

.notification-bell {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
}

.lead-sub-status-badge{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  padding:3px 8px;
  border:1px solid #d1d5db;
  border-color:color-mix(in srgb, var(--lead-status-color) 45%, #ffffff);
  border-left:4px solid var(--lead-status-color);
  border-radius:6px;
  background:#f8fafc;
  background:color-mix(in srgb, var(--lead-status-color) 12%, #ffffff);
  color:#1f2937;
  font-weight:700;
  line-height:1.35;
}

.notification-bell-btn {
  background: #ff9633;
  color: #071426;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

#notificationCount {
  background: #071426;
  color: white;
  border-radius: 999px;
  padding: 2px 7px;
  margin-left: 4px;
  font-size: 12px;
}

.notification-panel {
  position: absolute;
  top: 48px;
  right: 0;
  width: 360px;
  max-height: 420px;
  overflow-y: auto;
  background: white;
  border: 1px solid #d9e2ec;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
  padding: 10px;
}

.diary-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.diary-toolbar select {
  min-width: 220px;
}

.diary-entry-chip {
  background: #e8f5e9;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
}

.diary-entry-chip strong {
  display: block;
  color: #14532d;
}

.diary-entry-chip small {
  color: #166534;
}

.mini-diary-grid {
  display: grid;
  grid-template-columns: 90px repeat(6, 1fr);
  gap: 10px;
}

.mini-diary-head {
  font-weight: 800;
  text-align: center;
  color: #0f172a;
}

.mini-diary-time {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  padding-top: 18px;
}

.mini-diary-slot {
  min-height: 90px;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  padding: 10px;
  cursor: pointer;
}

.mini-diary-slot:hover {
  border-color: #ff9633;
  background: #fff7ed;
}

.mini-diary-slot small {
  color: #94a3b8;
}

.diary-day-name{
  font-weight: 800;
  text-transform: uppercase;
  font-size: 14px;
  line-height: 1.1;
}

.diary-day-date{
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.empty-slot-text{
  display: block;
  min-height: 20px;
}

.badge-booked {
  color: #027a48;
  font-weight: 800;
}

.badge-not-booked {
  color: #b42318;
  font-weight: 800;
}

.badge-overdue {
  color: #b42318;
  font-weight: 800;
}

.badge-today {
  color: #b54708;
  font-weight: 800;
}

.badge-ready {
  color: #5925dc;
  font-weight: 800;
}

.quick-assign-box {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.quick-assign-box select {
  width: 100%;
}

.quick-assign-box button {
  align-self: start;
}

.my-jobs-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.sales-manager-board {
  display: grid;
  grid-template-columns: 320px repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  align-items: start;
}

.sales-manager-column,
.sales-manager-diary-column {
  background: #f8fafc;
  border: 1px solid #d9e2ec;
  border-radius: 18px;
  padding: 18px;
  min-height: 420px;
}

.sales-manager-diary-column {
  grid-column: 1 / -1;
}

.booking-board,
.pm-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 24px;
  align-items: start;
}

.pm-board {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.booking-column,
.pm-column {
  background: #f8fafc;
  border: 1px solid #d9e2ec;
  border-radius: 18px;
  padding: 18px;
  min-height: 420px;
}

.board-title {
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 14px;
}

.drop-zone {
  border: 2px dashed #cbd5e1;
}

.drop-zone:hover {
  border-color: #ff9633;
  background: #fff7ed;
}

.empty-drop-zone {
  padding: 30px;
  text-align: center;
  color: #64748b;
  border-radius: 14px;
  background: #ffffff;
}

.my-job-card {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.my-job-card strong {
  color: #0f172a;
  font-size: 15px;
}

.my-job-card span,
.my-job-card small {
  color: #475569;
}

.my-job-card button {
  margin-top: 8px;
  align-self: flex-start;
  background: #ff9633;
  color: #0f172a;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 900px) {
  .my-jobs-split {
    grid-template-columns: 1fr;
  }
}

.notification-card {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: #f8fafc;
}

.notification-card p {
  margin: 6px 0;
  color: #334155;
}

.notification-card button {
  background: #071426;
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.notification-empty {
  padding: 14px;
  color: #64748b;
}

.hidden {
  display: none !important;
}


.text-btn{
  border:0;
  background:transparent;
  color:#0f2744;
  font-weight:800;
  margin-top:10px;
  cursor:pointer;
}
.forgot-box{
  margin-top:18px;
  padding-top:18px;
  border-top:1px solid #e5e7eb;
}
.password-panel{max-width:900px}

.login-message:empty{display:none}
.login-message:not(:empty){display:block;background:#fff1f1;border:1px solid #fda29b;padding:10px;border-radius:10px}

.hidden{display:none !important;}
#loginPage{min-height:100vh;}
#appShell:not(.hidden){display:grid !important;}


/* v13 layout fix: stop sidebar/menu jumping above dashboard */
#appShell{
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  width: 100%;
}

#appShell.hidden{
  display: none !important;
}

.sidebar{
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.main{
  margin-left: 260px;
  width: calc(100vw - 260px);
  min-height: 100vh;
  padding: 42px 36px;
  box-sizing: border-box;
}

.page,
.content,
.main-content{
  width: 100%;
  max-width: none;
}

@media (max-width: 900px){
  #appShell{
    display: block;
  }

  .sidebar{
    position: relative;
    width: 100%;
    height: auto;
  }

  .main{
    margin-left: 0;
    width: 100%;
    padding: 24px 18px;
  }
}


/* v14 tables and installer management */
.crm-table-wrap{width:100%; overflow:auto;}
.crm-table{width:100%; display:block;}
.crm-table-row{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap:12px;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid #d9e2ec;
  background:#fff;
}
.crm-table-head-row{
  background:#f2f5f8;
  color:#506680;
  font-weight:800;
  text-transform:none;
}
.action-row{display:flex; gap:8px; flex-wrap:wrap;}
.small-dark-btn{
  background:#0b1728;
  color:#fff;
  border:0;
  border-radius:9px;
  padding:9px 13px;
  font-weight:800;
  cursor:pointer;
}
.installer-subtab{display:none;}
.installer-subtab.active{display:block;}
.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
}
.badge.good{background:#d8f8e3;color:#067647;}
.badge.warning{background:#fff1c2;color:#a15c00;}
.badge.danger{background:#ffe1e1;color:#b42318;}
.badge.neutral{background:#e8eef5;color:#506680;}
.empty-state{
  padding:18px;
  border:1px dashed #c9d6e2;
  border-radius:12px;
  background:#f7f9fb;
  color:#506680;
}

.permission-toolbar{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.permission-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:14px}
.permission-group{border:1px solid #d9e2ec;border-radius:14px;background:#f8fafc;padding:14px}
.permission-group h4{margin:0 0 10px}
.permission-group label{display:block;padding:7px 0;font-size:14px}


/* V16 notifications and sales performance */
.notification-box{position:fixed;right:20px;bottom:20px;z-index:9999;display:flex;flex-direction:column;gap:10px;max-width:360px}
.notification-card{background:#fff;border:1px solid #ffd2a8;border-left:5px solid #ff8a2a;border-radius:12px;padding:12px;box-shadow:0 10px 30px rgba(15,23,42,.18)}
.notification-card p{margin:6px 0;color:#475467;font-size:13px}.notification-card button{background:#ff8a2a;border:0;border-radius:8px;padding:7px 10px;font-weight:700;cursor:pointer}
.sales-report-table{overflow:auto;border:1px solid #d9e2ec;border-radius:12px;background:#fff}.sales-report-row{display:grid;grid-template-columns:180px repeat(12,120px);gap:0;border-bottom:1px solid #d9e2ec}.sales-report-row span{padding:10px;border-right:1px solid #d9e2ec;font-size:13px}.sales-report-head{background:#e5e7eb;font-weight:800}.crm-table-head-simple{font-weight:800;background:#f3f6f9}

.labelled-grid label{display:flex;flex-direction:column;gap:7px;font-weight:700;color:#0f172a}
.labelled-grid label input,.labelled-grid label select,.labelled-grid label textarea{font-weight:400}

/* v17 corrected layout fix */
html,
body{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

#appShell:not(.hidden){
  display:block !important;
  width:100%;
  max-width:100vw;
}

.sidebar{
  position:fixed;
  top:0;
  left:0;
  width:260px;
  height:100vh;
  overflow-y:auto;
}

.main{
  margin-left:260px !important;
  width:calc(100vw - 260px) !important;
  max-width:calc(100vw - 260px) !important;
  overflow-x:hidden;
  padding:42px 36px;
}

.page{
  width:100%;
  max-width:100%;
}

.lead-table-card,
.crm-table-wrap,
.sales-report-table{
  width:100%;
  max-width:100%;
  overflow-x:auto;
}

.filter-panel{
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)) !important;
}

.topbar{
  gap:16px;
  flex-wrap:wrap;
}

@media(max-width:900px){
  .sidebar{
    position:relative;
    width:100%;
    height:auto;
  }

  .main{
    margin-left:0 !important;
    width:100% !important;
    max-width:100% !important;
    padding:24px 18px;
  }
}

.booking-status-board{
  display:grid;
  grid-template-columns:repeat(5, minmax(220px, 1fr));
  gap:14px;
  align-items:start;
  width:100%;
}

.booking-status-column{
  background:#f8fafc;
  border:1px solid #dbe4f0;
  border-radius:14px;
  min-height:430px;
  padding:12px;
}

.booking-status-column .board-title{
  margin:-12px -12px 12px -12px;
  padding:12px;
  border-radius:14px 14px 0 0;
  font-weight:800;
  color:#fff;
}

.urgent-column .board-title{
  background:linear-gradient(135deg,#ef4444,#dc2626);
}

.callback-column .board-title{
  background:linear-gradient(135deg,#f59e0b,#f97316);
}

.new-column .board-title{
  background:linear-gradient(135deg,#3b82f6,#2563eb);
}

.no-answer-column .board-title{
  background:linear-gradient(135deg,#6b7280,#4b5563);
}

.pm-queue-column .board-title{
  background:linear-gradient(135deg,#22c55e,#16a34a);
}

.booking-mini-card{
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:12px;
  padding:12px;
  margin-bottom:10px;
  box-shadow:0 4px 14px rgba(15,23,42,0.08);
}

.booking-mini-card strong{
  display:block;
  margin-bottom:6px;
}

.booking-mini-card span,
.booking-mini-card small{
  display:block;
  margin-top:4px;
}

.booking-mini-card button{
  margin-top:8px;
  margin-right:6px;
}

@media(max-width:1200px){
  .booking-status-board{
    grid-template-columns:repeat(2, minmax(240px, 1fr));
  }
}

@media(max-width:700px){
  .booking-status-board{
    grid-template-columns:1fr;
  }
}
.jobs-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
}

.jobs-topbar h3{
  font-size:28px;
  margin:0;
}

.jobs-topbar p{
  margin:4px 0 0;
  color:#64748b;
  font-size:14px;
}

.booking-filter-bar{
  display:grid;
  grid-template-columns:180px 220px 200px 1fr;
  gap:14px;
  align-items:end;
  margin-bottom:18px;
}

.booking-filter-bar label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
  font-weight:700;
  color:#334155;
}

.booking-filter-bar select,
.booking-filter-bar input{
  height:42px;
  border:1px solid #d8e0ec;
  border-radius:8px;
  padding:0 12px;
  background:#fff;
}

@media(max-width:900px){
  .booking-filter-bar{
    grid-template-columns:1fr;
  }
}

.jobs-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
}

.jobs-topbar h3{
  font-size:28px;
  margin:0;
}

.jobs-topbar p{
  margin:4px 0 0;
  color:#64748b;
  font-size:14px;
}

.my-jobs-toolbar{
  display:grid;
  grid-template-columns:180px 220px 200px 1fr;
  gap:14px;
  align-items:end;
  margin-bottom:18px;
}

.my-jobs-toolbar label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
  font-weight:700;
  color:#334155;
}

.my-jobs-toolbar select,
.my-jobs-toolbar input{
  height:42px;
  border:1px solid #d8e0ec;
  border-radius:8px;
  padding:0 12px;
  background:#fff;
}

@media(max-width:900px){
  .my-jobs-toolbar{
    grid-template-columns:1fr;
  }
}

.sm-kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:16px;
}

.sm-kpi-card{
  background:#fff;
  border:1px solid #dbe4f0;
  border-radius:14px;
  padding:16px;
  box-shadow:0 4px 14px rgba(15,23,42,.06);
}

.sm-kpi-card strong{
  display:block;
  font-size:26px;
  color:#0f172a;
}

.sm-kpi-card span{
  color:#64748b;
  font-weight:700;
}

.sm-layout{
  display:grid;
  grid-template-columns:300px 260px 1fr;
  gap:14px;
  align-items:start;
}

.sm-panel{
  background:#fff;
  border:1px solid #dbe4f0;
  border-radius:14px;
  padding:14px;
  min-height:420px;
}

.sm-diary-panel{
  min-height:520px;
}

.sm-panel-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:12px;
}

.sm-panel-head h3{
  margin:0;
  font-size:16px;
  font-weight:900;
}

.sm-panel-head span{
  color:#64748b;
  font-size:12px;
}

.sm-job-card,
.sm-agent-card{
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:12px;
  padding:12px;
  margin-bottom:10px;
  box-shadow:0 4px 12px rgba(15,23,42,.05);
}

.sm-job-card h4{
  margin:8px 0 4px;
}

.sm-job-card p{
  margin:3px 0;
  color:#334155;
}

.sm-job-top{
  display:flex;
  justify-content:space-between;
  gap:8px;
}

.sm-job-meta small,
.sm-job-meta span{
  display:block;
  margin-top:5px;
}

.sm-job-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.sm-agent-card{
  cursor:pointer;
}

.sm-agent-card:hover{
  border-color:#fb923c;
}

.sm-agent-card strong,
.sm-agent-card span,
.sm-agent-card small{
  display:block;
}

.sm-diary-actions{
  display:flex;
  gap:8px;
  margin-bottom:12px;
}

.sm-diary-actions button,
.sm-diary-actions input{
  height:36px;
  border:1px solid #d8e0ec;
  border-radius:8px;
  padding:0 10px;
  background:#fff;
}

.professional-diary{
  display:grid;
  grid-template-columns:70px repeat(6,1fr);
  gap:4px;
}

.professional-diary .mini-diary-head{
  font-weight:900;
  text-align:center;
  padding:8px;
  background:#f8fafc;
  border-radius:8px;
}

.professional-diary .mini-diary-time{
  font-weight:800;
  color:#64748b;
  padding:10px 4px;
}

.professional-diary .mini-diary-slot{
  min-height:54px;
  border:1px dashed #cbd5e1;
  border-radius:8px;
  padding:6px;
  background:#fff;
}

.professional-diary .mini-diary-slot:hover{
  background:#fff7ed;
  border-color:#fb923c;
}

@media(max-width:1200px){
  .sm-layout{
    grid-template-columns:1fr;
  }

  .sm-kpi-grid{
    grid-template-columns:repeat(2,1fr);
  }
}

.sm-pro-kpis{
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:14px;
  margin-bottom:18px;
}

.sm-pro-kpi{
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:16px;
  padding:16px;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
}

.sm-pro-kpi strong{
  display:block;
  font-size:28px;
  color:#0f172a;
}

.sm-pro-kpi span{
  color:#64748b;
  font-weight:800;
  font-size:13px;
}

.sm-pro-layout{
  display:grid;
  grid-template-columns:300px 250px 1fr;
  gap:16px;
  align-items:start;
}

.sm-pro-panel{
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:18px;
  padding:14px;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
  min-height:420px;
}

.sm-pro-calendar-panel{
  min-height:620px;
}

.sm-pro-panel-head,
.sm-pro-calendar-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:14px;
}

.sm-pro-panel-head h3,
.sm-pro-calendar-head h3{
  margin:0;
  font-size:17px;
  font-weight:900;
  color:#0f172a;
}

.sm-pro-panel-head span,
.sm-pro-calendar-head span{
  color:#64748b;
  font-size:12px;
}

.sm-pro-job-card,
.sm-pro-agent-card{
  border:1px solid #e2e8f0;
  border-radius:14px;
  padding:12px;
  margin-bottom:10px;
  background:#fff;
  box-shadow:0 4px 12px rgba(15,23,42,.05);
}

.sm-pro-job-card{
  cursor:grab;
}

.sm-pro-job-ref{
  display:flex;
  justify-content:space-between;
  gap:8px;
}

.sm-pro-job-card h4{
  margin:8px 0;
  font-size:16px;
  color:#0f172a;
}

.sm-pro-job-card p{
  margin:4px 0;
  color:#334155;
  font-size:13px;
}

.sm-pro-badges small,
.sm-pro-badges span{
  display:block;
  margin-top:5px;
}

.sm-pro-job-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:10px;
}

.sm-pro-job-actions button{
  border:0;
  border-radius:8px;
  padding:7px 10px;
  background:#f97316;
  color:#fff;
  cursor:pointer;
}

.sm-pro-agent-card{
  cursor:pointer;
}

.sm-pro-agent-card:hover{
  border-color:#fb923c;
  background:#fff7ed;
}

.sm-pro-agent-card strong,
.sm-pro-agent-card span,
.sm-pro-agent-card small{
  display:block;
}

.sm-pro-calendar-toolbar{
  display:flex;
  gap:8px;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.sm-pro-calendar-toolbar button,
.sm-pro-calendar-toolbar input,
.sm-pro-calendar-head select{
  height:36px;
  border:1px solid #d8e0ec;
  border-radius:8px;
  padding:0 10px;
  background:#fff;
}

.sm-pro-calendar-toolbar button.active{
  background:#0f172a;
  color:#fff;
}

.sm-pro-diary-grid{
  display:grid;
  grid-template-columns:70px repeat(6,1fr);
  gap:5px;
}

.sm-pro-diary-day-head,
.sm-pro-diary-time-head{
  background:#f8fafc;
  padding:9px;
  border-radius:8px;
  text-align:center;
  font-weight:900;
}

.sm-pro-diary-time{
  font-weight:900;
  color:#64748b;
  padding:10px 4px;
  font-size:12px;
}

.sm-pro-diary-slot{
  min-height:58px;
  border:1px dashed #cbd5e1;
  border-radius:10px;
  padding:6px;
  background:#fff;
}

.sm-pro-diary-slot:hover{
  background:#fff7ed;
  border-color:#fb923c;
}

.sm-pro-diary-entry{
  border-radius:9px;
  padding:7px;
  font-size:12px;
}

.sm-pro-diary-entry strong,
.sm-pro-diary-entry small{
  display:block;
}

.sm-pro-diary-entry.diary-job{
  background:#dbeafe;
  border-left:4px solid #2563eb;
}

.sm-pro-diary-entry.diary-personal{
  background:#f1f5f9;
  border-left:4px solid #64748b;
}

.crm-modal{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.55);
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.crm-modal.hidden{
  display:none;
}

.crm-modal-card{
  width:min(680px,96vw);
  background:#fff;
  border-radius:18px;
  padding:18px;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
}

.crm-modal-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:16px;
}

.crm-modal-head h3{
  margin:0;
  font-size:22px;
}

.crm-modal-head p{
  margin:4px 0 0;
  color:#64748b;
}

.crm-modal-head button{
  border:0;
  background:#f1f5f9;
  width:34px;
  height:34px;
  border-radius:50%;
  cursor:pointer;
  font-size:22px;
}

@media(max-width:1250px){
  .sm-pro-layout{
    grid-template-columns:1fr;
  }

  .sm-pro-kpis{
    grid-template-columns:repeat(2,1fr);
  }
}

.sr-pro-kpis{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:18px;
}

.sr-pro-kpi{
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:16px;
  padding:16px;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
}

.sr-pro-kpi strong{
  display:block;
  font-size:28px;
  color:#0f172a;
}

.sr-pro-kpi span{
  color:#64748b;
  font-weight:800;
  font-size:13px;
}

.sr-pro-layout{
  display:grid;
  grid-template-columns:320px 1fr 280px;
  gap:16px;
  align-items:start;
}

.sr-pro-panel{
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:18px;
  padding:14px;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
  min-height:420px;
}

.sr-pro-calendar-panel{
  min-height:620px;
}

.sr-pro-panel-head,
.sr-pro-calendar-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:14px;
}

.sr-pro-panel-head h3,
.sr-pro-calendar-head h3{
  margin:0;
  font-size:17px;
  font-weight:900;
  color:#0f172a;
}

.sr-pro-panel-head span,
.sr-pro-calendar-head span{
  color:#64748b;
  font-size:12px;
}

.sr-pro-job-card{
  border:1px solid #e2e8f0;
  border-radius:14px;
  padding:12px;
  margin-bottom:10px;
  background:#fff;
  box-shadow:0 4px 12px rgba(15,23,42,.05);
}

.sr-pro-job-card[draggable="true"]{
  cursor:grab;
}

.sr-pro-job-ref{
  display:flex;
  justify-content:space-between;
  gap:8px;
}

.sr-pro-job-card h4{
  margin:8px 0;
  font-size:16px;
  color:#0f172a;
}

.sr-pro-job-card p{
  margin:4px 0;
  color:#334155;
  font-size:13px;
}

.sr-pro-badges small,
.sr-pro-badges span{
  display:block;
  margin-top:5px;
}

.sr-pro-job-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:10px;
}

.sr-pro-job-actions button{
  border:0;
  border-radius:8px;
  padding:7px 10px;
  background:#f97316;
  color:#fff;
  cursor:pointer;
}

.sr-pro-finance-drop{
  min-height:360px;
  border:1px dashed #cbd5e1;
  border-radius:14px;
  padding:10px;
  background:#f8fafc;
}

.sr-pro-calendar-toolbar{
  display:flex;
  gap:8px;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.sr-pro-calendar-toolbar button,
.sr-pro-calendar-toolbar input{
  height:36px;
  border:1px solid #d8e0ec;
  border-radius:8px;
  padding:0 10px;
  background:#fff;
}

.sr-pro-calendar-toolbar button.active{
  background:#0f172a;
  color:#fff;
}

.sr-pro-diary-grid{
  display:grid;
  grid-template-columns:70px repeat(6,1fr);
  gap:5px;
}

.sr-pro-diary-day-head,
.sr-pro-diary-time-head{
  background:#f8fafc;
  padding:9px;
  border-radius:8px;
  text-align:center;
  font-weight:900;
}

.sr-pro-diary-time{
  font-weight:900;
  color:#64748b;
  padding:10px 4px;
  font-size:12px;
}

.sr-pro-diary-slot{
  min-height:58px;
  border:1px dashed #cbd5e1;
  border-radius:10px;
  padding:6px;
  background:#fff;
}

.sr-pro-diary-slot:hover{
  background:#fff7ed;
  border-color:#fb923c;
}

.sr-pro-diary-entry{
  border-radius:9px;
  padding:7px;
  font-size:12px;
}

.sr-pro-diary-entry strong,
.sr-pro-diary-entry small{
  display:block;
}

.sr-pro-diary-entry.diary-job{
  background:#dbeafe;
  border-left:4px solid #2563eb;
}

.sr-pro-diary-entry.diary-personal{
  background:#f1f5f9;
  border-left:4px solid #64748b;
}

@media(max-width:1250px){
  .sr-pro-layout{
    grid-template-columns:1fr;
  }

  .sr-pro-kpis{
    grid-template-columns:repeat(2,1fr);
  }
}

.lead-popup-overlay{
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: rgba(15, 23, 42, 0.55) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: auto !important;
  padding: 24px !important;
}

.lead-popup-overlay .lead-workspace,
.lead-popup-overlay > div{
  position: relative !important;
  inset: auto !important;
  width: min(1300px, 96vw) !important;
  height: min(860px, 92vh) !important;
  margin: 0 !important;
  background: #fff;
  border-radius: 18px;
}

/* Booking Date / Time labels */
.field-label{
    display:block;
    margin-bottom:6px;
    font-size:11px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.5px;
    color:#64748b;
}
.drop-pending {
  opacity: 0.6;
  pointer-events: none;
  outline: 3px solid #2563eb;
  outline-offset: -3px;
}

/* =========================================================
   FULL ROW COLOUR BASED ON LEAD SUB-STATUS
   app.js already adds data-status-color and the CSS variable
   ========================================================= */

.lead-row[data-status-color] {
  border-left: 5px solid var(--lead-status-color) !important;

  /* Fallback background */
  background: #f8fafc;

  /* Modern browser background */
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--lead-status-color) 18%, white) 0%,
      color-mix(in srgb, var(--lead-status-color) 11%, white) 55%,
      color-mix(in srgb, var(--lead-status-color) 7%, white) 100%
    ) !important;

  transition:
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.lead-row[data-status-color]:hover {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--lead-status-color) 25%, white) 0%,
      color-mix(in srgb, var(--lead-status-color) 15%, white) 55%,
      color-mix(in srgb, var(--lead-status-color) 9%, white) 100%
    ) !important;

  box-shadow: inset 5px 0 0 var(--lead-status-color);
}

/* My Jobs cards also already contain data-status-color */
.my-job-card[data-status-color] {
  border-left: 5px solid var(--lead-status-color) !important;
  background: #f8fafc;

  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--lead-status-color) 18%, white) 0%,
      color-mix(in srgb, var(--lead-status-color) 8%, white) 100%
    ) !important;
}

/* Keep every cell transparent so the row colour remains visible */
.lead-row[data-status-color] > div {
  background: transparent !important;
}

/* Badge remains stronger than the row tint */
.lead-sub-status-badge {
  border-left: 4px solid var(--lead-status-color);
  background: #f8fafc;
  background:
    color-mix(in srgb, var(--lead-status-color) 16%, white);
}
