/**
 * shadcn/ui v2 design tokens + component classes in plain CSS (no React).
 * All colours are HSL triplets consumed as hsl(var(--token)); .dark flips them.
 */

:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --primary: 160 84% 24%;              /* masjid green */
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --success: 142 71% 35%;
  --warning: 38 92% 50%;
  --info: 217 91% 55%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 160 84% 24%;
  --radius: 0.5rem;
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 6.5%;
  --card-foreground: 210 40% 98%;
  --primary: 160 70% 42%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 50%;
  --destructive-foreground: 210 40% 98%;
  --success: 142 60% 45%;
  --warning: 38 92% 55%;
  --info: 217 91% 65%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 160 70% 42%;
}

* { border-color: hsl(var(--border)); }
body { background: hsl(var(--background)); color: hsl(var(--foreground)); }
a { color: inherit; }

/* ---- Cards ------------------------------------------------------------- */
.card { background: hsl(var(--card)); color: hsl(var(--card-foreground)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.card-header { padding: 1.25rem 1.5rem .5rem; }
.card-title { font-size: 1.05rem; font-weight: 600; line-height: 1.2; }
.card-description { font-size: .85rem; color: hsl(var(--muted-foreground)); margin-top: .25rem; }
.card-content { padding: 1rem 1.5rem 1.25rem; }
.card-footer { padding: .75rem 1.5rem 1.25rem; display: flex; gap: .5rem; align-items: center; }

/* ---- Buttons ----------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap; font-size: .875rem; font-weight: 500; height: 2.5rem; padding: 0 1rem; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; cursor: pointer; transition: background .15s, opacity .15s; text-decoration: none; }
.btn:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-sm { height: 2rem; padding: 0 .65rem; font-size: .8rem; }
.btn-lg { height: 2.9rem; padding: 0 1.75rem; font-size: 1rem; }
.btn-default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-default:hover { opacity: .9; }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { background: hsl(var(--secondary) / .8); }
.btn-outline { background: transparent; border-color: hsl(var(--input)); color: hsl(var(--foreground)); }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-success { background: hsl(var(--success)); color: #fff; }
.btn-warning { background: hsl(var(--warning)); color: #1c1917; }
.btn-info { background: hsl(var(--info)); color: #fff; }
.btn-destructive:hover, .btn-success:hover, .btn-warning:hover, .btn-info:hover { opacity: .9; }

/* ---- Forms ------------------------------------------------------------- */
.label { display: block; font-size: .8rem; font-weight: 500; margin-bottom: .35rem; }
.input, .textarea, select.input { width: 100%; background: hsl(var(--background)); color: hsl(var(--foreground)); border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px); padding: 0 .75rem; height: 2.5rem; font-size: .9rem; }
.textarea { height: auto; min-height: 5rem; padding: .6rem .75rem; }
.input:focus, .textarea:focus { outline: 2px solid hsl(var(--ring)); outline-offset: 1px; }
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground)); }
.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form-grid .col-full { grid-column: 1 / -1; }
.hint { font-size: .75rem; color: hsl(var(--muted-foreground)); margin-top: .25rem; }

/* ---- Badges ------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; border-radius: 9999px; padding: .1rem .6rem; font-size: .72rem; font-weight: 600; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); white-space: nowrap; }
.badge-success { background: hsl(var(--success) / .15); color: hsl(var(--success)); }
.badge-destructive { background: hsl(var(--destructive) / .15); color: hsl(var(--destructive)); }
.badge-warning { background: hsl(var(--warning) / .2); color: hsl(38 92% 32%); }
.dark .badge-warning { color: hsl(var(--warning)); }
.badge-info { background: hsl(var(--info) / .15); color: hsl(var(--info)); }
.badge-outline { background: transparent; border: 1px solid hsl(var(--border)); color: hsl(var(--foreground)); }

/* ---- Tables ------------------------------------------------------------ */
.table-wrapper { width: 100%; overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th { text-align: left; font-weight: 500; color: hsl(var(--muted-foreground)); padding: .65rem .85rem; background: hsl(var(--muted) / .5); border-bottom: 1px solid hsl(var(--border)); white-space: nowrap; }
.table td { padding: .6rem .85rem; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: hsl(var(--muted) / .4); }

/* ---- Tabs -------------------------------------------------------------- */
.tabs-list { display: flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; background: hsl(var(--muted)); border-radius: var(--radius); }
.tabs-trigger { padding: .45rem .9rem; font-size: .85rem; font-weight: 500; border-radius: calc(var(--radius) - 2px); color: hsl(var(--muted-foreground)); background: transparent; border: 0; cursor: pointer; }
.tabs-trigger[data-state="active"] { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.tabs-content[data-state="inactive"] { display: none; }
.tabs-content[data-state="active"] { display: block; }

/* ---- Dialog ------------------------------------------------------------ */
.dialog-overlay { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .55); display: none; align-items: flex-start; justify-content: center; padding: 3vh 1rem; overflow-y: auto; }
.dialog-overlay.open { display: flex; }
.dialog-content { background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 640px; box-shadow: 0 20px 40px rgb(0 0 0 / .25); }
.dialog-title { font-size: 1.15rem; font-weight: 600; }
.dialog-description { font-size: .85rem; color: hsl(var(--muted-foreground)); margin: .25rem 0 1rem; }
.dialog-footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

/* ---- Info grid --------------------------------------------------------- */
.info-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.info-item { padding: .6rem .75rem; border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px); }
.info-item dt, .info-item .k { font-size: .72rem; color: hsl(var(--muted-foreground)); }
.info-item dd, .info-item .v { font-size: .92rem; font-weight: 500; margin: 0; word-break: break-word; }

/* ---- Stats / misc ------------------------------------------------------ */
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .num { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: .78rem; color: hsl(var(--muted-foreground)); }
.alert { padding: .7rem .9rem; border-radius: calc(var(--radius) - 2px); font-size: .875rem; margin-bottom: .9rem; border: 1px solid hsl(var(--border)); }
.alert-success { background: hsl(var(--success) / .12); border-color: hsl(var(--success) / .4); color: hsl(var(--success)); }
.alert-error { background: hsl(var(--destructive) / .12); border-color: hsl(var(--destructive) / .4); color: hsl(var(--destructive)); }
.alert-info { background: hsl(var(--info) / .12); border-color: hsl(var(--info) / .4); color: hsl(var(--info)); }
.progress { height: .5rem; background: hsl(var(--muted)); border-radius: 9999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: hsl(var(--primary)); }

.footer { text-align: center; font-size: .78rem; color: hsl(var(--muted-foreground)); padding: 1.25rem 1rem; border-top: 1px solid hsl(var(--border)); margin-top: 2rem; }

#toast-root { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .7rem 1rem; border-radius: var(--radius); font-size: .875rem; color: #fff; background: hsl(var(--success)); box-shadow: 0 8px 20px rgb(0 0 0 / .25); max-width: 22rem; }
.toast.error { background: hsl(var(--destructive)); }


/* ---- UX polish --------------------------------------------------------- */
body { font-feature-settings: "cv11", "ss01"; text-rendering: optimizeLegibility; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn, .tabs-trigger { min-height: 2.25rem; }
.btn-sm { min-height: 2rem; }
.tabs-list { position: sticky; top: 0; z-index: 20; overflow-x: auto; flex-wrap: nowrap; background: hsl(var(--muted)); }
.tabs-trigger { white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; }
.tabs-trigger:focus-visible, .input:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.table tbody tr:nth-child(even) { background: hsl(var(--muted) / .25); }
.table td .btn-ghost { color: hsl(var(--muted-foreground)); }
.table td .btn-ghost:hover { color: hsl(var(--foreground)); }
.empty { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 2rem 1rem; color: hsl(var(--muted-foreground)); text-align: center; }
.empty p { margin: 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.checklist li { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px); }
.checklist .grow { flex: 1; font-size: .9rem; }
.checklist .tick { width: 1.4rem; height: 1.4rem; border-radius: 9999px; border: 1.5px solid hsl(var(--border)); display: inline-flex; align-items: center; justify-content: center; font-size: .65rem; color: transparent; }
.checklist li.done { color: hsl(var(--muted-foreground)); }
.checklist li.done .tick { background: hsl(var(--success)); border-color: hsl(var(--success)); color: #fff; }
.checklist li.done .grow { text-decoration: line-through; }
@media (max-width: 640px) {
  .card-header, .card-content { padding-left: 1rem; padding-right: 1rem; }
  .dialog-content { padding: 1.1rem; }
  .dialog-footer { flex-direction: column-reverse; }
  .dialog-footer .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
