:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #111827;
  --primary-soft: #eef2ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --radius: 24px;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, .12), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, .10), transparent 24rem),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(100%, 960px);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, .8);
}
.login-hero {
  padding: 46px;
  color: #fff;
  background: linear-gradient(140deg, #0f172a, #1e293b 58%, #334155);
}
.login-hero h1 { margin: 18px 0 12px; font-size: clamp(32px, 6vw, 58px); line-height: 1; letter-spacing: -.05em; }
.login-hero p { color: #cbd5e1; line-height: 1.7; }
.login-form { padding: 46px; }
.logo-badge {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px;
  background: rgba(255,255,255,.14); font-weight: 900; font-size: 24px;
}
.demo-box {
  margin-top: 28px; padding: 18px; border-radius: 22px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
  color: #e2e8f0; font-size: 14px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px; background: rgba(255,255,255,.78); backdrop-filter: blur(20px);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .avatar { width: 44px; height: 44px; border-radius: 16px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 900; }
.brand small, .user-mini small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 8px; }
.nav a {
  padding: 13px 14px; border-radius: 16px; color: #334155; font-weight: 700; font-size: 14px; transition: .2s ease;
}
.nav a:hover, .nav a.active { background: var(--primary); color: #fff; transform: translateY(-1px); }
.sidebar-footer { margin-top: auto; display: grid; gap: 14px; }
.user-mini { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 18px; background: #f8fafc; border: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 14px; }
.logout { text-align: center; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 700; }

.content { padding: 28px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 3px 0 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--muted); font-weight: 700; font-size: 13px; }
.date-pill { white-space: nowrap; padding: 12px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 800; color: #334155; box-shadow: 0 8px 18px rgba(15,23,42,.04); }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: rgba(255,255,255,.92); border: 1px solid rgba(226,232,240,.9); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(15,23,42,.05); padding: 20px; }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 999px; right: -44px; bottom: -54px; background: rgba(15, 23, 42, .06); }
.stat small { color: var(--muted); font-weight: 700; }
.stat strong { display: block; margin-top: 8px; font-size: 34px; letter-spacing: -.04em; }
.section-title { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.section-title p { margin: 5px 0 0; color: var(--muted); }

.form-grid { display: grid; gap: 16px; }
label span { display: block; margin: 0 0 8px; font-weight: 800; font-size: 13px; color: #334155; }
.input, input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 18px; padding: 13px 15px; background: #fff; color: var(--text);
  font: inherit; outline: none; transition: .15s ease;
}
textarea { resize: vertical; min-height: 112px; }
input:focus, select:focus, textarea:focus { border-color: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,.16); }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; cursor: pointer; border-radius: 18px; padding: 13px 16px;
  font-weight: 900; background: var(--primary); color: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.14); transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.secondary { background: #fff; color: #334155; border: 1px solid var(--line); box-shadow: none; }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.warning { background: var(--warning); }
.btn.small { padding: 9px 12px; border-radius: 14px; font-size: 13px; }
.btn.full { width: 100%; }

.alert { margin-bottom: 16px; padding: 14px 16px; border-radius: 18px; font-weight: 700; border: 1px solid transparent; }
.alert.success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert.danger { background: var(--danger-soft); color: #9f1239; border-color: #fecdd3; }
.badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 900; border: 1px solid transparent; white-space: nowrap; }
.badge.success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.badge.warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.badge.danger { background: var(--danger-soft); color: #9f1239; border-color: #fecdd3; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 760px; }
th, td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.cell-strong { font-weight: 900; }
.muted { color: var(--muted); }
.link-list { max-width: 320px; white-space: pre-wrap; overflow-wrap: anywhere; color: #475569; font-size: 13px; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.upload-box { border: 1.5px dashed #cbd5e1; border-radius: 24px; background: #f8fafc; padding: 18px; }
.upload-label { display: grid; place-items: center; text-align: center; gap: 8px; min-height: 150px; border-radius: 20px; background: #fff; cursor: pointer; font-weight: 900; color: #334155; }
.upload-label small { color: var(--muted); font-weight: 600; }
.preview-wrap { display: none; margin-top: 14px; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.preview-wrap.show { display: block; }
.preview-wrap img { max-height: 380px; width: 100%; object-fit: contain; }
.ss-thumb { width: 92px; height: 92px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); background: #f8fafc; }

.report-card { display: grid; grid-template-columns: 1fr 220px; gap: 18px; }
.report-proof { border-radius: 20px; border: 1px solid var(--line); overflow: hidden; background: #f8fafc; min-height: 180px; display: grid; place-items: center; }
.report-proof img { width: 100%; height: 100%; object-fit: cover; }
.kpi-line { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.kpi { padding: 14px; background: #f8fafc; border-radius: 18px; }
.kpi small { color: var(--muted); font-weight: 800; }
.kpi strong { display: block; margin-top: 5px; font-size: 24px; }

.mobile-only { display: none; }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { grid-template-columns: 230px 1fr; }
}

@media (max-width: 820px) {
  .login-card { grid-template-columns: 1fr; }
  .login-hero, .login-form { padding: 28px; }
  .app-shell { display: block; }
  .sidebar {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 16px;
  }
  .nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .nav a { white-space: nowrap; }
  .sidebar-footer { display: none; }
  .content { padding: 18px; }
  .topbar { align-items: flex-start; }
  .date-pill { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .report-card { grid-template-columns: 1fr; }
  .kpi-line { grid-template-columns: 1fr; }
  .mobile-only { display: block; }
}

@media (max-width: 520px) {
  .content { padding: 14px; }
  .card { padding: 16px; border-radius: 22px; }
  .topbar h1 { font-size: 30px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .actions .btn { flex: 1; }
  .login-page { padding: 12px; }
  .login-card { border-radius: 24px; }
}

/* v3 branding */
.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .08);
}
.login-logo {
  width: min(100%, 310px);
  height: auto;
  padding: 10px 14px;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 14px 35px rgba(0,0,0,.18);
}
.brand strong { letter-spacing: -.03em; }

/* Multi screenshot preview */
.multi-preview {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.multi-preview.show { display: grid; }
.preview-item {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 18px rgba(15,23,42,.04);
}
.preview-img {
  height: 112px;
  background: #f1f5f9;
  display: grid;
  place-items: center;
}
.preview-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-item span {
  display: block;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* Proof gallery */
.proof-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}
.proof-thumb {
  position: relative;
  min-height: 116px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f8fafc;
  box-shadow: 0 8px 18px rgba(15,23,42,.04);
}
.proof-thumb img {
  width: 100%;
  height: 118px;
  object-fit: cover;
  transition: transform .2s ease;
}
.proof-thumb:hover img { transform: scale(1.04); }
.proof-thumb span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,.78);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

/* Bulk target check cards */
.select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.label-title {
  display: block;
  font-weight: 800;
  font-size: 13px;
  color: #334155;
}
.worker-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 290px;
  overflow: auto;
  padding: 2px;
}
.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: .18s ease;
}
.check-card:hover { border-color: #94a3b8; transform: translateY(-1px); }
.check-card input {
  width: 18px;
  height: 18px;
  accent-color: #0f172a;
}
.check-card strong { display: block; font-size: 14px; }
.check-card small { display: block; margin-top: 2px; color: var(--muted); }
.check-card:has(input:checked) {
  background: #f0fdfa;
  border-color: #2dd4bf;
  box-shadow: 0 10px 20px rgba(20,184,166,.08);
}

/* Modern confirmation modal */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.confirm-modal.show { display: flex; }
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(8px);
}
.confirm-dialog {
  position: relative;
  width: min(100%, 430px);
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,.42);
  background: rgba(255,255,255,.96);
  box-shadow: 0 30px 80px rgba(15,23,42,.32);
  padding: 26px;
  text-align: center;
  transform: translateY(10px) scale(.98);
  opacity: 0;
  animation: modalIn .18s ease forwards;
}
@keyframes modalIn {
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.confirm-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  font-weight: 900;
  font-size: 25px;
  background: linear-gradient(135deg, #0f172a, #0ea5e9 55%, #14b8a6);
  box-shadow: 0 16px 30px rgba(14,165,233,.23);
}
.confirm-dialog h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.03em;
}
.confirm-dialog p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 820px) {
  .brand-logo { width: 42px; height: 42px; }
  .proof-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .worker-check-grid { grid-template-columns: 1fr; max-height: none; }
}

@media (max-width: 520px) {
  .login-logo { width: 240px; }
  .multi-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .confirm-dialog { border-radius: 24px; padding: 22px; }
  .confirm-actions { grid-template-columns: 1fr; }
}
.field-label {
  display: block;
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 13px;
  color: #334155;
}
.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
