/* ==========================================================================
   Zentra Admin — main stylesheet
   Designed & built by EdinStack
   --------------------------------------------------------------------------
   1. Tokens (light / dark)          6. Cards & widgets
   2. Bootstrap overrides             7. Page modules (email, files, kanban…)
   3. Layout: sidebar                 8. Advanced UI (ribbons, ratings…)
   4. Layout: topbar & content        9. Auth & error pages
   5. Utilities                      10. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
  --z-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --z-primary: #4f6bed;
  --z-primary-rgb: 79, 107, 237;
  --z-primary-dark: #3d56d1;
  --z-accent: #ff7a59;

  --z-body-bg: #f4f6fb;
  --z-surface: #ffffff;
  --z-surface-2: #f8f9fc;
  --z-border: #e8ebf2;
  --z-text: #1e2333;
  --z-muted: #6b7286;
  --z-heading: #111524;

  --z-sidebar-bg: #ffffff;
  --z-sidebar-text: #5a6178;
  --z-sidebar-title: #a0a6b8;
  --z-sidebar-hover: #f2f4fb;
  --z-sidebar-active-bg: rgba(var(--z-primary-rgb), .1);
  --z-sidebar-active: var(--z-primary);

  --z-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 10px rgba(16, 24, 40, .04);
  --z-shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --z-radius: 14px;
  --z-radius-sm: 10px;

  --z-sidebar-w: 264px;
  --z-sidebar-mini: 78px;
  --z-topbar-h: 68px;
}

[data-bs-theme="dark"] {
  --z-primary: #6b84ff;
  --z-primary-rgb: 107, 132, 255;
  --z-primary-dark: #5670f0;

  --z-body-bg: #0d111c;
  --z-surface: #151a28;
  --z-surface-2: #1b2133;
  --z-border: #252c40;
  --z-text: #d6dbe8;
  --z-muted: #8c94ab;
  --z-heading: #f1f3f9;

  --z-sidebar-bg: #121725;
  --z-sidebar-text: #9aa2b9;
  --z-sidebar-title: #5f6780;
  --z-sidebar-hover: #1b2133;
  --z-sidebar-active-bg: rgba(var(--z-primary-rgb), .16);

  --z-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --z-shadow-lg: 0 16px 40px rgba(0, 0, 0, .45);
}

/* 2. Bootstrap overrides --------------------------------------------------- */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-primary: var(--z-primary);
  --bs-primary-rgb: var(--z-primary-rgb);
  --bs-link-color: var(--z-primary);
  --bs-link-color-rgb: var(--z-primary-rgb);
  --bs-link-hover-color: var(--z-primary-dark);
  --bs-body-font-family: var(--z-font);
  --bs-body-bg: var(--z-body-bg);
  --bs-body-color: var(--z-text);
  --bs-secondary-color: var(--z-muted);
  --bs-emphasis-color: var(--z-heading);
  --bs-border-color: var(--z-border);
  --bs-tertiary-bg: var(--z-surface-2);
  --bs-border-radius: .55rem;
  --bs-border-radius-lg: .8rem;
  --bs-focus-ring-color: rgba(var(--z-primary-rgb), .25);
}
[data-bs-theme="light"] { --bs-primary-bg-subtle: #e9edfd; --bs-primary-text-emphasis: #2b3fa6; --bs-primary-border-subtle: #c4cefa; }
[data-bs-theme="dark"]  { --bs-primary-bg-subtle: #1c2550; --bs-primary-text-emphasis: #a9b8ff; --bs-primary-border-subtle: #33408a; }

body { font-size: .9rem; background: var(--z-body-bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--z-heading); font-weight: 700; letter-spacing: -.01em; }
.text-muted { color: var(--z-muted) !important; }

.btn { --bs-btn-font-weight: 600; --bs-btn-font-size: .875rem; --bs-btn-padding-x: 1rem; }
.btn-primary {
  --bs-btn-bg: var(--z-primary); --bs-btn-border-color: var(--z-primary);
  --bs-btn-hover-bg: var(--z-primary-dark); --bs-btn-hover-border-color: var(--z-primary-dark);
  --bs-btn-active-bg: var(--z-primary-dark); --bs-btn-active-border-color: var(--z-primary-dark);
  --bs-btn-disabled-bg: var(--z-primary); --bs-btn-disabled-border-color: var(--z-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--z-primary); --bs-btn-border-color: var(--z-primary);
  --bs-btn-hover-bg: var(--z-primary); --bs-btn-hover-border-color: var(--z-primary);
  --bs-btn-active-bg: var(--z-primary); --bs-btn-active-border-color: var(--z-primary);
}
.btn-soft-primary   { color: var(--z-primary); background: rgba(var(--z-primary-rgb), .12); border: 0; }
.btn-soft-primary:hover { color: #fff; background: var(--z-primary); }
.btn-soft-success   { color: var(--bs-success); background: rgba(var(--bs-success-rgb), .12); border: 0; }
.btn-soft-success:hover { color: #fff; background: var(--bs-success); }
.btn-soft-danger    { color: var(--bs-danger); background: rgba(var(--bs-danger-rgb), .12); border: 0; }
.btn-soft-danger:hover { color: #fff; background: var(--bs-danger); }
.btn-soft-warning   { color: #c98a00; background: rgba(var(--bs-warning-rgb), .16); border: 0; }
.btn-soft-warning:hover { color: #111; background: var(--bs-warning); }
.btn-soft-info      { color: var(--bs-info); background: rgba(var(--bs-info-rgb), .14); border: 0; }
.btn-soft-info:hover { color: #fff; background: var(--bs-info); }
.btn-soft-secondary { color: var(--z-muted); background: var(--z-surface-2); border: 1px solid var(--z-border); }
.btn-soft-secondary:hover { color: var(--z-heading); background: var(--z-border); }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon.btn-sm { width: 31px; height: 31px; }

.card {
  --bs-card-bg: var(--z-surface);
  --bs-card-border-color: var(--z-border);
  --bs-card-border-radius: var(--z-radius);
  --bs-card-inner-border-radius: calc(var(--z-radius) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  box-shadow: var(--z-shadow);
  margin-bottom: 1.5rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: 1rem; padding-bottom: 1rem; }
.card-title { font-size: 1rem; margin: 0; }
.card-subtitle { color: var(--z-muted); font-size: .8rem; margin-top: .2rem; }
.row > [class*="col"] > .card.h-100 { margin-bottom: 0; }

.dropdown-menu { --bs-dropdown-bg: var(--z-surface); --bs-dropdown-border-color: var(--z-border); --bs-dropdown-link-active-bg: var(--z-primary); --bs-dropdown-font-size: .875rem; box-shadow: var(--z-shadow-lg); border-radius: var(--z-radius-sm); padding: .4rem; }
.dropdown-item { border-radius: 7px; padding: .45rem .75rem; }
.modal-content, .offcanvas, .toast { --bs-modal-bg: var(--z-surface); --bs-offcanvas-bg: var(--z-surface); --bs-toast-bg: var(--z-surface); }
.form-control, .form-select { --bs-body-bg: var(--z-surface); border-color: var(--z-border); font-size: .875rem; padding: .55rem .85rem; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--z-primary-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--z-primary-rgb), .15); }
.form-check-input:checked { background-color: var(--z-primary); border-color: var(--z-primary); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--z-heading); }
.input-group-text { background: var(--z-surface-2); border-color: var(--z-border); }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--z-border); --bs-table-hover-bg: var(--z-surface-2); --bs-table-striped-bg: var(--z-surface-2); vertical-align: middle; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--z-muted); font-weight: 700; background: var(--z-surface-2); border-bottom-width: 1px; white-space: nowrap; }
.table > :not(caption) > * > * { padding: .8rem 1rem; }
.page-link { --bs-pagination-active-bg: var(--z-primary); --bs-pagination-active-border-color: var(--z-primary); }
.pagination { --bs-pagination-active-bg: var(--z-primary); --bs-pagination-active-border-color: var(--z-primary); --bs-pagination-bg: var(--z-surface); --bs-pagination-border-color: var(--z-border); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--z-primary); }
.list-group { --bs-list-group-bg: var(--z-surface); --bs-list-group-border-color: var(--z-border); --bs-list-group-active-bg: var(--z-primary); --bs-list-group-active-border-color: var(--z-primary); }
.progress { --bs-progress-bg: var(--z-surface-2); --bs-progress-bar-bg: var(--z-primary); }
.accordion { --bs-accordion-bg: var(--z-surface); --bs-accordion-border-color: var(--z-border); --bs-accordion-active-bg: rgba(var(--z-primary-rgb), .08); --bs-accordion-active-color: var(--z-primary); }
.badge { font-weight: 600; }
.text-bg-primary { background-color: var(--z-primary) !important; }
.bg-primary { background-color: var(--z-primary) !important; }
.text-primary { color: var(--z-primary) !important; }
.border-primary { border-color: var(--z-primary) !important; }

/* 3. Layout: sidebar ------------------------------------------------------- */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  width: var(--z-sidebar-w);
  background: var(--z-sidebar-bg);
  border-right: 1px solid var(--z-border);
  display: flex; flex-direction: column;
  transition: width .25s ease, transform .25s ease;
}
.sidebar-brand {
  height: var(--z-topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: .65rem;
  padding: 0 1.4rem; border-bottom: 1px solid var(--z-border);
  text-decoration: none; overflow: hidden;
}
.brand-mark {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--z-primary), #8b5cf6);
  box-shadow: 0 6px 16px rgba(var(--z-primary-rgb), .35);
}
.brand-name { font-size: 1.25rem; font-weight: 800; color: var(--z-heading); letter-spacing: -.02em; white-space: nowrap; }
.brand-name span { color: var(--z-primary); }

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .75rem .85rem 1.5rem; scrollbar-width: thin; scrollbar-color: var(--z-border) transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--z-border); border-radius: 5px; }

.menu-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--z-sidebar-title); padding: 1.1rem .75rem .45rem; white-space: nowrap;
}
.menu-title:first-child { padding-top: .35rem; }
.side-menu, .side-submenu { list-style: none; margin: 0; padding: 0; }
.side-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .58rem .75rem; margin-bottom: 2px; border-radius: 9px;
  color: var(--z-sidebar-text); font-weight: 600; font-size: .875rem;
  text-decoration: none; white-space: nowrap; position: relative;
  transition: background .15s, color .15s;
}
.side-link > i:first-child { font-size: 1.2rem; width: 22px; text-align: center; flex-shrink: 0; }
.side-link:hover { background: var(--z-sidebar-hover); color: var(--z-heading); }
.side-link .arrow { margin-left: auto; font-size: 1rem; transition: transform .2s; }
.side-link[aria-expanded="true"] .arrow { transform: rotate(90deg); }
.side-link[aria-expanded="true"], .side-link.active-parent { color: var(--z-heading); }
.side-link.active { background: var(--z-sidebar-active-bg); color: var(--z-sidebar-active); }
.side-link .badge { margin-left: auto; font-size: .65rem; }

.side-submenu { padding: .15rem 0 .35rem 2.15rem; }
.side-submenu .side-link { padding: .42rem .75rem; font-weight: 500; font-size: .84rem; }
.side-submenu .side-link::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .45; flex-shrink: 0; transition: transform .15s;
}
.side-submenu .side-link.active { background: transparent; color: var(--z-sidebar-active); }
.side-submenu .side-link.active::before { opacity: 1; transform: scale(1.4); }

.sidebar-footer { padding: .9rem; border-top: 1px solid var(--z-border); }
.sidebar-promo {
  border-radius: 12px; padding: 1rem; color: #fff; white-space: nowrap; overflow: hidden;
  background: linear-gradient(135deg, var(--z-primary), #8b5cf6);
}
.sidebar-promo small { opacity: .85; }

/* Collapsed (mini) sidebar — desktop only */
@media (min-width: 992px) {
  .sidebar-mini .app-sidebar { width: var(--z-sidebar-mini); }
  .sidebar-mini .app-main { margin-left: var(--z-sidebar-mini); }
  .sidebar-mini .app-sidebar:not(:hover) .brand-name,
  .sidebar-mini .app-sidebar:not(:hover) .side-link > span,
  .sidebar-mini .app-sidebar:not(:hover) .side-link .arrow,
  .sidebar-mini .app-sidebar:not(:hover) .side-link .badge,
  .sidebar-mini .app-sidebar:not(:hover) .side-submenu,
  .sidebar-mini .app-sidebar:not(:hover) .sidebar-footer { display: none !important; }
  .sidebar-mini .app-sidebar:not(:hover) .menu-title { font-size: 0; padding: .7rem 0 .35rem; text-align: center; }
  .sidebar-mini .app-sidebar:not(:hover) .menu-title::before { content: "•••"; font-size: .7rem; letter-spacing: .1em; }
  .sidebar-mini .app-sidebar:not(:hover) .side-link { justify-content: center; }
  .sidebar-mini .app-sidebar:not(:hover) .sidebar-brand { padding: 0 1.3rem; }
  .sidebar-mini .app-sidebar:hover { width: var(--z-sidebar-w); box-shadow: var(--z-shadow-lg); }
}

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 25, .5); z-index: 1035; opacity: 0; visibility: hidden; transition: .25s; }

/* 4. Topbar & content ------------------------------------------------------ */
.app-main { flex: 1; min-width: 0; margin-left: var(--z-sidebar-w); display: flex; flex-direction: column; transition: margin .25s ease; }
.app-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--z-topbar-h);
  display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--z-surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--z-border);
}
.topbar-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  color: var(--z-muted); font-size: 1.3rem; transition: .15s;
}
.topbar-btn:hover, .topbar-btn[aria-expanded="true"] { background: var(--z-surface-2); color: var(--z-heading); }
.topbar-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bs-danger); border: 2px solid var(--z-surface); }
.topbar-search { position: relative; width: 300px; }
.topbar-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--z-muted); font-size: 1.1rem; }
.topbar-search .form-control { padding-left: 2.4rem; background: var(--z-surface-2); border-color: transparent; border-radius: 10px; }
.topbar-search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); font-size: .68rem; background: var(--z-surface); color: var(--z-muted); border: 1px solid var(--z-border); }
.topbar-user { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .25rem .25rem; border-radius: 12px; background: none; border: 0; color: inherit; }
.topbar-user:hover { background: var(--z-surface-2); }
.notif-menu { width: 340px; padding: 0; }
.notif-item { display: flex; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--z-border); text-decoration: none; color: inherit; }
.notif-item:hover { background: var(--z-surface-2); }

.app-content { flex: 1; padding: 1.5rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
.page-header .breadcrumb { margin: 0; font-size: .8rem; --bs-breadcrumb-divider-color: var(--z-muted); }
.page-header .breadcrumb a { color: var(--z-muted); text-decoration: none; }
.page-header .breadcrumb a:hover { color: var(--z-primary); }

.app-footer { padding: 1.1rem 1.5rem; border-top: 1px solid var(--z-border); color: var(--z-muted); font-size: .82rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.app-footer strong { color: var(--z-heading); }

/* 5. Utilities ------------------------------------------------------------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; }
.avatar-xs { width: 26px; height: 26px; font-size: .65rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.8rem; }
.avatar-group { display: flex; }
.avatar-group .avatar { border: 2px solid var(--z-surface); margin-left: -10px; }
.avatar-group .avatar:first-child { margin-left: 0; }
.icon-box { width: 46px; height: 46px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; }
.icon-box-sm { width: 36px; height: 36px; border-radius: 10px; font-size: 1.1rem; }
.icon-box-lg { width: 58px; height: 58px; border-radius: 16px; font-size: 1.8rem; }
.soft-primary { background: rgba(var(--z-primary-rgb), .12); color: var(--z-primary); }
.soft-success { background: rgba(var(--bs-success-rgb), .12); color: var(--bs-success); }
.soft-danger  { background: rgba(var(--bs-danger-rgb), .12); color: var(--bs-danger); }
.soft-warning { background: rgba(var(--bs-warning-rgb), .16); color: #d39a00; }
.soft-info    { background: rgba(var(--bs-info-rgb), .14); color: #0aa2c0; }
.soft-purple  { background: rgba(139, 92, 246, .13); color: #8b5cf6; }
.soft-pink    { background: rgba(236, 72, 153, .12); color: #ec4899; }
.soft-dark    { background: var(--z-surface-2); color: var(--z-heading); }
.fs-xs { font-size: .75rem !important; }
.fs-sm { font-size: .82rem !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-extrabold { font-weight: 800 !important; }
.min-w-0 { min-width: 0; }
.text-heading { color: var(--z-heading) !important; }
.bg-surface { background: var(--z-surface) !important; }
.bg-surface-2 { background: var(--z-surface-2) !important; }
.border-dashed { border-style: dashed !important; }
.hover-lift { transition: transform .2s, box-shadow .2s; }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--z-shadow-lg); }
.peso::before { content: "₱"; }
.code-preview { background: var(--z-surface-2); border: 1px solid var(--z-border); border-radius: var(--z-radius-sm); padding: 1rem; font-size: .8rem; white-space: pre-wrap; word-break: break-word; }
.dot-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* 6. Cards & widgets ------------------------------------------------------- */
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--z-heading); letter-spacing: -.02em; line-height: 1.1; }
.stat-card .stat-label { color: var(--z-muted); font-weight: 600; font-size: .8rem; }
.trend { font-size: .78rem; font-weight: 700; display: inline-flex; align-items: center; gap: .15rem; }
.trend.up { color: var(--bs-success); }
.trend.down { color: var(--bs-danger); }
.gradient-card { color: #fff; border: 0; background: linear-gradient(135deg, var(--z-primary) 0%, #8b5cf6 100%); }
.gradient-card h1, .gradient-card h2, .gradient-card h3, .gradient-card h4, .gradient-card h5, .gradient-card h6 { color: #fff; }
.gradient-card .text-white-50 { color: rgba(255,255,255,.75) !important; }
.welcome-card { position: relative; overflow: hidden; }
.welcome-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.1); }
.welcome-card::before { content: ""; position: absolute; right: 60px; bottom: -90px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08); }
.progress-thin { height: 6px; }
.list-item-row { display: flex; align-items: center; gap: .85rem; padding: .7rem 0; border-bottom: 1px dashed var(--z-border); }
.list-item-row:last-child { border-bottom: 0; padding-bottom: 0; }
.chart-sm { min-height: 60px; }

/* 7. Page modules ---------------------------------------------------------- */
/* Timeline */
.timeline { position: relative; padding-left: 2rem; list-style: none; margin: 0; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: var(--z-border); }
.timeline-item { position: relative; padding-bottom: 1.5rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -2rem; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; border: 3px solid var(--z-surface); }
.timeline-center { padding: 0; }
.timeline-center::before { left: 50%; transform: translateX(-50%); }
.timeline-center .timeline-item { width: 50%; padding-right: 2.5rem; text-align: right; }
.timeline-center .timeline-item:nth-child(even) { margin-left: 50%; padding: 0 0 1.5rem 2.5rem; text-align: left; }
.timeline-center .timeline-dot { left: auto; right: -12px; }
.timeline-center .timeline-item:nth-child(even) .timeline-dot { left: -12px; right: auto; }

/* Email */
.email-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 640px; }
.email-sidebar { border-right: 1px solid var(--z-border); padding: 1.25rem; }
.email-folder { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: 9px; color: var(--z-muted); text-decoration: none; font-weight: 600; }
.email-folder:hover, .email-folder.active { background: rgba(var(--z-primary-rgb), .1); color: var(--z-primary); }
.email-row { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--z-border); cursor: pointer; }
.email-row:hover { background: var(--z-surface-2); }
.email-row.unread .email-subject { font-weight: 700; color: var(--z-heading); }
.email-row .star { color: var(--z-muted); }
.email-row .star.active { color: #f5b301; }

/* File manager */
.folder-card { border: 1px solid var(--z-border); border-radius: var(--z-radius-sm); padding: 1rem; transition: .2s; background: var(--z-surface); }
.folder-card:hover { border-color: rgba(var(--z-primary-rgb), .5); box-shadow: var(--z-shadow); }
.file-icon { font-size: 2rem; }

/* Kanban / tasks */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(270px, 1fr)); gap: 1.25rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { background: var(--z-surface-2); border: 1px solid var(--z-border); border-radius: var(--z-radius); padding: 1rem; }
.kanban-list { min-height: 120px; display: flex; flex-direction: column; gap: .75rem; }
.kanban-card { background: var(--z-surface); border: 1px solid var(--z-border); border-radius: 12px; padding: .9rem; cursor: grab; box-shadow: var(--z-shadow); }
.kanban-card:active { cursor: grabbing; }
.sortable-ghost { opacity: .4; }

/* Gallery */
.gallery-item { position: relative; border-radius: var(--z-radius-sm); overflow: hidden; display: block; aspect-ratio: 4/3; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.gallery-item:hover img { transform: scale(1.07); }
.gallery-item .gallery-overlay { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 1rem; color: #fff; background: linear-gradient(transparent 40%, rgba(0,0,0,.7)); opacity: 0; transition: .3s; }
.gallery-item:hover .gallery-overlay { opacity: 1; }

/* Calendar (FullCalendar theming) */
.fc { --fc-border-color: var(--z-border); --fc-page-bg-color: var(--z-surface); --fc-neutral-bg-color: var(--z-surface-2); --fc-today-bg-color: rgba(var(--z-primary-rgb), .07); --fc-button-bg-color: var(--z-primary); --fc-button-border-color: var(--z-primary); --fc-button-hover-bg-color: var(--z-primary-dark); --fc-button-hover-border-color: var(--z-primary-dark); --fc-button-active-bg-color: var(--z-primary-dark); --fc-button-active-border-color: var(--z-primary-dark); --fc-event-border-color: transparent; }
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 700; }
.fc .fc-button { font-size: .82rem; font-weight: 600; text-transform: capitalize; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--z-text); text-decoration: none; }
.fc-event { padding: 2px 4px; font-size: .78rem; font-weight: 600; cursor: pointer; }
.external-event { cursor: grab; padding: .55rem .8rem; border-radius: 9px; margin-bottom: .5rem; font-weight: 600; font-size: .82rem; }

/* Pricing */
.pricing-card.featured { border: 2px solid var(--z-primary); transform: translateY(-8px); }
.pricing-price { font-size: 2.4rem; font-weight: 800; color: var(--z-heading); letter-spacing: -.03em; }

/* Profile */
.profile-cover { height: 200px; border-radius: var(--z-radius) var(--z-radius) 0 0; background: linear-gradient(120deg, var(--z-primary), #8b5cf6 55%, #ec4899); position: relative; }
.profile-avatar { position: relative; z-index: 2; width: 112px; height: 112px; margin-top: -56px; border: 5px solid var(--z-surface); box-shadow: var(--z-shadow); flex-shrink: 0; }
.profile-head { padding-top: .75rem; }

/* Blog */
.blog-thumb { aspect-ratio: 16/9; object-fit: cover; width: 100%; }

/* Product (ecommerce page) */
.product-card .product-img { aspect-ratio: 1; background: var(--z-surface-2); border-radius: var(--z-radius-sm); display: grid; place-items: center; overflow: hidden; }
.product-card .product-img img { width: 100%; height: 100%; object-fit: cover; }

/* Icons gallery */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .75rem; }
.icon-tile { border: 1px solid var(--z-border); border-radius: 10px; padding: 1rem .5rem .75rem; text-align: center; cursor: pointer; background: var(--z-surface); transition: .15s; }
.icon-tile:hover { border-color: var(--z-primary); color: var(--z-primary); transform: translateY(-2px); }
.icon-tile i { font-size: 1.7rem; display: block; margin-bottom: .5rem; }
.icon-tile small { font-size: .68rem; color: var(--z-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* POS */
.pos-product { cursor: pointer; border: 1px solid var(--z-border); border-radius: 12px; padding: .75rem; text-align: center; background: var(--z-surface); transition: .15s; height: 100%; }
.pos-product:hover { border-color: var(--z-primary); box-shadow: var(--z-shadow); }
.pos-product .emoji { font-size: 2.2rem; line-height: 1; display: block; margin: .25rem 0 .5rem; }
.pos-cat { white-space: nowrap; }
.cart-line { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px dashed var(--z-border); }
.qty-btn { width: 26px; height: 26px; padding: 0; border-radius: 7px; display: inline-grid; place-items: center; }

/* 8. Advanced UI ----------------------------------------------------------- */
.ribbon-box { position: relative; overflow: hidden; }
.ribbon { position: absolute; top: 14px; left: -1px; padding: .3rem .9rem; font-size: .75rem; font-weight: 700; color: #fff; border-radius: 0 6px 6px 0; z-index: 1; }
.ribbon-right { left: auto; right: -1px; border-radius: 6px 0 0 6px; }
.ribbon-corner { position: absolute; top: 18px; right: -34px; width: 130px; text-align: center; transform: rotate(45deg); padding: .25rem 0; font-size: .72rem; font-weight: 700; color: #fff; z-index: 1; }
.ribbon-corner.left { right: auto; left: -34px; transform: rotate(-45deg); }
.ribbon-shape { position: absolute; top: -4px; right: 18px; width: 38px; padding: .6rem 0 .9rem; text-align: center; color: #fff; z-index: 1; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.ribbon-bookmark { position: absolute; top: 14px; left: -8px; padding: .3rem .9rem; color: #fff; font-size: .75rem; font-weight: 700; z-index: 1; }
.ribbon-bookmark::after { content: ""; position: absolute; left: 0; bottom: -8px; border-top: 8px solid rgba(0,0,0,.35); border-left: 8px solid transparent; }

.rating { display: inline-flex; gap: .2rem; font-size: 1.5rem; color: var(--z-border); }
.rating i { cursor: pointer; transition: transform .1s, color .1s; }
.rating i.active, .rating i.hover { color: #f5b301; }
.rating i:hover { transform: scale(1.15); }
.rating.readonly i { cursor: default; }
.rating.readonly i:hover { transform: none; }
.rating-heart i.active, .rating-heart i.hover { color: #ef4444; }
.rating-sm { font-size: 1rem; }
.stars-static { color: #f5b301; font-size: .85rem; }

.carousel-item img { height: 340px; object-fit: cover; }

/* Library theming: Choices / flatpickr / DataTables / Grid.js / Apex */
.choices__inner { background: var(--z-surface) !important; border-color: var(--z-border) !important; border-radius: .55rem !important; min-height: 42px; font-size: .875rem; }
.choices__list--dropdown, .choices__list[aria-expanded] { background: var(--z-surface) !important; border-color: var(--z-border) !important; color: var(--z-text); z-index: 20 !important; }
.choices__list--dropdown .choices__item--selectable.is-highlighted { background: var(--z-surface-2) !important; }
.choices__list--multiple .choices__item { background: var(--z-primary) !important; border-color: var(--z-primary) !important; border-radius: 6px !important; }
.choices__input { background: transparent !important; color: var(--z-text); }
[data-bs-theme="dark"] .flatpickr-calendar { background: var(--z-surface); box-shadow: var(--z-shadow-lg); }
[data-bs-theme="dark"] .flatpickr-calendar .flatpickr-day, [data-bs-theme="dark"] .flatpickr-calendar span.flatpickr-weekday, [data-bs-theme="dark"] .flatpickr-months .flatpickr-month, [data-bs-theme="dark"] .flatpickr-current-month input.cur-year, [data-bs-theme="dark"] .flatpickr-months .flatpickr-prev-month, [data-bs-theme="dark"] .flatpickr-months .flatpickr-next-month { color: var(--z-text); fill: var(--z-text); }
[data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months { background: var(--z-surface); color: var(--z-text); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--z-primary); border-color: var(--z-primary); }
div.dt-container .dt-paging .dt-paging-button.current, div.dt-container .dt-paging .dt-paging-button.current:hover { background: var(--z-primary) !important; border-color: var(--z-primary) !important; color: #fff !important; }
div.dt-container .dt-search input, div.dt-container .dt-length select { border-color: var(--z-border); background-color: var(--z-surface); }
.gridjs-wrapper { box-shadow: none; border: 1px solid var(--z-border); border-radius: var(--z-radius-sm) var(--z-radius-sm) 0 0; }
.gridjs-container { color: var(--z-text); }
.gridjs-table, th.gridjs-th, td.gridjs-td { background: var(--z-surface) !important; color: var(--z-text) !important; border-color: var(--z-border) !important; }
th.gridjs-th { background: var(--z-surface-2) !important; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.gridjs-footer { background: var(--z-surface); border-color: var(--z-border); box-shadow: none; border-radius: 0 0 var(--z-radius-sm) var(--z-radius-sm); }
.gridjs-pagination .gridjs-pages button { background: var(--z-surface); border-color: var(--z-border); color: var(--z-text); }
.gridjs-pagination .gridjs-pages button.gridjs-currentPage { background: var(--z-primary); color: #fff; }
.gridjs-search-input, input.gridjs-input { background: var(--z-surface); border-color: var(--z-border); color: var(--z-text); }
.apexcharts-tooltip { box-shadow: var(--z-shadow-lg) !important; }
.apexcharts-canvas text { font-family: var(--z-font) !important; }

/* 9. Auth & error pages ---------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--z-surface); }
.auth-aside {
  position: relative; overflow: hidden; color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.18), transparent 40%), linear-gradient(140deg, var(--z-primary), #6d4bf0 60%, #a23be0);
}
.auth-aside h2 { color: #fff; font-size: 2rem; line-height: 1.2; }
.auth-aside .shape { position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-form { width: 100%; max-width: 420px; }
.auth-divider { display: flex; align-items: center; gap: 1rem; color: var(--z-muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--z-border); }
.otp-input { width: 54px; height: 58px; text-align: center; font-size: 1.4rem; font-weight: 700; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--z-body-bg); }
.error-code { font-size: clamp(6rem, 18vw, 10rem); font-weight: 800; line-height: 1; letter-spacing: -.05em; background: linear-gradient(135deg, var(--z-primary), #8b5cf6, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.countdown-box { min-width: 86px; padding: 1rem .75rem; border-radius: var(--z-radius); background: var(--z-surface); border: 1px solid var(--z-border); box-shadow: var(--z-shadow); }
.countdown-box .num { font-size: 2rem; font-weight: 800; color: var(--z-heading); display: block; line-height: 1; }
.theme-float { position: fixed; top: 1rem; right: 1rem; z-index: 10; }

/* 10. Responsive ----------------------------------------------------------- */
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-main { margin-left: 0; }
  .sidebar-open .app-sidebar { transform: none; box-shadow: var(--z-shadow-lg); }
  .sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .topbar-search { display: none; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .email-layout { grid-template-columns: 1fr; }
  .email-sidebar { border-right: 0; border-bottom: 1px solid var(--z-border); }
  .timeline-center::before { left: 11px; transform: none; }
  .timeline-center { padding-left: 2rem; }
  .timeline-center .timeline-item, .timeline-center .timeline-item:nth-child(even) { width: 100%; margin-left: 0; padding: 0 0 1.5rem; text-align: left; }
  .timeline-center .timeline-dot, .timeline-center .timeline-item:nth-child(even) .timeline-dot { left: -2rem; right: auto; }
}
@media (max-width: 575.98px) {
  .app-content { padding: 1rem; }
  .app-topbar { padding: 0 .75rem; }
  .otp-input { width: 44px; height: 50px; }
  .pricing-card.featured { transform: none; }
}

/* Theme toggle icons */
[data-bs-theme="light"] .theme-icon-dark,
[data-bs-theme="dark"] .theme-icon-light { display: none; }

/* Library fine-tuning */
div.dt-container .dt-length select { width: auto; min-width: 72px; padding-right: 2rem; display: inline-block; margin-right: .4rem; }
div.dt-container .dt-search input { min-width: 220px; }
.gridjs-pagination .gridjs-pages button:disabled, .gridjs-pagination .gridjs-pages button:hover:disabled { background: var(--z-surface) !important; color: var(--z-muted) !important; }
.gridjs-pagination .gridjs-pages button:hover { background: var(--z-surface-2); color: var(--z-text); }
.gridjs-summary { color: var(--z-muted); }
@media (max-width: 575.98px) { .pagination { flex-wrap: wrap; row-gap: .35rem; } }
.gridjs-pagination .gridjs-pages button.gridjs-spread, .gridjs-pagination .gridjs-pages button.gridjs-spread:hover { background: var(--z-surface) !important; color: var(--z-muted) !important; cursor: default; box-shadow: none; }
.gridjs-pagination .gridjs-pages button:focus { box-shadow: 0 0 0 .2rem rgba(var(--z-primary-rgb), .25); }
