:root{
  --bg: #0b1220;
  --panel:#0f1a2e;
  --panel-2:#101f38;
  --text:#e7eefc;
  --muted:#9bb0d0;
  --line: rgba(255,255,255,.08);
  --accent:#38bdf8;
  --good:#22c55e;
}

.input,
input.input,
select.input,
textarea.input {
  width: 100%;
  background: rgba(15,26,46,.6);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.input:focus {
  border-color: rgba(56,189,248,.35);
  box-shadow: 0 0 0 4px rgba(56,189,248,.12);
}

textarea.input { resize: vertical; }


*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 700px at 10% 10%, rgba(56,189,248,.15), transparent 60%),
              radial-gradient(900px 600px at 90% 20%, rgba(34,197,94,.10), transparent 55%),
              var(--bg);
  color:var(--text);
}

.layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height:100vh;
}

.sidebar{
  background: linear-gradient(180deg, var(--panel), rgba(15,26,46,.92));
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.brand{ display:flex; align-items:center; gap:12px; padding:10px 10px; }
.logo{
  width:40px; height:40px;
  border-radius: 14px;
  display:grid; place-items:center;
  background: rgba(56,189,248,.16);
  border: 1px solid rgba(56,189,248,.25);
  font-weight:700;
}
.brand-text .name{ font-weight:700; letter-spacing:.2px; }
.brand-text .tag{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ display:flex; flex-direction:column; gap:6px; padding: 6px; }
.nav-item{
  color: var(--muted);
  text-decoration:none;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.nav-item:hover{
  color: var(--text);
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.06);
}
.nav-item.active{
  color: var(--text);
  background: rgba(56,189,248,.12);
  border-color: rgba(56,189,248,.25);
}
.nav-sep{ height:1px; background: var(--line); margin: 8px 6px; }

.sidebar-footer{ margin-top:auto; padding: 10px 8px; display:flex; flex-direction:column; gap:12px; }
.pill{
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  width:max-content;
}

.dev-switch{
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 10px;
}
.label{ font-size:12px; color: var(--muted); display:block; margin-bottom:6px; }
.select{
  width:100%;
  background: rgba(15,26,46,.6);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  padding: 10px;
  outline:none;
}
.btn{
  margin-top:8px;
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(56,189,248,.25);
  background: rgba(56,189,248,.14);
  color: var(--text);
  cursor:pointer;
}
.btn:hover{ background: rgba(56,189,248,.18); }
.hint{ margin-top:8px; font-size:12px; color: var(--muted); }

.main{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  height: 64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,18,32,.55);
  backdrop-filter: blur(10px);
}
.crumbs{ font-weight:650; letter-spacing:.2px; }
.user{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.dot{
  width:10px; height:10px; border-radius:999px;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}
.user-name{ font-size:13px; font-weight:650; }
.user-meta{ font-size:12px; color: var(--muted); margin-top:2px; }

.content{
  padding: 18px;
}

.card{
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 16px;
}
.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}
.col-6{ grid-column: span 6; }
.col-12{ grid-column: span 12; }

.kpi{
  padding: 14px;
  border-radius: 16px;
  background: rgba(15,26,46,.45);
  border: 1px solid rgba(255,255,255,.07);
}
.kpi .label{ margin:0; }
.kpi .value{ font-size:24px; font-weight:750; margin-top:8px; }
.small{ font-size:12px; color: var(--muted); margin-top:6px; }
.list{ margin-top:10px; display:flex; flex-direction:column; gap:10px; }
.item{
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
}

.brand-logo {
  width: 120px;
  height: 80px;
}

/* Contractor portal polish */
.card-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}

.h1{ font-size:18px; font-weight:750; }
.muted{ color: var(--muted); }
.small{ font-size:12px; }

.cards{ display:flex; flex-direction:column; gap:12px; margin-top:12px; }

.site-card{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.02);
  padding: 14px;
}

.site-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.site-title{ font-weight:750; font-size:15px; letter-spacing:.2px; }

.link{
  color: var(--text);
  text-decoration:none;
  font-size:13px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.link:hover{
  border-color: rgba(56,189,248,.25);
  background: rgba(56,189,248,.10);
}

.phases{ display:flex; flex-direction:column; gap:10px; }

.phase{
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(15,26,46,.35);
}

.phase-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}

.phase-name{ font-weight:700; }

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
}

.chip{
  font-size:12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56,189,248,.22);
  background: rgba(56,189,248,.10);
  color: var(--text);
}

.muted-chip{
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--muted);
}

.phase-sub{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,.10);
}

.btn-sm{
  width:auto;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55); /* slate dark */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);

  /* NEW: allow scroll if content is tall */
  overflow: auto;
  padding: 14px;
}

.modal-card {
  position: relative;

  /* NEW: keep within viewport + allow internal layout */
  width: min(900px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;

  /* nice card look (safe defaults if you already set elsewhere) */
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(99,102,241,0.6),
    transparent
  );
}

.modal.open .modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Header stays fixed */
.modal-head {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  background: linear-gradient(180deg, #0f172a, #111827);
  border-bottom: 1px solid rgba(255,255,255,0.08);

  flex: 0 0 auto; /* NEW */
}

.modal-head .btn {
  background: rgba(255,255,255,0.08);
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.15);
}

.modal-head .btn:hover {
  background: rgba(255,255,255,0.14);
}

.modal-head .h1 {
  font-size: 20px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.2px;
}

.modal-head .h1::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 20px;
  margin-right: 10px;
  border-radius: 3px;
  background: linear-gradient(180deg, #3b82f6, #6366f1);
  vertical-align: middle;
}

.modal-body .muted,
.modal-body .small,
.modal-body .label {
  color: #6b7280;
}

.modal-body .input,
.modal-body input,
.modal-body select,
.modal-body textarea {
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(0,0,0,.12);
}

.modal-body .input:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}


/* Body scrolls */
.modal-body {
  color: #111827;
  padding: 22px;
  background: #f9fafb;

  flex: 1 1 auto;              /* NEW */
  overflow: auto;              /* NEW */
  -webkit-overflow-scrolling: touch; /* NEW */
}

/* OPTIONAL: if you have a footer/actions section */
.modal-foot,
.modal-actions,
#snagModalActions {
  flex: 0 0 auto;
  padding: 14px 22px;
  background: #f9fafb;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.modal .btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: #fff;
}

.modal .btn.primary:hover {
  filter: brightness(1.05);
}

.table th { white-space: nowrap; }
.table td { vertical-align: middle; }

.site-card.clickable { cursor: pointer; }

.chip.active {
  background: rgba(56,189,248,.18);
  border-color: rgba(56,189,248,.35);
  color: #fff;
}

.btn.active-tab {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(37,99,235,0.35);
}


body.modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .modal {
    padding: 10px;
  }

  .modal-card {
    max-width: 100%;
    margin: 0;
    max-height: 92vh; /* slightly more room on mobile */
  }

  .modal-body {
    grid-template-columns: 1fr !important;
  }
}



.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
  color: rgba(255,255,255,0.9);
}

/* === MODAL FOOTER ACTIONS === */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 20px;
}

/* Neutral cancel */
.btn-outline {
  background: transparent;
  color: #293441;
  border: 1px solid rgba(59, 48, 149, 0.25);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.06);
}

/* Strong danger button */
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(220,38,38,0.35);
}
.btn-danger:hover {
  filter: brightness(1.1);
}

/* Disabled danger (while submitting) */
.btn-danger[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.info-pill.danger {
  background: rgba(169, 15, 15, 0.762);
  color: #cbcbcb;
  width: 330px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.snag-photos { margin-top: 10px; }
.snag-photos-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

.snag-thumb{
  width:64px; height:64px;
  border-radius:10px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  cursor:pointer;
  flex:0 0 auto;
}
.snag-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }

.snag-more{
  width:64px; height:64px;
  border-radius:10px;
  border:1px dashed rgba(255,255,255,.22);
  display:grid; place-items:center;
  font-weight:700;
  opacity:.9;
  cursor:pointer;
  user-select:none;
}

.site-card.clickable {
  cursor: pointer;
}

.site-card.clickable:hover {
  box-shadow: 0 0 0 2px rgba(8,145,178,0.15);
}

.activity-list {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.activity-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.activity-who {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937; /* strong readable slate */
}

.activity-when {
  font-size: 11px;
  color: #6b7280; /* medium grey */
}

.activity-msg {
  font-size: 13px;
  color: #374151; /* readable body grey */
  margin-top: 2px;
}

.activity-type {
  display: none; /* keep clean */
}

.btn.btn-sm{
  width:auto;
  margin-top:0;
  padding: 8px 12px;
}

.btn.btn-sm:not(.primary){
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--muted);
}

/* Programme grid */
.prog-plot-cell{
  padding:10px;
  font-weight:750;
  min-width:140px;
}

.prog-td{
  padding:6px;
  vertical-align:top;
}

.prog-spacer{
  padding:0 6px;
  width:20px;
}

.prog-cell{
  min-height:34px;
  border-radius:10px;
  background: rgba(255,255,255,.03);
  padding:6px;
  display:flex;
  flex-direction:column;
  gap:4px;
}

/* Smaller stackable jobs */
.prog-mini-bar{
  font-size:12px;
  padding:4px 6px;
  border-radius:8px;
  background: rgba(59,130,246,.22);
  border: 1px solid rgba(59,130,246,.35);
  cursor:pointer;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  user-select:none;
}
.prog-mini-bar:hover{
  background: rgba(59,130,246,.28);
}

.prog-cell:hover{
  outline:2px solid rgba(59,130,246,.15);
}

.prog-header-actions{
  display:flex;
  align-items:center;
  gap:12px;
}

.prog-version-badge{
  font-weight:700;
  font-size:13px;
  padding:6px 10px;
  border-radius:999px;
}

.prog-version-badge.draft{
  background:rgba(245,158,11,.15);
  color:#f59e0b;
  border:1px solid rgba(245,158,11,.3);
}

.prog-version-badge.live{
  background:rgba(16,185,129,.15);
  color:#10b981;
  border:1px solid rgba(16,185,129,.3);
}

.prog-mini-bar.prog-bar-mine{
  outline: 2px solid rgba(255,255,255,.28);
  box-shadow: 0 0 0 3px rgba(0,0,0,.18);
  background: rgba(56,189,248,.22);
  border-color: rgba(56,189,248,.35);
}

.prog-mini-bar.prog-bar-faded{
  opacity: .32;
  filter: saturate(.7);
}

.notif-badge{
  position:absolute;
  top:-6px;
  right:-6px;
  min-width:18px;
  height:18px;
  padding:0 6px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:800;
  line-height:1;
  background:#ef4444; /* red */
  color:#fff;
  border:2px solid var(--card, #fff); /* neat outline on dark/light */
}

/* Dashboard polish */
.dash-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
}

.dash-hero .title{
  font-size:22px;
  font-weight:800;
  letter-spacing:-0.2px;
}

.dash-hero .subtitle{
  margin-top:4px;
  color: rgba(255,255,255,0.65);
}

.kpi-card{
  position:relative;
  overflow:hidden;
  transition: transform .12s ease, box-shadow .12s ease;
  padding: 22px;
  border-radius: 20px;

}

.kpi-card:hover{
  transform: translateY(-2px);
}

.kpi-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.kpi-icon{
  width:34px;
  height:34px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  font-size:16px;
}

.kpi-label{
  font-size:12px;
  letter-spacing:0.2px;
  color: rgba(255,255,255,0.7);
  margin-top:2px;
}

.kpi-value{
  font-size:26px;
  font-weight:850;
  margin-top:8px;
}

.kpi-sub{
  margin-top:4px;
  color: rgba(255,255,255,0.65);
  font-size:12px;
}

.kpi-actions{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.progress{
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  overflow:hidden;
  margin-top:10px;
}

.progress > div{
  height:100%;
  width:0%;
  border-radius:999px;
  background: rgba(99,102,241,0.9); /* matches your blue vibe */
  transition: width .2s ease;
}

.dash-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 18px;
}

/* Responsive: stack on smaller screens */
@media (max-width: 900px){
  .dash-grid{
    grid-template-columns: 1fr;
  }
}

.rm-programme-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rm-programme-grid-head,
.rm-programme-grid-row {
  display: grid;
  grid-template-columns: 210px repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.rm-programme-plot-head,
.rm-programme-day-head,
.rm-programme-plot-cell,
.rm-programme-day-cell {
  border-radius: 16px;
}

.rm-programme-plot-head,
.rm-programme-day-head {
  padding: 12px 14px;
  font-weight: 700;
}

.rm-programme-plot-cell {
  padding: 14px;
  background: rgba(255,255,255,0.03);
}

.rm-programme-day-cell {
  min-height: 72px;
  padding: 8px;
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rm-programme-chip {
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(109, 132, 255, 0.20);
  border: 1px solid rgba(109, 132, 255, 0.35);
  line-height: 1.2;
}

.rm-programme-chip-title {
  font-weight: 700;
  font-size: 14px;
}

.rm-programme-chip-sub {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 3px;
}

.rm-programme-empty {
  min-height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

.rm-old-snag-row:hover {
  background: rgba(255,255,255,0.04);
}

.rm-old-snag-row {
  transition: background 0.15s ease;
}

.rm-old-snag-row:hover {
  background: rgba(255,255,255,0.05);
}

.rm-snag-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rm-snag-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.rm-snag-title {
  font-size: 28px;
  font-weight: 800;
  color: #111827;
  line-height: 1.1;
  margin-top: 4px;
}

.rm-snag-meta {
  margin-top: 6px;
  font-size: 14px;
  color: #6b7280;
}

.rm-snag-grid {
  display: grid;
  gap: 14px;
}

.rm-snag-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rm-snag-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rm-snag-panel {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.rm-snag-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 12px;
}

.rm-snag-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 10px;
}

.rm-snag-value {
  font-size: 34px;
  font-weight: 800;
  color: #111827;
  line-height: 1;
  margin-top: 4px;
}

.rm-snag-value-sm {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
  margin-top: 4px;
}

.rm-snag-sub {
  font-size: 13px;
  color: #6b7280;
  margin-top: 6px;
}

.rm-snag-text {
  font-size: 15px;
  color: #111827;
  margin-top: 4px;
  line-height: 1.45;
}

.rm-snag-latest {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.45;
  margin-top: 4px;
}

.rm-snag-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.rm-snag-attachment {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  overflow: hidden;
}

.rm-snag-attachment img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.rm-snag-attachment-date {
  padding: 10px;
  font-size: 12px;
  color: #6b7280;
}

@media (max-width: 900px) {
  .rm-snag-grid-4,
  .rm-snag-grid-2 {
    grid-template-columns: 1fr;
  }

  .rm-snag-title {
    font-size: 24px;
  }
}

@media (max-width: 900px) {
  .platform-admin-top {
    grid-template-columns: 1fr !important;
  }
}