:root {
  /* Brand - AEEIW LTD (Andromeda EEIW) */
  --primary: #27326d;
  --primary-light: #4a5aa3;
  --primary-dark: #1b2150;
  --accent: #19bfef;
  --font-display: 'Poppins', 'Montserrat', sans-serif;

  /* Neutral */
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-light: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;

  /* Sidebar */
  --sidebar-bg: #1c2454;
  --sidebar-text: #97a0c9;
  --sidebar-border: rgba(255, 255, 255, 0.06);

  /* Status */
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --purple: #7c3aed;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.25);
  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

.hidden { display: none !important; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ============ Login ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1b2150 0%, #27326d 50%, #1b2150 100%);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 28%, rgba(25, 191, 239, 0.12) 0%, transparent 38%),
    radial-gradient(circle at 82% 75%, rgba(25, 191, 239, 0.16) 0%, transparent 42%);
  pointer-events: none;
}

.login-panel {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 920px;
  min-height: 560px;
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.login-side {
  flex: 1.05;
  background: linear-gradient(165deg, #1b2150 0%, #232c63 55%, #27326d 100%);
  color: #fff;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-side::before {
  content: '';
  position: absolute;
  right: -90px; bottom: -90px;
  width: 280px; height: 280px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.login-side::after {
  content: '';
  position: absolute;
  right: -45px; bottom: -45px;
  width: 190px; height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(25, 191, 239, 0.18);
}
.brand-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 56px;
  position: relative;
  z-index: 1;
}
.logo-badge {
  background: #fff;
  border-radius: 16px;
  padding: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}
.brand-logo-img { width: 62px; height: 62px; display: block; }
.brand-hero-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand-hero-text .brand-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #fff;
  font-family: var(--font-display);
}
.brand-company {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}
.accent { color: var(--accent); }
.login-side h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.28;
  margin: 0 0 18px;
  max-width: 360px;
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
}
.login-tagline {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: #9fb0e8;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
  max-width: 320px;
  position: relative;
  z-index: 1;
}
.login-side-footer {
  margin-top: auto;
  padding-top: 32px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #7d8bc4;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.login-card {
  flex: 1;
  padding: 52px 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card h2 {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 800;
  font-family: var(--font-display);
}
.login-card .muted {
  color: var(--muted);
  margin: 0 0 26px;
  font-size: 13px;
}
.login-card label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 16px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(39, 50, 109, 0.12);
}
.login-card button {
  width: 100%;
  margin-top: 26px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 8px 20px rgba(39, 50, 109, 0.3);
}
.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 16px;
  font-weight: 600;
}

/* ============ App shell ============ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo-badge {
  background: #fff;
  border-radius: 9px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-img { width: 30px; height: 30px; display: block; }
.sidebar-brand .brand-name {
  display: block;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 1px;
  color: #fff;
  font-family: var(--font-display);
}
.sidebar-brand .brand-sub {
  display: block;
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.045); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(25, 191, 239, 0.25);
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 12px 20px;
  border-top: 1px solid var(--sidebar-border);
}
.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.13); }
.ghost-btn .icon { width: 15px; height: 15px; }

/* ---- Main area / topbar ---- */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  flex: 1;
  letter-spacing: -0.2px;
  font-family: var(--font-display);
}
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
}
.who-area { display: flex; align-items: center; gap: 12px; }
.who-info { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.who-name { font-size: 13px; font-weight: 700; }
.who-role {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.icon-btn:hover { background: #fef2f2; color: var(--red); border-color: #fecaca; }

main {
  flex: 1;
  padding: 24px 28px 60px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-intro {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ============ Buttons ============ */
button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: var(--primary-dark); }
button:active { transform: scale(0.98); }
button.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover { background: var(--bg); }

/* ============ Cards / tables ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 800;
}
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: #f8fafc;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}
tbody tr:hover { background: #f8fafc; }
select, input[type=text], input[type=date], input[type=number], input[type=password] {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(39, 50, 109, 0.1);
}

/* ============ Badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge.survey   { background: #e0e7ff; color: #4338ca; }
.badge.civils   { background: #fef3c7; color: #92400e; }
.badge.cable    { background: #dbeafe; color: #1d4ed8; }
.badge.splicing { background: #ede9fe; color: #6d28d9; }
.badge.trr      { background: #ffedd5; color: #c2410c; }
.badge.dark     { background: #fee2e2; color: #b91c1c; }
.badge.live     { background: #dcfce7; color: #15803d; }

.total-pill {
  font-weight: 800;
  color: var(--green);
  font-size: 14px;
  background: #f0fdf4;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #bbf7d0;
  white-space: nowrap;
}

/* ============ Dashboard ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--stat-color, var(--primary));
}
.stat-card .stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--stat-bg, rgba(39, 50, 109, 0.1));
  color: var(--stat-color, var(--primary));
  margin-bottom: 14px;
}
.stat-card .stat-value {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  font-family: var(--font-display);
}
.stat-card .stat-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-top: 5px;
}
.stat-card.c-blue   { --stat-color: #27326d; --stat-bg: rgba(39, 50, 109, 0.1); }
.stat-card.c-green  { --stat-color: #16a34a; --stat-bg: rgba(22, 163, 74, 0.1); }
.stat-card.c-amber  { --stat-color: #d97706; --stat-bg: rgba(217, 119, 6, 0.1); }
.stat-card.c-purple { --stat-color: #7c3aed; --stat-bg: rgba(124, 58, 237, 0.1); }
.stat-card.c-cyan   { --stat-color: #0891b2; --stat-bg: rgba(8, 145, 178, 0.1); }
.stat-card.c-red    { --stat-color: #dc2626; --stat-bg: rgba(220, 38, 38, 0.1); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 980px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.status-breakdown { display: flex; flex-direction: column; gap: 13px; }
.status-bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 40px;
  align-items: center;
  gap: 12px;
}
.status-bar-label { font-size: 12px; font-weight: 700; }
.status-bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.status-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
  min-width: 3px;
}
.status-bar-count { font-size: 12.5px; font-weight: 800; text-align: right; }

.leaderboard { display: flex; flex-direction: column; gap: 10px; }
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--bg);
}
.leaderboard-rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--muted);
  flex-shrink: 0;
}
.leaderboard-row:nth-child(1) .leaderboard-rank { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.leaderboard-row:nth-child(2) .leaderboard-rank { background: #e2e8f0; color: #475569; border-color: #cbd5e1; }
.leaderboard-row:nth-child(3) .leaderboard-rank { background: #fed7aa; color: #9a3412; border-color: #fdba74; }
.leaderboard-info { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.leaderboard-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.leaderboard-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-value { font-size: 12.5px; font-weight: 800; color: var(--green); white-space: nowrap; }
.leaderboard-bar { height: 5px; background: var(--border); border-radius: 999px; overflow: hidden; }
.leaderboard-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%); border-radius: 999px; }
.leaderboard-sub { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---- Engineer dashboard: assigned-jobs progress ---- */
.progress-list { display: flex; flex-direction: column; gap: 10px; }
.progress-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg);
}
.progress-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.progress-pon { font-size: 14px; font-weight: 800; }
.progress-pon .exchange { font-weight: 600; color: var(--muted); }
.progress-date {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.progress-date .icon { width: 14px; height: 14px; }
.progress-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}
.prog-act {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}
.prog-act b { color: var(--primary); font-weight: 800; }

/* ============ Job cards ============ */
.job-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.job-card:hover { box-shadow: var(--shadow-md); }
.job-card .job-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 16px 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.job-head .job-id { font-size: 15px; font-weight: 800; }
.job-head .job-id .exchange { font-weight: 600; color: var(--muted); margin-right: 2px; }
.job-head .meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}
.job-head .meta-item { display: flex; align-items: center; gap: 5px; font-weight: 500; }
.job-head .meta .icon { width: 13px; height: 13px; }
.job-head .head-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.job-head .head-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-head .head-right { display: flex; align-items: center; gap: 10px; }
.chevron {
  width: 18px; height: 18px;
  color: var(--muted-light);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.job-card.open .chevron { transform: rotate(180deg); }

.job-card .activities {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  background: #fafbfd;
}
.activity-row {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
}
.activity-row .label { font-size: 12.5px; font-weight: 700; line-height: 1.35; }
.activity-row .code {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
.activity-row .code .rate { color: var(--primary); }
.activity-main {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 10px;
  flex-wrap: wrap;
}
/* A real min-width stops the text column collapsing to nothing — that's what was
   letting the qty/Record/photo controls cram on top of the text. With a floor,
   the controls wrap to the next line on narrow cards instead of overlapping. */
.activity-main .info { flex: 1 1 100%; min-width: 150px; }
.activity-main .info + * { margin-top: 2px; }
.activity-main input {
  width: 64px;
  text-align: right;
  padding: 7px 8px;
  font-weight: 700;
  flex-shrink: 0;
}

.photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--muted);
  background: var(--bg);
  transition: all 0.15s;
}
.photo-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.photo-btn .icon { width: 16px; height: 16px; }

.activity-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.activity-photos:empty { display: none; }
.thumb { position: relative; width: 52px; height: 52px; }
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--border);
  display: block;
}
.thumb-del {
  position: absolute; top: -7px; right: -7px;
  width: 19px; height: 19px;
  padding: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  border: 2px solid var(--card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.job-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  gap: 12px;
}
.job-footer .label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted-note { color: var(--muted); font-size: 13px; margin: 0; }

/* ============ PON attachments (admin files for engineers) ============ */
.attach-section {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: #f4f7fc;
}
.attach-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  margin-bottom: 12px;
}
.attach-title .icon { width: 15px; height: 15px; }
.attach-list { display: flex; flex-direction: column; gap: 8px; }
.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
}
.attach-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}
.attach-link .icon { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.attach-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-size { font-size: 11px; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.attach-dl, .attach-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--border);
}
.attach-dl {
  background: var(--bg);
  color: var(--muted);
  text-decoration: none;
}
.attach-dl:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.attach-dl .icon { width: 15px; height: 15px; }
.attach-del {
  background: var(--card);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  padding: 0;
}
.attach-del:hover { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.attach-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 15px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.attach-upload:hover { background: var(--primary-dark); }
.attach-upload .icon { width: 15px; height: 15px; }

/* ============ Start-of-Day flow (engineer gating) ============ */
.sod-header { margin-bottom: 18px; }
.sod-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-display);
}
.sod-title .icon { width: 22px; height: 22px; color: var(--accent); }

.sod-start { text-align: center; padding: 40px 24px; max-width: 520px; margin: 0 auto; }
.sod-start-icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
}
.sod-start-icon .icon { width: 30px; height: 30px; }
.sod-start h3 { margin: 0 0 8px; font-size: 19px; }
.sod-start .muted-note { margin: 0 auto 24px; max-width: 400px; }
.sod-start-btn {
  font-size: 15px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 8px 20px rgba(39, 50, 109, 0.3);
}

.sod-card { max-width: 640px; padding: 0; overflow: hidden; }
.sod-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}
.sod-card-head h3 { margin: 0; font-size: 15px; font-weight: 800; flex: 1; }
.sod-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  flex-shrink: 0;
}
.sod-num .icon { width: 15px; height: 15px; }
.sod-card-head.done .sod-num { background: var(--green); }
.sod-card-head.locked .sod-num { background: var(--muted-light); }
.sod-status {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 999px;
}
.sod-status.ok { color: var(--green); background: #f0fdf4; }
.sod-summary {
  padding: 0 20px 16px 60px;
  font-size: 13px;
  color: var(--text-light);
}
.sod-card-head.locked + .muted-note,
.sod-card .muted-note { padding: 0 20px 16px 60px; }

.sod-body { padding: 4px 20px 20px 60px; display: flex; flex-direction: column; gap: 14px; }
.sod-field { display: flex; flex-direction: column; gap: 6px; }
.sod-field > span {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sod-field input {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  text-transform: uppercase;
}

.sod-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  user-select: none;
}
.sod-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.sod-check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
}
.sod-toggle input:checked + .sod-check {
  background: var(--green);
  border-color: var(--green);
}
.sod-toggle input:checked + .sod-check::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sod-toggle input:focus-visible + .sod-check { box-shadow: 0 0 0 3px rgba(39, 50, 109, 0.15); }

.sod-photos-block { display: flex; flex-direction: column; gap: 10px; }
.sod-photos-head span {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sod-add-photo {
  width: auto;
  gap: 8px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 700;
}
.sod-add-photo span { white-space: nowrap; }

/* Upload + Camera button pair */
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.camera-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.camera-btn:hover { background: var(--primary-dark); color: #fff; }
.activity-main .photo-actions { align-self: flex-start; }

.sod-continue {
  margin-top: 4px;
  align-self: flex-start;
  padding: 12px 24px;
  font-size: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.sod-note-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}
.sod-textarea {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
}
.sod-textarea:focus, .sod-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(39, 50, 109, 0.12);
}

/* ============ Per-job risk assessment ============ */
.risk-section {
  border-top: 1px solid var(--border);
  background: #fff7ed;
  padding: 16px 20px;
}
.risk-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b45309;
  margin-bottom: 14px;
}
.risk-title .icon { width: 16px; height: 16px; }
.risk-sub { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 11.5px; }
.risk-questions { display: flex; flex-direction: column; gap: 8px; }
.risk-q {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
}
.risk-q-label { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.35; }
.risk-seg { display: flex; gap: 0; flex-shrink: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.risk-seg-btn {
  background: #fff;
  color: var(--muted);
  border: none;
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.risk-seg-btn.yes.active { background: #dc2626; color: #fff; }
.risk-seg-btn.no.active { background: var(--green); color: #fff; }
.risk-comments { margin-top: 14px; }
.risk-subhead {
  margin: 18px 0 10px;
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.risk-photo-group { margin-bottom: 14px; }
.risk-photo-label { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.risk-submit {
  margin-top: 8px;
  padding: 12px 22px;
  font-size: 14px;
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
}
.risk-submit:hover { background: #92400e; }
.risk-done {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.risk-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--green);
}
.risk-done-badge .icon { width: 16px; height: 16px; }
.risk-done-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.risk-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.risk-pdf-link .icon { width: 15px; height: 15px; }
.risk-section { } /* keep specificity */
.risk-pending { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* ============ End of Day ============ */
.eod-summary {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.eod-summary > div { display: flex; flex-direction: column; gap: 2px; }
.eod-summary span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.eod-summary b { font-size: 16px; }
.sod-note-ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sod-note-ok .icon { width: 16px; height: 16px; }

/* ============ Admin: Daily Logs ============ */
.daylogs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.daylogs-head .page-intro { margin: 0; flex: 1; min-width: 220px; }
.daylogs-export { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.daylogs-export .icon { width: 15px; height: 15px; }
.dl-checklist .icon, .dl-loc .icon { width: 14px; height: 14px; vertical-align: middle; }
.dl-loc a { margin-right: 8px; white-space: nowrap; }

/* ============ Client: exchange progress bar ============ */
.cl-progress {
  display: inline-block;
  width: 110px;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 8px;
}
.cl-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--green) 100%);
  border-radius: 999px;
}
.cl-progress-pct { font-size: 12px; font-weight: 700; color: var(--muted); }

/* ============ PON search box ============ */
.pon-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.pon-search .icon { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.pon-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}

/* ============ Forms ============ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 6px;
}
.form-grid input, .form-grid select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--text);
}

.summary-table td:last-child, .summary-table th:last-child { text-align: right; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ============ Empty state ============ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state .icon {
  width: 42px; height: 42px;
  margin: 0 auto 14px;
  color: var(--muted-light);
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; }

/* ============ Responsive ============ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
}

/* ---- Pending-sync pill (offline queue indicator) ---- */
.sync-badge {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(8px);
  z-index: 500;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.sync-badge.show { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }
.sync-badge.offline { background: #475569; }
.sync-badge.syncing { background: var(--primary); }
.sync-badge .sb-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #fbbf24; flex-shrink: 0;
}
.sync-badge.syncing .sb-dot { background: var(--accent); animation: sb-pulse 1s infinite; }
@keyframes sb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

@media (max-width: 900px) {
  .login-panel { flex-direction: column; max-width: 460px; min-height: 0; }
  .login-side { padding: 36px 32px; }
  .login-tagline { display: none; }
  .login-side-footer { padding-top: 16px; }
  .login-card { padding: 36px 32px; }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }

  .menu-toggle { display: flex; }
  .who-info { display: none; }
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
}
