:root {
  --orange: #ff7a1a;
  --orange-dark: #e8610a;
  --orange-light: #ffb877;
  --orange-pale: #fff3e9;
  --ink: #2b2620;
  --muted: #8a7f74;
  --bg: #fbf7f3;
  --card: #ffffff;
  --border: #ffd9b3;
  --danger: #e5484d;
  --success: #22a55d;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(232, 97, 10, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  border: 3px solid var(--orange);
}

.auth-card h1 {
  text-align: center;
  color: var(--orange-dark);
  margin: 0 0 4px;
  font-size: 24px;
}

.auth-card p.sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 13px;
}

.role-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--orange-pale);
  border-radius: 999px;
  padding: 4px;
}

.role-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 4px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--orange-dark);
  transition: all .15s;
}

.role-tabs button.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 97, 10, 0.4);
}

.form-group { margin-bottom: 16px; }

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

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--orange);
  background: var(--orange);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}

.btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn.btn-block { width: 100%; }
.btn.btn-outline { background: transparent; color: var(--orange-dark); }
.btn.btn-outline:hover { background: var(--orange-pale); }
.btn.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn.btn-danger:hover { background: #c93337; border-color: #c93337; }
.btn.btn-sm { padding: 6px 12px; font-size: 12px; }

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error { background: #fdeaea; color: #b3262a; border: 1px solid #f5b9bb; }
.alert-success { background: #e8f8ee; color: #1c8a4c; border: 1px solid #a9e6c1; }

/* ===== App shell ===== */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: #201a14;
  color: #f2e9df;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,122,26,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .brand .logo {
  width: 36px; height: 36px;
  background: var(--orange);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #fff;
}

.sidebar .brand h2 {
  font-size: 15px;
  margin: 0;
  color: #fff;
}
.sidebar .brand span {
  font-size: 11px;
  color: var(--orange-light);
}

.nav-section { padding: 12px 0; }
.nav-section .nav-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #a08d78;
  padding: 8px 18px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #e8ddd0;
  font-size: 14px;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255,122,26,0.15);
  border-left-color: var(--orange);
  color: #fff;
  text-decoration: none;
}

.nav-link .ic { width: 18px; text-align: center; }

.submenu { display: none; background: rgba(0,0,0,0.15); }
.submenu.open { display: block; }
.submenu .nav-link { padding-left: 42px; font-size: 13px; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 3px solid var(--orange);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  color: var(--ink);
}

.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 2px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.topbar .user-chip .av {
  width: 30px; height: 30px;
  background: var(--orange);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.content { padding: 24px; flex: 1; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-head h2 { margin: 0; font-size: 20px; }
.breadcrumb { font-size: 12px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

/* ===== Stat cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--orange);
}

.stat-card .num { font-size: 26px; font-weight: 700; color: var(--orange-dark); }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== Cards / panels ===== */
.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card .card-head {
  padding: 14px 18px;
  border-bottom: 2px solid var(--orange-pale);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card .card-head h3 { margin: 0; font-size: 15px; }
.card .card-body { padding: 18px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border: 2px solid var(--orange); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th {
  background: var(--orange);
  color: #fff;
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
table.grid td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--orange-pale);
  font-size: 13px;
  border-right: 1px solid var(--orange-pale);
}
table.grid td:last-child { border-right: none; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: var(--orange-pale); }

.dt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 2px solid var(--orange-pale);
}
.dt-toolbar .dt-length {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.dt-toolbar .dt-length select {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
}
.dt-toolbar .dt-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.dt-toolbar .dt-search input {
  width: 220px;
  padding: 8px 12px;
}
.dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.dt-info { font-size: 12px; color: var(--muted); }
.dt-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dt-pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 6px;
  color: var(--orange-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.dt-pagination button:hover:not(:disabled) { background: var(--orange-pale); border-color: var(--orange); }
.dt-pagination button.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.dt-pagination button:disabled { opacity: .4; cursor: not-allowed; }
.dt-pagination .dt-ellipsis { padding: 0 4px; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-active { background: #e8f8ee; color: #1c8a4c; }
.badge-inactive { background: #fdeaea; color: #b3262a; }
.badge-credit { background: #e8f8ee; color: #1c8a4c; }
.badge-debit { background: #fdeaea; color: #b3262a; }

.actions-cell { display: flex; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--orange-dark);
}
.icon-btn:hover { background: var(--orange-pale); border-color: var(--orange); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: #fdeaea; border-color: var(--danger); }

.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(32,26,20,0.55);
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  border: 3px solid var(--orange);
  width: 100%; max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal.modal-lg {
  max-width: 75vw;
}
@media (max-width: 900px) {
  .modal.modal-lg { max-width: 100%; }
}
.modal .modal-head {
  padding: 16px 20px;
  border-bottom: 2px solid var(--orange-pale);
  display: flex; align-items: center; justify-content: space-between;
}
.modal .modal-head h3 { margin: 0; font-size: 16px; }
.modal .modal-body { padding: 20px; }
.modal .modal-foot { padding: 14px 20px; border-top: 2px solid var(--orange-pale); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--muted); background: none; border: none; }

.cert-box { border: 3px double var(--orange); padding: 30px; text-align: center; }
.cert-title { font-size: 22px; font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; }
.cert-church { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.cert-body { text-align: left; font-size: 15px; line-height: 1.9; margin: 20px 0; }
.cert-signrow { display: flex; justify-content: space-between; margin-top: 60px; }
.cert-sign { text-align: center; width: 220px; border-top: 1px solid #333; padding-top: 6px; font-size: 13px; }

@media print {
  body * { visibility: hidden; }
  .cert-print-area, .cert-print-area * { visibility: visible; }
  .cert-print-area { position: absolute; top: 0; left: 0; width: 100%; padding: 40px; box-sizing: border-box; }
}

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .form-group { flex: 1; min-width: 160px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.toast {
  position: fixed;
  top: 20px; right: 20px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  border-left: 4px solid var(--orange);
  z-index: 2000;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  display: none;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: end;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; top: 0; z-index: 999; transition: left .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 14px; }
}

/* ===================================================================
   Public website (Home / About / Gallery / Contact)
   =================================================================== */

.pub-body { margin: 0; }

.pub-nav {
  position: sticky; top: 0; z-index: 500;
  background: #fff;
  border-bottom: 3px solid var(--orange);
  box-shadow: var(--shadow);
}
.pub-nav-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.pub-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 19px; font-weight: 700; color: var(--ink) !important;
  text-decoration: none !important;
}
.pub-brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.pub-nav-toggle {
  display: none;
  background: none; border: 2px solid var(--border); border-radius: 8px;
  font-size: 20px; color: var(--orange-dark); cursor: pointer; padding: 4px 10px;
}
.pub-nav-links { display: flex; align-items: center; gap: 6px; }
.pub-nav-links a {
  color: var(--ink) !important; text-decoration: none !important;
  font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 8px;
}
.pub-nav-links a:hover, .pub-nav-links a.active { background: var(--orange-pale); color: var(--orange-dark) !important; }
.pub-nav-links a.pub-nav-cta {
  background: var(--orange); color: #fff !important; margin-left: 8px;
}
.pub-nav-links a.pub-nav-cta:hover { background: var(--orange-dark); }

.pub-main { min-height: 60vh; }

.pub-hero {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  color: #fff; text-align: center;
  padding: 90px 24px;
}
.pub-hero h1 { font-size: 38px; margin: 0 0 14px; }
.pub-hero p { font-size: 16px; max-width: 620px; margin: 0 auto 28px; opacity: .95; line-height: 1.7; }
.pub-hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.pub-btn {
  display: inline-block; padding: 12px 26px; border-radius: 10px;
  font-weight: 700; font-size: 14px; text-decoration: none !important;
}
.pub-btn-solid { background: #fff; color: var(--orange-dark) !important; }
.pub-btn-solid:hover { background: var(--orange-pale); }
.pub-btn-outline { border: 2px solid #fff; color: #fff !important; }
.pub-btn-outline:hover { background: rgba(255,255,255,0.15); }

.pub-section { padding: 70px 24px; max-width: 1180px; margin: 0 auto; }
.pub-section-alt { background: var(--orange-pale); }
.pub-section-alt > .pub-section { padding-top: 70px; padding-bottom: 70px; }
.pub-section-head { text-align: center; max-width: 640px; margin: 0 auto 44px; }
.pub-section-head .eyebrow {
  color: var(--orange-dark); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: 1.5px;
}
.pub-section-head h2 { font-size: 28px; margin: 8px 0 10px; }
.pub-section-head p { color: var(--muted); line-height: 1.7; margin: 0; }

.pub-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 800px) { .pub-cards { grid-template-columns: 1fr; } }
.pub-card {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px; text-align: center; box-shadow: var(--shadow);
}
.pub-card .ic {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--orange-pale); color: var(--orange-dark);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.pub-card h3 { margin: 0 0 8px; font-size: 17px; }
.pub-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }

.pub-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; text-align: center; }
@media (max-width: 700px) { .pub-stats { grid-template-columns: repeat(2, 1fr); } }
.pub-stat-num { font-size: 30px; font-weight: 800; color: var(--orange-dark); }
.pub-stat-lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

.pub-about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 800px) { .pub-about-grid { grid-template-columns: 1fr; } }
.pub-about-art {
  aspect-ratio: 4/3; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--orange-light), var(--orange));
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: #fff;
}
.pub-about-grid h2 { font-size: 26px; margin: 0 0 14px; }
.pub-about-grid p { color: var(--muted); line-height: 1.8; margin: 0 0 14px; }
.pub-about-list { list-style: none; padding: 0; margin: 18px 0 0; }
.pub-about-list li { padding: 8px 0 8px 28px; position: relative; color: var(--ink); }
.pub-about-list li::before { content: "✓"; position: absolute; left: 0; color: var(--orange-dark); font-weight: 700; }

.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: 1fr; } }
.gallery-tile {
  aspect-ratio: 1/1; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: #fff; font-size: 34px; text-align: center; padding: 12px;
}
.gallery-tile span.cap { font-size: 12px; font-weight: 600; opacity: .95; }

.pub-contact-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; }
@media (max-width: 800px) { .pub-contact-grid { grid-template-columns: 1fr; } }
.pub-contact-info .item { display: flex; gap: 14px; margin-bottom: 22px; }
.pub-contact-info .ic {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  background: var(--orange-pale); color: var(--orange-dark);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.pub-contact-info h4 { margin: 0 0 4px; font-size: 15px; }
.pub-contact-info p { margin: 0; color: var(--muted); font-size: 14px; }
.pub-map-placeholder {
  margin-top: 10px; border-radius: var(--radius); border: 2px dashed var(--border);
  padding: 30px; text-align: center; color: var(--muted); font-size: 13px;
}

.pub-footer { background: var(--ink); color: #cfc6bb; padding: 50px 24px 0; }
.pub-footer-inner {
  max-width: 1180px; margin: 0 auto; display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 34px;
}
@media (max-width: 800px) { .pub-footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .pub-footer-inner { grid-template-columns: 1fr; } }
.pub-footer-col h4 { color: #fff; font-size: 14px; margin: 0 0 14px; }
.pub-footer-col p { margin: 0 0 8px; font-size: 13px; line-height: 1.6; }
.pub-footer-col a { display: block; color: #cfc6bb; text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.pub-footer-col a:hover { color: var(--orange-light); }
.pub-brand-footer { color: #fff; margin-bottom: 12px; }
.pub-footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1); text-align: center;
  padding: 18px 0; font-size: 12px; color: #9c9186;
}

@media (max-width: 760px) {
  .pub-nav-toggle { display: block; }
  .pub-nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; flex-direction: column; align-items: stretch;
    border-bottom: 3px solid var(--orange); padding: 10px; gap: 2px;
    display: none;
  }
  .pub-nav-links.open { display: flex; }
  .pub-nav-links a.pub-nav-cta { margin-left: 0; text-align: center; }
  .pub-hero { padding: 60px 20px; }
  .pub-hero h1 { font-size: 28px; }
  .pub-section { padding: 50px 20px; }
}
