/* LCPD Reporting Portal — Shared Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f3f4f6; color: #111827; min-height: 100vh; font-size: 11px; }
a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.app-shell { display: flex; min-height: calc(100vh - 46px); margin-top: 46px; align-items: stretch; }
.sidebar {
  width: 210px; background: #1a7a3c;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 46px; left: 0; height: calc(100vh - 46px); overflow-y: auto; z-index: 100;
}
.sidebar-logo { padding: 16px 14px 14px; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; align-items: center; gap: 9px; }
.sidebar-logo img { width: 34px; height: 34px; object-fit: contain; border-radius: 5px; background:#fff; padding:2px; flex-shrink:0; }
.sidebar-logo span { color: #fff; font-size: 12px; font-weight: 700; line-height: 1.3; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 16px; color: rgba(255,255,255,.8); font-size: 11px; cursor: pointer; transition: background .15s; text-decoration: none; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-user { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.9); font-size: 12px; }
.sidebar-user strong { display: block; margin-bottom: 2px; font-size: 13px; }
.sidebar-user small { color: rgba(255,255,255,.6); font-size: 11px; }
.btn-logout { margin: 8px 14px 14px; padding: 7px 12px; background: rgba(255,255,255,.1); color: #fff !important; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; font-size: 12px; cursor: pointer; justify-content: center; }
.btn-logout:hover { background: rgba(255,255,255,.2); }
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-left: 210px; overflow-x: hidden; }
.topbar { background: #f0fdf4; border-bottom: 1px solid #bbf7d0; padding: 10px 20px; display: flex; align-items: center; gap: 12px; position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 200; box-sizing: border-box; }
.topbar h1 { font-size: 15px; font-weight: 700; color: #15803d; }
.menu-toggle { color: #15803d !important; }
.page-body { padding: 18px 20px; flex: 1; min-width: 0; }

/* ── Mobile menu toggle ── */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; color: #111827; }
.menu-toggle svg { width: 22px; height: 22px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }

/* ── Cards ── */
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 18px; margin-bottom: 16px; overflow: hidden; }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: #111827; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 11px; font-weight: 600; color: #374151; margin-bottom: 5px; }
label .req { color: #ef4444; margin-left: 2px; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid #d1d5db; border-radius: 7px;
  font-size: 11px; color: #111827; background: #fff; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #1a7a3c; box-shadow: 0 0 0 3px rgba(26,122,60,.12); }
input[readonly], select[disabled] { background: #f9fafb; color: #6b7280; cursor: not-allowed; }
textarea { min-height: 72px; resize: vertical; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 16px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; border: none; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary   { background: #1a7a3c; color: #fff; }
.btn-primary:hover   { background: #155f2f; }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger    { background: #ef4444; color: #fff; }
.btn-danger:hover    { background: #dc2626; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover   { background: #15803d; }
.btn-sm   { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; }

/* ── Auth pages ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a7a3c 0%, #155f2f 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; padding: 36px 32px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { width: 58px; height: 58px; object-fit: contain; }
.auth-logo h1 { font-size: 19px; font-weight: 800; color: #1a7a3c; margin-top: 8px; }
.auth-logo p  { font-size: 13px; color: #6b7280; margin-top: 3px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 13px; color: #6b7280; }
.auth-footer a { color: #1a7a3c; font-weight: 600; }

/* ── Alerts ── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 11px; margin-bottom: 14px; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-info    { background: #f0fdf4; color: #1a7a3c; border: 1px solid #bbf7d0; }

/* ── Steps ── */
.steps { display: flex; gap: 0; margin-bottom: 20px; border-radius: 8px; overflow: hidden; border: 1px solid #e5e7eb; }
.step { flex: 1; padding: 9px 4px; text-align: center; font-size: 11px; font-weight: 600; background: #f9fafb; color: #9ca3af; border-right: 1px solid #e5e7eb; cursor: pointer; }
.step:last-child { border-right: none; }
.step.active { background: #1a7a3c; color: #fff; }
.step.done   { background: #dcfce7; color: #16a34a; }
.step-number { display: block; font-size: 14px; font-weight: 800; margin-bottom: 1px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
thead th { background: #f9fafb; padding: 8px 10px; text-align: left; font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
tbody td { padding: 9px 10px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.td-nowrap { white-space: nowrap; }
tbody tr:hover { background: #f9fafb; }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */


/* ── Stats cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat-card .label { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing:.04em; }
.stat-card .value { font-size: 28px; font-weight: 800; color: #1a7a3c; margin: 4px 0 2px; }
.stat-card .sub   { font-size: 11px; color: #9ca3af; }

/* ── Profile ── */
.profile-photo-wrap { position: relative; display: inline-block; margin-bottom: 16px; }
.profile-photo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 3px solid #e5e7eb; }
.profile-photo-btn { position: absolute; bottom: 2px; right: 2px; background: #1a7a3c; color: #fff; border: none; border-radius: 50%; width: 26px; height: 26px; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.readonly-field { padding: 8px 11px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 7px; font-size: 11px; color: #6b7280; }

/* ── Dashboard two-col grid ── */
.dashboard-grid { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; min-width: 0; }

/* ── Checkbox group ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 5px; font-size: 11px; cursor: pointer; }
.checkbox-item input[type=checkbox] { width: 15px; height: 15px; accent-color: #1a7a3c; }

/* ── Multi-input ── */
.multi-input-list { display: flex; flex-direction: column; gap: 7px; }
.multi-input-row  { display: flex; gap: 7px; align-items: center; }
.multi-input-row input { flex: 1; }
.btn-remove { background: #fee2e2; color: #dc2626; border: none; border-radius: 4px; padding: 5px 9px; cursor: pointer; font-size: 13px; }
.btn-add    { background: #f0fdf4; color: #1a7a3c; border: 1px dashed #1a7a3c; border-radius: 4px; padding: 6px 12px; cursor: pointer; font-size: 12px; font-weight: 600; margin-top: 5px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 5px; align-items: center; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.pagination button { padding: 5px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; }
.pagination button.active { background: #1a7a3c; color: #fff; border-color: #1a7a3c; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Spinner ── */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast { position: fixed; bottom: 20px; right: 20px; padding: 12px 18px; border-radius: 10px; background: #1a7a3c; color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(16px); transition: all .3s; z-index: 9999; pointer-events: none; max-width: calc(100vw - 40px); }
#toast.show  { opacity: 1; transform: translateY(0); }
#toast.error   { background: #dc2626; }
#toast.success { background: #16a34a; }

/* ── File upload ── */
.file-list { margin-top: 7px; display: flex; flex-direction: column; gap: 5px; }
.file-item { display: flex; align-items: center; justify-content: space-between; padding: 5px 9px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 12px; }
.file-item button { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 15px; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: -220px; top: 0; height: 100vh;
    z-index: 100; transition: left .25s ease; width: 210px;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .menu-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 12px; }
  .topbar { padding: 10px 14px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  /* Tables scroll horizontally on mobile */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }
  /* Buttons easier to tap */
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 7px 12px; }
  /* Forms full width */
  input[type=text], input[type=email], input[type=password],
  input[type=tel], input[type=date], input[type=number], select, textarea {
    font-size: 14px; /* prevents iOS zoom on focus */
  }
  /* Step nav wraps better */
  .steps { flex-wrap: nowrap; overflow-x: auto; }
  /* Flex rows stack */
  div[style*="display:flex"][style*="gap"] { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .steps .step { font-size: 10px; padding: 7px 2px; }
  .steps .step-number { font-size: 12px; }
  .card { padding: 12px; }
  .page-body { padding: 10px; }
  /* Single column stats on very small screens */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  /* Auth card full width */
  .auth-card { padding: 24px 18px; }
  /* Topbar title shorter */
  .topbar h1 { font-size: 13px; }
}

::placeholder { color: #c4c9d4; opacity: 1; }
:-ms-input-placeholder { color: #c4c9d4; }
::-ms-input-placeholder { color: #c4c9d4; }

select option[value=""] { color: #c4c9d4; }
select option:not([value=""]) { color: #111827; }
select.placeholder-shown, select:has(option[value=""]:checked) { color: #c4c9d4; }
