/* ==========================================================================
   SIKHO ANGREJI - ADMIN SUBDOMAIN CMS STYLESHEET
   Neo-Brutalist Bilingual UI + Modern Accessibility & Responsive Tables
   ========================================================================== */

:root {
  --saffron: #FFE9A8;
  --pink: #FFB3C7;
  --indigo: #3B3566;
  --leaf: #B5EAD7;
  --paper: #FFF9F0;
  --ink: #3B3566;
  --card-bg: #FFF8E7;
  --surface: #FFFFFF;
  --lavender: #D9CCF7;
  --sky: #C9E4FF;
  --coral: #FF6B8B;
  --border-color: #3B3566;
  --shadow-color: #3B3566;
  --input-bg: #FFFFFF;
  --input-text: #3B3566;
  --muted: #5C5582;
  --danger: #D93025;
  --success: #188038;
  --overlay-bg: rgba(30, 24, 60, 0.72);
  box-sizing: border-box;
}

[data-theme="dark"] {
  --paper: #16112C;
  --ink: #FFF8E7;
  --card-bg: #231C42;
  --surface: #1D1738;
  --saffron: #E5C365;
  --pink: #E57D97;
  --indigo: #120D26;
  --leaf: #529E8A;
  --lavender: #8371B8;
  --sky: #4F84B8;
  --coral: #FF5A7D;
  --border-color: #FFE9A8;
  --shadow-color: #000000;
  --input-bg: #15102B;
  --input-text: #FFF8E7;
  --muted: #D5CEEE;
  --danger: #FF7B72;
  --success: #56D364;
  --overlay-bg: rgba(8, 6, 18, 0.86);
}

*, *::before, *::after {
  box-sizing: inherit;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Noto Sans Gujarati", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  padding: 12px 18px;
  border-radius: 12px;
  border: 3px solid var(--border-color);
  background: var(--saffron);
  color: #3B3566;
  font-weight: 800;
  box-shadow: 4px 4px 0 var(--shadow-color);
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.3;
}

.muted {
  color: var(--muted);
  font-weight: 600;
}

.center-text {
  text-align: center;
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2.5px solid var(--border-color);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 0.94rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow-color);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--shadow-color);
}

.btn:active:not(:disabled) {
  transform: translate(1.5px, 1.5px);
  box-shadow: 1.5px 1.5px 0 var(--shadow-color);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #3B3566;
  color: #FFF8E7;
}

[data-theme="dark"] .btn-primary {
  background: var(--saffron);
  color: #231C42;
}

.btn-saffron {
  background: var(--saffron);
  color: #3B3566;
}

.btn-mint {
  background: var(--leaf);
  color: #16302B;
}

.btn-danger {
  background: var(--coral);
  color: #FFFFFF;
}

.btn-ghost {
  background: var(--card-bg);
  color: var(--ink);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--card-bg);
  color: var(--ink);
}

.badge-pill.is-saffron { background: var(--saffron); color: #3B3566; }
.badge-pill.is-mint { background: var(--leaf); color: #16302B; }
.badge-pill.is-pink { background: var(--pink); color: #3B3566; }
.badge-pill.is-sky { background: var(--sky); color: #1C3C63; }

/* ==========================================================================
   FORMS & VALIDATION (Modern Web Guidance compliant)
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  margin-block-end: 1.25rem;
}

.field label {
  font-weight: 800;
  font-size: 0.92rem;
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: max(1rem, 1em);
  padding: 0.7rem 0.85rem;
  min-height: 48px;
  border-radius: 12px;
  border: 2.5px solid var(--border-color);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 600;
  width: 100%;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.password-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.password-wrap input {
  flex: 1;
}

.toggle-pass-btn {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2.5px solid var(--border-color);
  background: var(--card-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger);
}

:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) + .error-msg,
.password-wrap:has(:is(input):is(:user-invalid, .user-invalid-fallback)) + .error-msg {
  display: block;
}

:is(input, select, textarea):user-valid {
  border-color: var(--success);
}

.alert-box {
  padding: 12px 16px;
  border-radius: 12px;
  border: 2.5px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 16px;
}

/* ==========================================================================
   AUTH / SETUP SHELL
   ========================================================================== */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(circle at top left, var(--saffron) 0%, transparent 45%),
              radial-gradient(circle at bottom right, var(--lavender) 0%, transparent 45%),
              var(--paper);
}

.auth-card {
  width: min(100%, 520px);
  background: var(--surface);
  border: 3px solid var(--border-color);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 8px 8px 0 var(--shadow-color);
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 2.5px solid var(--border-color);
  object-fit: contain;
  background: var(--card-bg);
  padding: 4px;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-top: 6px;
}

.auth-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.mode-switch-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 14px 12px;
  margin: 0 0 18px;
  background: var(--card-bg);
}

.mode-switch-fieldset legend {
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0 6px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.radio-pill input {
  accent-color: #3B3566;
  width: 18px;
  height: 18px;
}

.auth-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed var(--border-color);
}

.host-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

/* ==========================================================================
   WORKSPACE LAYOUT
   ========================================================================== */
.workspace-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--saffron);
  color: #3B3566;
  border-bottom: 3px solid var(--border-color);
}

[data-theme="dark"] .topbar {
  background: #231C42;
  color: var(--ink);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: #FFFFFF;
  object-fit: contain;
  padding: 2px;
}

.brand-title {
  font-weight: 900;
  font-size: 1.05rem;
}

.brand-sub {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.85;
}

.admin-user-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--border-color);
  background: var(--leaf);
  color: #16302B;
  font-weight: 800;
  font-size: 0.85rem;
}

.mobile-nav-btn {
  display: none;
}

.workspace-body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  flex: 1;
}

.sidebar {
  background: var(--card-bg);
  border-inline-end: 3px solid var(--border-color);
  padding: 18px 14px;
  position: sticky;
  top: 67px;
  height: calc(100dvh - 67px);
  overflow-y: auto;
}

.nav-group-label {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 14px 10px 6px;
}

.nav-group-label:first-child {
  margin-top: 0;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: var(--surface);
  border-color: var(--border-color);
}

.nav-item[aria-current="page"] {
  background: var(--saffron);
  color: #3B3566;
  border-color: var(--border-color);
  box-shadow: 3px 3px 0 var(--shadow-color);
  font-weight: 900;
}

.nav-badge {
  margin-inline-start: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--coral);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 900;
}

.main-canvas {
  padding: 24px 28px 60px;
  min-width: 0;
}

.section-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 3px solid var(--border-color);
}

.section-header-bar h1 {
  font-size: clamp(1.4rem, 2.5vw, 1.95rem);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   CARDS, GRIDS & EDITOR PANELS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 3px solid var(--border-color);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 4px 4px 0 var(--shadow-color);
}

.kpi-card.is-saffron { background: var(--saffron); color: #3B3566; }
.kpi-card.is-mint { background: var(--leaf); color: #16302B; }
.kpi-card.is-pink { background: var(--pink); color: #3B3566; }
.kpi-card.is-sky { background: var(--sky); color: #1C3C63; }

.kpi-label {
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 0.9;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 900;
  margin: 4px 0;
}

.panel-card {
  background: var(--surface);
  border: 3px solid var(--border-color);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 5px 5px 0 var(--shadow-color);
  margin-bottom: 22px;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--border-color);
}

.panel-card-header h2 {
  font-size: 1.2rem;
}

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

.repeater-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.repeater-item {
  background: var(--card-bg);
  border: 2.5px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
}

.repeater-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.search-form input,
.search-form select {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2.5px solid var(--border-color);
  background: var(--input-bg);
  color: var(--input-text);
  font: inherit;
  font-weight: 600;
}

/* ==========================================================================
   RESPONSIVE DATA TABLES (Modern Web Guidance pattern)
   ========================================================================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 75vh);
  container-type: inline-size;
  border: 2.5px solid var(--border-color);
  border-radius: 14px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.9rem;
}

.data-table caption {
  padding: 12px 14px;
  font-weight: 800;
  text-align: left;
  background: var(--card-bg);
  border-bottom: 2px solid var(--border-color);
}

.data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--saffron);
  color: #3B3566;
}

.data-table th,
.data-table td {
  padding: 11px 14px;
  border-bottom: 1.5px solid color-mix(in srgb, var(--border-color) 30%, transparent);
  vertical-align: top;
}

.data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--surface);
  font-weight: 800;
}

@container (width < 600px) {
  .data-table,
  .data-table caption,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-block-end: 1rem;
    border-bottom: 3px solid var(--border-color);
    padding-bottom: 8px;
  }

  .data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--card-bg);
  }

  .data-table td::before {
    content: attr(data-label) ": ";
    font-weight: 800;
    color: var(--muted);
  }
}

/* ==========================================================================
   NATIVE <dialog> MODALS (Modern Web Guidance compliant)
   ========================================================================== */
dialog {
  margin: auto;
  width: min(94vw, 460px);
  max-height: min(90dvh, 800px);
  padding: 0;
  border: 3px solid var(--border-color);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--shadow-color);
  overflow: hidden;
}

dialog.dialog-wide {
  width: min(95vw, 720px);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--saffron);
  color: #3B3566;
  border-bottom: 3px solid var(--border-color);
}

.dialog-header h1 {
  font-size: 1.15rem;
}

.dialog-body {
  padding: 20px;
  overflow-y: auto;
}

.dialog-footer,
.dialog-footer-inline {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: var(--card-bg);
  border-top: 2px solid var(--border-color);
}

.dialog-footer-inline {
  margin: 18px -20px -20px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS & STICKY SAVE BAR
   ========================================================================== */
.sticky-save-bar {
  position: sticky;
  bottom: 14px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-top: 16px;
  border-radius: 16px;
  border: 3px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: 5px 5px 0 var(--shadow-color);
}

.badge-pill.is-coral {
  background: var(--coral);
  color: #FFFFFF;
}

.toast-region {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(92vw, 390px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2.5px solid var(--border-color);
  background: var(--leaf);
  color: #16302B;
  font-weight: 800;
  box-shadow: 4px 4px 0 var(--shadow-color);
  margin: 0;
  inset: auto;
  position: relative;
}

.toast-item[popover]:is(:popover-open, .\:popover-open) {
  display: flex;
  position: fixed;
  top: 76px;
  right: 20px;
  bottom: auto;
  max-width: min(92vw, 390px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  transition-behavior: allow-discrete;
}

.toast-item.is-error {
  background: var(--coral);
  color: #FFFFFF;
}

.toast-close-btn {
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  border: 2px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .toast-item, .btn, .sidebar {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 900px) {
  .mobile-nav-btn {
    display: inline-flex;
  }

  .workspace-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 290px);
    height: 100dvh;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: var(--overlay-bg);
  }

  .main-canvas {
    padding: 18px 16px 48px;
  }
}
