/* HEYAT RUCHI — Multi-Theme Executive RTL Dashboard Styles
   Themes: DARK_MUHARRAM (Default), LIGHT_IVORY (Light Theme), DARK_EMERALD */

@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/vazirmatn.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Amiri";
  src: url("/assets/fonts/amiri.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root,
html[data-theme="DARK_MUHARRAM"] {
  --bg: #0b0a0c;
  --surface: #141216;
  --card: #1c181f;
  --card-alt: #241f29;
  --sidebar: #100e12;
  --text: #f5f2ee;
  --text-sec: #b6afa8;
  --text-muted: #847b75;
  --border: #2c2530;
  --border-accent: #524220;
  --gold: #d4af37;
  --gold-light: #f0d57a;
  --gold-bg: #262013;
  --crimson: #a61b2b;
  --crimson-bg: #330a12;
  --emerald: #2ea36f;
  --emerald-bg: #102a1e;
  --rose: #e05263;
  --rose-bg: #2e1217;
  --amber: #e59f38;
  --amber-bg: #2d210e;
  --btn-primary-text: #0b0a0c;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme="LIGHT_IVORY"] {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --card: #ffffff;
  --card-alt: #f2ece0;
  --sidebar: #faf7f0;
  --text: #1c1917;
  --text-sec: #57534e;
  --text-muted: #78716c;
  --border: #e4ddd0;
  --border-accent: #c9a236;
  --gold: #9a7414;
  --gold-light: #7c5b0b;
  --gold-bg: #fbf4dc;
  --crimson: #9b1b2b;
  --crimson-bg: #fbecee;
  --emerald: #1b7f52;
  --emerald-bg: #e7f6ee;
  --rose: #be2538;
  --rose-bg: #fdecee;
  --amber: #b4690e;
  --amber-bg: #fef4e4;
  --btn-primary-text: #ffffff;
  --shadow: 0 8px 24px rgba(38, 30, 18, 0.08);
}

html[data-theme="DARK_EMERALD"] {
  --bg: #07110e;
  --surface: #0d1b16;
  --card: #13251f;
  --card-alt: #193129;
  --sidebar: #0a1612;
  --text: #f0f7f4;
  --text-sec: #a6bfb5;
  --text-muted: #6f8d81;
  --border: #1e3b31;
  --border-accent: #4c6d42;
  --gold: #d9b648;
  --gold-light: #f2da84;
  --gold-bg: #242917;
  --crimson: #b83344;
  --crimson-bg: #32121a;
  --emerald: #34c385;
  --emerald-bg: #0d3023;
  --rose: #eb6676;
  --rose-bg: #30151b;
  --amber: #ebb047;
  --amber-bg: #2e2410;
  --btn-primary-text: #07110e;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Auth Shell */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top center, var(--crimson-bg), var(--bg) 62%);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-header { text-align: center; margin-bottom: 18px; }
.emblem {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--gold-bg);
  border: 1px solid var(--border-accent);
  color: var(--gold-light);
  font-family: "Amiri", "Vazirmatn", serif;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.auth-header h1 { margin: 0 0 6px; font-size: 1.25rem; }
.subtitle { margin: 0; color: var(--text-sec); font-size: 0.85rem; }
.auth-footer { margin-top: 18px; text-align: center; }

/* Layout Shell */
.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border-accent);
  margin-bottom: 16px;
}
.brand-badge {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--gold);
  font-weight: 800;
}
.sidebar-brand h2 { margin: 4px 0; font-size: 0.98rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  width: 100%;
  text-align: right;
  background: transparent;
  color: var(--text-sec);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active {
  background: var(--gold-bg);
  color: var(--gold-light);
  border-color: var(--border-accent);
  font-weight: 700;
}

.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--border); }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 1.15rem; }
.topbar-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.module-root {
  padding: 20px 22px 48px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Cards & Grids */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-gold { border-color: var(--border-accent); }
.card h3 { margin: 0 0 12px; font-size: 1rem; color: var(--gold-light); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.kpi-label { font-size: 0.82rem; color: var(--text-sec); }
.kpi-value { font-size: 1.25rem; font-weight: 800; margin-top: 4px; color: var(--gold-light); }
.kpi-value.emerald { color: var(--emerald); }
.kpi-value.rose { color: var(--rose); }
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

/* Forms & Inputs */
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.84rem; color: var(--text-sec); }
input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { min-height: 76px; resize: vertical; }

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--gold); color: var(--btn-primary-text); }
.btn-emerald { background: var(--emerald); color: #ffffff; }
.btn-outline { background: transparent; border-color: var(--border-accent); color: var(--gold-light); }
.btn-danger-outline { background: transparent; border-color: var(--rose); color: var(--rose); }
.btn-sm { padding: 6px 10px; font-size: 0.78rem; }

.theme-bar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.theme-bar.compact { margin-bottom: 14px; }
.chip-btn {
  font-family: inherit;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--card-alt);
  color: var(--text-sec);
  border: 1px solid var(--border);
  cursor: pointer;
}
.chip-btn.active {
  background: var(--gold-bg);
  color: var(--gold-light);
  border-color: var(--gold);
  font-weight: 700;
}

/* Badges & Alerts */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--gold-bg);
  color: var(--gold-light);
  border: 1px solid var(--border-accent);
}
.badge-subtle { background: var(--card-alt); color: var(--text-sec); border-color: var(--border); }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); border-color: var(--emerald); }
.badge-rose { background: var(--rose-bg); color: var(--rose); border-color: var(--rose); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }

.alert-error {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--rose-bg);
  border: 1px solid var(--rose);
  color: var(--rose);
  font-size: 0.86rem;
  margin-bottom: 12px;
}
.alert-warn {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--amber-bg);
  border: 1px solid var(--amber);
  color: var(--amber);
  font-size: 0.86rem;
}

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th { color: var(--gold-light); background: var(--card-alt); font-weight: 700; }
tr:hover td { background: var(--card-alt); }

/* Simple Visual Bars */
.bar-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.bar-head { display: flex; justify-content: space-between; font-size: 0.83rem; }
.bar-track { height: 9px; border-radius: 6px; background: var(--card-alt); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--gold); }
.bar-fill.emerald { background: var(--emerald); }
.bar-fill.rose { background: var(--rose); }

.muted { color: var(--text-muted); font-size: 0.82rem; }
.hint-text { margin: 0; font-size: 0.84rem; color: var(--text-sec); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99;
  background: var(--card-alt);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  max-width: 420px;
}

.mobile-only { display: none; }
.icon-btn {
  background: var(--card-alt);
  color: var(--gold-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    right: -290px;
    top: 0;
    width: 270px;
    z-index: 50;
    transition: right 0.2s ease;
  }
  .sidebar.open { right: 0; box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.55); }
  .mobile-only { display: inline-flex; }
}

/* Smart SMS & Public Invoice Enhancements */
.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}
.var-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}
.preview-box {
  background: var(--surface);
  border: 1px dashed var(--border-accent);
  border-radius: 12px;
  padding: 12px 14px;
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text);
}
.msg-cell {
  white-space: pre-wrap;
  min-width: 220px;
  max-width: 340px;
  font-size: 0.8rem;
}
.template-card {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.template-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.invoice-public-wrap {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px;
}
.invoice-sheet {
  width: 100%;
  max-width: 780px;
  padding: 28px;
}
.invoice-sheet-header {
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 18px;
}
.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  background: var(--card-alt);
  padding: 14px;
  border-radius: 12px;
}
.invoice-totals {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: var(--card-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.invoice-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}
@media print {
  .no-print { display: none !important; }
  body { background: #ffffff; color: #000000; }
  .invoice-sheet { box-shadow: none; border: 1px solid #ccc; }
}

/* Muharram First Decade Schedule — Deep Emerald, Soft Green, White & Warm Gold */
.mh-hero-card {
  background: linear-gradient(135deg, #0b4433, #155c45);
  color: #ffffff;
  border: 1.5px solid #c8a24b;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.mh-hero-card label { color: #dceee3; }
.mh-hero-card input, .mh-hero-card select {
  background: rgba(255, 255, 255, 0.96);
  color: #122920;
  border: 1px solid #96bfa9;
}
.mh-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.mh-bismillah {
  font-family: "Amiri", "Vazirmatn", serif;
  color: #f4da82;
  font-size: 0.96rem;
  font-weight: 700;
}
.mh-hero-title { margin: 2px 0 4px; font-size: 1.15rem; color: #ffffff; }
.mh-hero-sub { margin: 0; font-size: 0.82rem; color: #d6ebe0; }
.mh-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(200, 162, 75, 0.38);
}
.mh-compact-select { padding: 6px 10px; font-size: 0.82rem; border-radius: 8px; }

.mh-matrix-card {
  background: #ffffff;
  color: #162821;
  border: 1.5px solid #0e4c39;
}
.mh-matrix-card .muted { color: #3a5c4d; }
.mh-matrix-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 0.8rem;
  border: 1.5px solid #0c4735;
}
.mh-matrix-table th, .mh-matrix-table td {
  border: 1px solid #416b59;
  padding: 6px 5px;
  text-align: center;
  vertical-align: top;
  white-space: normal;
  color: #162821;
}
.mh-super-row th {
  background: #0e4c39 !important;
  color: #ffffff !important;
  font-size: 0.96rem;
  font-weight: 800;
  padding: 9px 6px;
  border-bottom: 2px solid #c8a24b;
}
.mh-loc-row th {
  background: #cbe5d6 !important;
  color: #0b4433 !important;
  font-weight: 700;
}
.mh-title-row th {
  background: #dceee3 !important;
  color: #133a2c !important;
  font-weight: 700;
}
.mh-time-row th {
  background: #e4eff5 !important;
  color: #1b3a4b !important;
  font-size: 0.76rem;
  font-weight: 700;
}
.mh-clickable-th { cursor: pointer; transition: filter 0.15s ease; }
.mh-clickable-th:hover { filter: brightness(0.94); }

.mh-chk-cell { background: #f8fbf9; width: 38px; vertical-align: middle !important; }
.mh-day-cell {
  background: #faf5e8 !important;
  min-width: 122px;
  vertical-align: middle !important;
}
.mh-day-title { font-weight: 800; color: #0c4735; margin-bottom: 5px; }
.mh-day-mini-actions { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.mh-mini-btn {
  font-family: inherit;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #0e4c39;
  background: #ffffff;
  color: #0e4c39;
  cursor: pointer;
}
.mh-mini-btn:hover { background: #e6f3ec; }
.mh-mini-btn.danger { border-color: #b8293b; color: #b8293b; }

.mh-date-cell { min-width: 96px; background: #ffffff; }
.mh-inline-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.75rem;
  margin-bottom: 4px;
  background: #f8fbf9;
  color: #162821;
  border: 1px solid #c5dbd0;
  border-radius: 6px;
  text-align: center;
}
.mh-alt-row td.mh-slot-cell, .mh-alt-row td.mh-date-cell { background: #f5faf7; }
.mh-slot-cell {
  min-width: 94px;
  cursor: pointer;
  background: #ffffff;
  transition: background 0.12s ease;
}
.mh-slot-cell:hover { background: #eaf5ef !important; }
.mh-slot-cell.mh-maddah-col { background: #fdf6df !important; }
.mh-slot-cell.mh-maddah-col:hover { background: #faecc2 !important; }

.mh-prog-chip {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #b8d5c5;
  border-right: 3px solid #0e4c39;
  border-radius: 7px;
  padding: 4px 6px;
  margin-bottom: 5px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #152b22;
  text-align: right;
  cursor: pointer;
}
.mh-prog-chip:hover { border-color: #c8a24b; box-shadow: 0 2px 8px rgba(12, 71, 53, 0.12); }
.mh-cell-add-hint { font-size: 0.7rem; color: #6c8e7d; margin-top: 2px; }

.mh-day-mobile-card { border-right: 4px solid #0e4c39; }
.mh-mobile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.mh-mobile-sec-head {
  background: #0e4c39;
  color: #f4da82;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.mh-footer-card { border-top: 3px solid #c8a24b; }
.mh-footer-notes-input { width: 100%; min-height: 110px; line-height: 1.85; }

/* Modal */
.mh-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(6, 20, 15, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.mh-modal-card {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border: 1.5px solid #c8a24b;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.mh-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mh-modal-head h3 { margin: 0; color: var(--gold-light); }


