/* =============================================================================
 * RupyaPesa Auto Pay — Admin dashboard theme
 * A classic, professional, light UI: white surfaces on a soft canvas, a navy
 * accent, hairline borders, restrained shadows, and clean typography.
 * ===========================================================================*/

:root {
  /* Canvas & surfaces */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;      /* inputs, table headers, insets */
  --surface-3: #eef2f7;      /* hover */

  /* Lines */
  --border: #dde3ea;
  --border-strong: #c7d0db;

  /* Text */
  --text: #17233a;           /* near-black navy */
  --text-muted: #5b6b82;
  --text-subtle: #8a97a8;

  /* Brand — classic navy blue */
  --primary: #1d4e89;
  --primary-hover: #163d6c;
  --primary-active: #112f54;
  --primary-tint: #e9f0f9;
  --ring: rgba(29, 78, 137, 0.28);

  /* Semantic */
  --success: #17724a;
  --success-tint: #e6f2ec;
  --danger: #b42318;
  --danger-hover: #971b12;
  --danger-tint: #fbecea;
  --warning: #a5580a;
  --warning-tint: #fbf0e3;

  /* Depth */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.09), 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 10px 28px rgba(16, 24, 40, 0.14);

  /* Shape */
  --radius: 12px;
  --radius-sm: 8px;

  /* Back-compat aliases (older inline styles reference these) */
  --card: var(--surface);
  --card-2: var(--surface-2);
  --muted: var(--text-muted);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

::selection { background: var(--primary-tint); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- *
 * Layout
 * ---------------------------------------------------------------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 56px; }

.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 50% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    var(--bg);
}

/* ---------------------------------------------------------------- *
 * App bar
 * ---------------------------------------------------------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.appbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-active) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-sm);
}
.brand-text { min-width: 0; }
.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.who strong { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- *
 * Cards & sections
 * ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.wrap > .card { margin-bottom: 20px; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
p.hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-head h2 { margin-bottom: 0; }

/* ---------------------------------------------------------------- *
 * Login
 * ---------------------------------------------------------------- */
.login-card {
  width: 380px;
  max-width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-md);
  text-align: left;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  margin-bottom: 22px;
}
.login-brand .brand-mark { width: 48px; height: 48px; border-radius: 12px; font-size: 18px; }
.login-card h1 { font-size: 19px; margin: 0; }

/* ---------------------------------------------------------------- *
 * Forms
 * ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.field input,
.field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: var(--text-subtle); }
.field input:hover,
.field select:hover { border-color: #adb9c7; }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%235b6b82' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
}

/* ---------------------------------------------------------------- *
 * Buttons
 * ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.02s ease;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { background: var(--primary-active); transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-3); border-color: #b6c0cd; }
.btn-secondary:active { background: var(--surface-2); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; padding: 11px 16px; }

/* ---------------------------------------------------------------- *
 * Status / feedback text
 * ---------------------------------------------------------------- */
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; }
.ok-text { color: var(--success); font-size: 13px; min-height: 18px; }
.error-text:not(:empty),
.ok-text:not(:empty) { margin: 2px 0 12px; }

/* ---------------------------------------------------------------- *
 * Badges
 * ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  border: 1px solid transparent;
  line-height: 1.5;
}
.badge-admin    { background: var(--primary-tint); color: var(--primary); border-color: #cfe0f2; }
.badge-user     { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.badge-active   { background: var(--success-tint); color: var(--success); border-color: #c6e3d3; }
.badge-disabled { background: var(--danger-tint); color: var(--danger); border-color: #f0cfcb; }
.badge-warning  { background: var(--warning-tint); color: var(--warning); border-color: #efd9bf; }

/* ---------------------------------------------------------------- *
 * Tables
 * ---------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 11px 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

td.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
td.amt-pos { color: var(--success); }
td.amt-neg { color: var(--text); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- *
 * Modals
 * ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 35, 58, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  animation: backdrop-in 0.15s ease;
}
.modal {
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow-md);
  animation: modal-in 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.modal h2 { font-size: 17px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------------------------------------------------------- *
 * Utilities
 * ---------------------------------------------------------------- */
.hidden { display: none !important; }

/* ---------------------------------------------------------------- *
 * Responsive
 * ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .appbar-inner { padding: 0 16px; }
  .brand-sub { display: none; }
  .who { font-size: 12px; gap: 8px; }
  .wrap { padding: 20px 16px 40px; }
  .card { padding: 18px; }
  .modal { width: 100%; }
}
