@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0F2436;
  --bg: #EAF3F8;
  --surface: #FFFFFF;
  --primary: #1B5FA8;
  --primary-dark: #123F70;
  --accent: #2FBFAE;
  --accent-dark: #1E9C8D;
  --border: #D3E4EE;
  --muted: #5C7A8A;
  --danger: #C24B4B;
  --danger-bg: #FBEBEA;
  --success-bg: #E4F6F3;
  --info-bg: #E9F1FA;
  --warning: #9A6B00;
  --warning-bg: #FFF2D1;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

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

h1, h2, h3 {
  font-family: 'Manrope', 'Inter', sans-serif;
}

a { color: var(--primary); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.top-bar {
  background: linear-gradient(100deg, var(--primary-dark), var(--primary) 55%, var(--accent-dark));
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.top-bar .who {
  font-size: 14px;
  opacity: 0.92;
}
.top-bar a { color: #fff; }

.admin-nav {
  display: flex;
  gap: 4px;
  background: var(--primary-dark);
  padding: 8px 24px 0;
  border-bottom: 3px solid var(--accent);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-nav a {
  display: inline-block;
  padding: 10px 16px;
  color: #cfe2ee;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
  margin-bottom: -3px;
  border-bottom: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
/* the section you're currently in: a solid teal tab that joins the
   teal line under the menu, with bold white text */
.admin-nav a.active {
  color: #fff;
  font-weight: 700;
  background: var(--accent);
  border-bottom-color: var(--accent);
  box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.35) inset;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.secondary:hover { background: var(--info-bg); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a53d3d; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 15%, #dcedf6 0%, var(--bg) 55%);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(15, 36, 54, 0.04);
}

.card h2 {
  margin-top: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.01em;
}

.login-card {
  width: 100%;
  max-width: 380px;
  border-left: 3px solid var(--accent);
}

.login-card h1 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--primary-dark);
  letter-spacing: -0.01em;
}
.login-card p.sub {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 14px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="tel"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  font-family: inherit;
  background: #FBFDFE;
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(27, 95, 168, 0.12);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #F0CBC9;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.success-msg {
  background: var(--success-bg);
  color: var(--accent-dark);
  border: 1px solid #BCE7DF;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
tbody tr:hover {
  background: #F5FAFD;
}
tbody tr.pending-row {
  background: var(--danger-bg);
}
tbody tr.pending-row:hover {
  background: #F7DEDB;
}

.report-text {
  white-space: pre-wrap;
  max-width: 420px;
  line-height: 1.5;
}

.report-text-clamped {
  max-width: 320px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  cursor: pointer;
  color: var(--ink);
  line-height: 1.5;
}
.report-text-clamped:hover {
  color: var(--primary);
}

.view-more-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.view-more-link:hover { color: var(--primary-dark); text-decoration: underline; }

.pill {
  display: inline-block;
  background: var(--info-bg);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
}
.pill-locked {
  background: var(--danger-bg);
  color: var(--danger);
}
.pill-editable {
  background: var(--success-bg);
  color: var(--accent-dark);
}
.pill-count {
  background: var(--info-bg);
  color: var(--primary-dark);
}
.pill-review {
  background: var(--warning-bg);
  color: var(--warning);
}
.pill-none {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding: 3px 0;
}

.verify-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.verify-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent-dark);
  cursor: pointer;
}

.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.row > div { flex: 1; min-width: 160px; }

.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 28px 0;
  text-align: center;
}

/* ---- modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 36, 54, 0.55);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay.open {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--accent);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px;
  position: relative;
}
.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
}
.modal-close-btn:hover { color: var(--ink); background: var(--bg); }

.actions-cell {
  white-space: nowrap;
}

.attachment-slot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.attachment-slot-row .slot-label {
  flex: 0 0 48px;
}
.attachment-slot-row input[type="file"] {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
}

/* Bigger, bolder number fields for currency values - used for sale
   amounts, and currency-note counts in counter cash / locker cash. */
input[type="number"].denom-input,
input[type="number"].money-input {
  font-size: 20px;
  font-weight: 700;
  padding: 12px 14px;
  border-width: 1.5px;
  color: var(--primary-dark);
}
input[type="number"].denom-input {
  text-align: center;
}
input[type="number"].money-input {
  font-size: 22px;
}
input[type="number"].denom-input:focus,
input[type="number"].money-input:focus {
  box-shadow: 0 0 0 4px rgba(27, 95, 168, 0.14);
}


/* ---- confirmation dialog + toast notifications ---- */
.confirm-overlay { z-index: 2000; align-items: center; }
.confirm-box { max-width: 400px; text-align: center; padding: 28px 24px 22px; }
.confirm-icon {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
  background: var(--info-bg); color: var(--primary);
}
.confirm-icon.danger { background: var(--danger-bg); color: var(--danger); }
.confirm-title { margin: 0 0 8px; font-size: 19px; }
.confirm-message { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-actions .btn { flex: 1; width: auto; }

#toastWrap {
  position: fixed; top: 16px; right: 16px; z-index: 3000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--primary-dark); color: #fff; padding: 12px 18px;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  border-left: 4px solid var(--accent);
  box-shadow: 0 6px 20px rgba(15, 36, 54, 0.25);
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: toastIn 0.25s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---- responsive ---- */
@media (max-width: 640px) {
  .top-bar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .top-bar h1 { font-size: 16px; }
  .admin-nav { padding: 8px 12px 0; }
  .admin-nav a { padding: 11px 14px; flex: 0 0 auto; text-align: center; }
  .wrap { padding: 18px 12px 44px; }
  .card { padding: 16px; border-radius: 12px; }
  .card h2 { font-size: 16px; }
  .row { flex-direction: column; align-items: stretch; }
  .row > div { min-width: 0; }

  .btn { width: 100%; padding: 12px 18px; }
  .row .btn, .card > .btn, form > .btn {
    width: 100%;
  }

  input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="tel"], textarea, select {
    font-size: 16px; /* prevents iOS auto-zoom on focus */
  }

  /* stacked "card" tables instead of a cramped horizontal-scroll grid */
  .table-scroll table,
  .table-scroll thead,
  .table-scroll tbody,
  .table-scroll th,
  .table-scroll td,
  .table-scroll tr {
    display: block;
  }
  .table-scroll thead { display: none; }
  .table-scroll tr {
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--surface);
  }
  .table-scroll tr.pending-row {
    border-left-color: var(--danger);
  }
  .table-scroll td {
    border-bottom: none;
    padding: 7px 0;
    max-width: none;
  }
  .table-scroll td:not(:last-child) {
    border-bottom: 1px dashed var(--border);
  }
  .table-scroll td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .table-scroll .report-text-clamped { max-width: none; }
  .actions-cell {
    white-space: normal;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .actions-cell .btn { width: auto; flex: 1; min-width: 90px; }

  /* page-number bars on every list page: keep Previous / Next side by side */
  [id$="Pagination"] { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
  [id$="Pagination"] .btn { width: auto; }

  /* bigger, easier-to-tap buttons inside stacked table cards */
  .table-scroll .btn { padding: 10px 14px !important; font-size: 14px !important; }

  /* multi-select delete bar wraps instead of overflowing */
  #bulkActionsBar { flex-wrap: wrap; }
  #bulkActionsBar .btn { width: auto; }

  /* popups: nearly full width, scrollable, buttons wrap onto their own line */
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .confirm-overlay { align-items: center; }
  .confirm-box { border-radius: 16px; }
  #toastWrap { left: 12px; right: 12px; top: 10px; }
  .modal-box { padding: 20px 16px; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-box div[style*="display:flex"] { flex-wrap: wrap; }
  .modal-box div[style*="display:flex"] .btn { flex: 1 1 120px; width: auto; }
  .modal-close-btn { top: 10px; right: 10px; font-size: 26px; padding: 6px 10px; }
}

@media (max-width: 400px) {
  .admin-nav a { font-size: 13px; padding: 11px 12px; }
}
