/* Admin panel styles */
:root {
  --a-bg: #f3f7f4;
  --a-side: #0b3d2c;
  --a-side-2: #12684a;
  --a-card: #fff;
  --a-text: #10241c;
  --a-muted: #5a7368;
  --a-line: rgba(11,61,44,.12);
  --a-green: #2fb56a;
  --a-lime: #a8e063;
  --a-danger: #d64545;
  --a-warn: #e6a700;
  --a-r: 14px;
  --a-shadow: 0 10px 30px rgba(6,43,30,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.admin-body {
  font-family: "Noto Sans Sinhala", "Poppins", system-ui, sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
  min-height: 100vh;
}

.admin-language {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 120;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--a-line);
  border-radius: 99px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--a-shadow);
  backdrop-filter: blur(12px);
}
.admin-language button {
  border: 0;
  border-radius: 99px;
  padding: 6px 10px;
  background: transparent;
  color: var(--a-muted);
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}
.admin-language button.active {
  background: linear-gradient(120deg, #158a54, #a8e063);
  color: #04231a;
}
html[lang="ta"] body.admin-body {
  font-family: "Noto Sans Tamil", "Poppins", "Noto Sans Sinhala", system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ---- Login ---- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(168,224,99,.25), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(47,181,106,.2), transparent 40%),
    linear-gradient(150deg, #062b1e, #0b3d2c 55%, #12684a);
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 34px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.login-card__brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}
.login-card__brand .mark {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(120deg, #158a54, #a8e063);
  font-size: 1.4rem;
}
.login-card h1 { font-size: 1.35rem; font-weight: 800; }
.login-card p { color: var(--a-muted); font-size: .92rem; margin: 6px 0 20px; }
.login-card label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--a-line); background: #f7fbf8;
  margin-bottom: 14px; outline: none;
}
.login-card input:focus { border-color: var(--a-green); box-shadow: 0 0 0 3px rgba(47,181,106,.15); }
.login-hint {
  margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: #eef8f1; color: var(--a-muted); font-size: .8rem; line-height: 1.55;
}
.login-error { color: var(--a-danger); font-size: .86rem; min-height: 20px; margin-bottom: 8px; }

/* ---- Shell ---- */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-shell.hidden { display: none; }
.login-screen.hidden { display: none; }

.sidebar {
  background: linear-gradient(180deg, var(--a-side), #062b1e);
  color: #eafff4;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px; border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 16px;
}
.sidebar__brand strong { display: block; font-size: .98rem; }
.sidebar__brand small { opacity: .7; font-size: .72rem; }
.nav-btn {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border: 0; border-radius: 12px;
  background: transparent; color: rgba(234,255,244,.82);
  cursor: pointer; margin-bottom: 4px; font-weight: 600; font-size: .9rem;
  transition: .2s;
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,.12); color: #fff;
}
.nav-btn .badge {
  margin-left: auto; background: var(--a-lime); color: #04231a;
  font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 99px;
}
.sidebar__foot {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: grid; gap: 8px;
}
.sidebar__foot a, .sidebar__foot button {
  font-size: .84rem; color: rgba(234,255,244,.75);
  background: transparent; border: 0; cursor: pointer; text-align: left; padding: 6px 10px;
}
.sidebar__foot a:hover, .sidebar__foot button:hover { color: #fff; }

.main {
  padding: 24px clamp(16px, 3vw, 34px) 48px;
  min-width: 0;
}
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  justify-content: space-between; margin-bottom: 22px;
}
.topbar h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); font-weight: 800; }
.topbar p { color: var(--a-muted); font-size: .9rem; }

.panel { display: none; }
.panel.active { display: block; }

/* ---- Cards / UI ---- */
.grid-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.card > .grid-stats { margin-bottom: 0; }
.stat-card {
  background: var(--a-card); border: 1px solid var(--a-line);
  border-radius: var(--a-r); padding: 18px; box-shadow: var(--a-shadow);
}
.stat-card small { color: var(--a-muted); font-size: .78rem; font-weight: 600; }
.stat-card strong {
  display: block; font-size: 1.7rem; font-weight: 800; margin-top: 4px;
  background: linear-gradient(120deg, #158a54, #a8e063);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.card {
  background: var(--a-card); border: 1px solid var(--a-line);
  border-radius: var(--a-r); padding: 20px; box-shadow: var(--a-shadow);
  margin-bottom: 18px;
}
.card__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  justify-content: space-between; margin-bottom: 16px;
}
.card__head h3 { font-size: 1.05rem; font-weight: 800; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 99px; border: 0; cursor: pointer;
  font-weight: 700; font-size: .88rem; transition: .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(120deg, #158a54, #a8e063); color: #04231a; }
.btn-ghost { background: #eef7f0; color: var(--a-text); border: 1px solid var(--a-line); }
.btn-danger { background: #ffe8e8; color: var(--a-danger); }
.btn-sm { padding: 7px 12px; font-size: .8rem; }

.field-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.field label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 5px; color: var(--a-muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1.5px solid var(--a-line); background: #fafdfb; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--a-green); box-shadow: 0 0 0 3px rgba(47,181,106,.12);
}
.field.full { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; }
table th, table td {
  padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--a-line);
  font-size: .88rem; vertical-align: top;
}
table th { color: var(--a-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
table tr:hover td { background: #f7fbf8; }
.empty { text-align: center; color: var(--a-muted); padding: 28px; font-size: .92rem; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: .72rem; font-weight: 700;
}
.pill-new { background: #e8f4ff; color: #1a5f9e; }
.pill-ok { background: #e8f8ee; color: #0f6b3d; }
.pill-no { background: #ffe8e8; color: var(--a-danger); }
.pill-wait { background: #fff6db; color: #8a6b00; }
.check-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.check-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--a-line); border-radius: 12px; padding: 10px;
  background: #f7fbf8;
}
.check-item {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: #fff; border: 1px solid var(--a-line); border-radius: 10px;
  padding: 8px 10px; font-size: .88rem; font-weight: 600;
}
.check-item:has(input:checked) { border-color: var(--a-green); background: #eefaf1; }
.check-item input { width: 16px; height: 16px; accent-color: #158a54; flex: none; }
.check-item small { color: var(--a-muted); font-weight: 500; }

.rate { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.rate__bar {
  flex: 1; height: 8px; border-radius: 99px; background: #e6efe9; overflow: hidden;
}
.rate__bar span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #158a54, #a8e063);
}
.rate small { color: var(--a-muted); font-weight: 700; font-size: .78rem; }

.money-in { color: #13834b; font-weight: 800; }
.money-out { color: var(--a-danger); font-weight: 800; }
.amount-positive { color: #13834b; }
.amount-negative { color: var(--a-danger); }

.input-inline {
  border: 1px solid var(--a-line); border-radius: 10px;
  padding: 8px 12px; background: #fff; font: inherit;
}

.chart-box { min-height: 220px; }
.chart-empty { color: var(--a-muted); text-align: center; padding: 48px 12px; font-size: .92rem; }
.bar-chart { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; }
.bar-row > span { font-size: .75rem; font-weight: 700; color: var(--a-muted); }
.bar-tracks { display: grid; gap: 4px; }
.bar-track {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.bar-track i {
  display: block; height: 10px; border-radius: 99px; min-width: 2px;
}
.bar-track .bar-in { background: linear-gradient(90deg, #158a54, #7ed957); }
.bar-track .bar-out { background: linear-gradient(90deg, #e35d5d, #f0a0a0); }
.bar-track small { font-size: .72rem; color: var(--a-muted); font-weight: 600; white-space: nowrap; }
.chart-legend {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: .8rem; font-weight: 700;
}
.chart-legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 6px; vertical-align: -1px;
}
.legend-in::before { background: #158a54; }
.legend-out::before { background: #e35d5d; }

.pie-wrap {
  display: grid; grid-template-columns: 160px 1fr; gap: 18px; align-items: center;
}
.pie {
  width: 160px; height: 160px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.pie-legend { display: grid; gap: 8px; }
.pie-legend div {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 8px;
  align-items: center; font-size: .82rem;
}
.pie-legend i { width: 12px; height: 12px; border-radius: 3px; }
.pie-legend strong { font-weight: 800; white-space: nowrap; }

.cert-doc, .id-card {
  background: #fff; border: 2px solid #158a54; border-radius: 16px;
  padding: 28px; text-align: center; color: #0d2f22;
}
.cert-doc {
  max-width: 720px; margin: 0 auto;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #158a54, #a8e063) border-box;
  border: 4px solid transparent;
}
.cert-doc__mark { font-size: 2rem; }
.cert-doc h2 { font-size: 1.6rem; margin: 8px 0 4px; }
.cert-doc h3 { font-size: 1.05rem; color: #158a54; margin-bottom: 18px; }
.cert-doc .name {
  font-size: 1.8rem; font-weight: 800; margin: 18px 0 8px;
  color: #0f6b3d;
}
.cert-doc .meta { color: #5a7368; line-height: 1.7; font-size: .95rem; }
.cert-doc__foot {
  display: flex; justify-content: space-between; margin-top: 36px;
  font-size: .82rem; color: #5a7368;
}
.cert-doc__foot span { border-top: 1px solid #c5d9cc; padding-top: 8px; min-width: 140px; }

.id-card {
  width: 340px; margin: 0 auto; text-align: left;
  background: linear-gradient(160deg, #f3fbf5, #ffffff 40%, #e8f6ec);
  position: relative; overflow: hidden;
}
.id-card::before {
  content: ""; position: absolute; inset: auto -40px -40px auto;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(21,138,84,.12);
}
.id-card__head {
  display: flex; justify-content: space-between; align-items: start;
  margin-bottom: 14px; position: relative;
}
.id-card__head strong { display: block; font-size: .95rem; }
.id-card__head small { color: #5a7368; }
.id-card__avatar {
  width: 54px; height: 54px; border-radius: 14px;
  background: linear-gradient(135deg, #158a54, #a8e063);
  color: #04231a; display: grid; place-items: center;
  font-weight: 800; font-size: 1.2rem;
}
.id-card h3 { font-size: 1.25rem; margin: 0 0 6px; position: relative; }
.id-card p { margin: 0; color: #5a7368; font-size: .86rem; position: relative; line-height: 1.55; }
.id-card__badge {
  display: inline-block; margin-top: 12px; padding: 4px 10px;
  border-radius: 999px; background: #e8f8ee; color: #0f6b3d;
  font-size: .75rem; font-weight: 800; position: relative;
}

@media print {
  body * { visibility: hidden !important; }
  .modal-back.open, .modal-back.open * { visibility: visible !important; }
  .modal-back.open {
    position: static !important; display: block !important;
    background: #fff !important; inset: auto !important;
  }
  .modal {
    box-shadow: none !important; border: none !important;
    max-width: none !important; width: 100% !important;
  }
  .modal-actions, .modal h3 { display: none !important; }
}

.receipt {
  border: 1px solid var(--a-line);
  border-radius: 14px;
  padding: 22px;
  background: #fff;
}
.receipt__head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #0b3d2c;
}
.receipt__total {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--a-line);
  text-align: right;
  font-size: 1.25rem;
  font-weight: 800;
}

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  background: #0b3d2c; color: #eafff4; padding: 12px 18px;
  border-radius: 12px; box-shadow: var(--a-shadow);
  transform: translateY(120%); opacity: 0; transition: .35s;
}
.toast.show { transform: none; opacity: 1; }

.modal-back {
  position: fixed; inset: 0; background: rgba(4,25,18,.55);
  display: none; place-items: center; z-index: 80; padding: 18px;
}
.modal-back.open { display: grid; }
.modal {
  width: min(560px, 100%); background: #fff; border-radius: 18px;
  padding: 22px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 14px; font-size: 1.1rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.quick-list { display: grid; gap: 10px; }
.quick-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: #f7fbf8; border: 1px solid var(--a-line);
}
.quick-item strong { font-size: .92rem; }
.quick-item small { color: var(--a-muted); display: block; }

.two-col {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px;
}
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto;
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  }
  .sidebar__brand { width: 100%; border: 0; margin: 0; padding-bottom: 8px; }
  .nav-btn { width: auto; }
  .sidebar__foot { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding-top: 8px; }
  .two-col { grid-template-columns: 1fr; }
}

@media print {
  body * { visibility: hidden; }
  .modal-back, .modal-back *, .receipt, .receipt * { visibility: visible; }
  .modal-back {
    position: absolute;
    inset: 0;
    display: block !important;
    background: #fff;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: none;
    box-shadow: none;
    padding: 0;
  }
  .modal > h3, .modal-actions { display: none !important; }
  .receipt { border: 0; }
}

.burger-admin {
  display: none;
}
