/* =====================================================================
   Theme layer (loaded after app.css): dark teal dashboard look + light mode,
   RTL/LTR aware. Colours are variables so the admin can retheme in one place.
   ===================================================================== */
:root, :root[data-theme="dark"] {
  --primary: #2dd4bf;
  --primary-light: #3fe0cb;
  --primary-dark: #14b8a6;
  --accent: #2dd4bf;
  --accent-light: #5eead4;
  --success: #34d399;
  --danger: #f87171;
  --warning: #f5c542;
  --info: #60a5fa;
  --bg: #171b20;
  --bg-card: #20262d;
  --bg-elev: #272e36;
  --sidebar-bg: #1b2026;
  --sidebar-text: #aab4bf;
  --sidebar-hover: #242b33;
  --sidebar-active: #2dd4bf;
  --text: #e8edf2;
  --text-muted: #8b97a4;
  --border: #2d353e;
  --shadow: 0 4px 22px rgba(0,0,0,.28);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.4);
  --hero-from: #1f6f66;
  --hero-to: #3fb59a;
  --on-accent: #06211d;
  --input-bg: #1a1f25;
  --radius: 14px;
  --radius-sm: 10px;
  --font-main: "Segoe UI", "Cairo", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --primary: #0f9f8a;
  --primary-light: #14b8a6;
  --primary-dark: #0d7f6e;
  --accent: #0f9f8a;
  --accent-light: #2dd4bf;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --bg: #f1f5f7;
  --bg-card: #ffffff;
  --bg-elev: #f6f9fa;
  --sidebar-bg: #ffffff;
  --sidebar-text: #51606d;
  --sidebar-hover: #eef6f5;
  --sidebar-active: #0f9f8a;
  --text: #1c2833;
  --text-muted: #6b7a88;
  --border: #e1e8ec;
  --shadow: 0 2px 16px rgba(20,60,70,.08);
  --shadow-lg: 0 10px 32px rgba(20,60,70,.14);
  --hero-from: #0f9f8a;
  --hero-to: #34c2a8;
  --on-accent: #ffffff;
  --input-bg: #ffffff;
  color-scheme: light;
}

body { background: var(--bg); color: var(--text); font-family: var(--font-main); }
a { color: var(--primary); }
.login-card a, .pub-footer a, .text-center a { text-decoration: none; }
.login-card a:hover, .text-center a:hover { text-decoration: underline; }
html[dir="ltr"] { direction: ltr; }
html[dir="ltr"] body { direction: ltr; text-align: left; }

/* ---------------- sidebar ---------------- */
.sidebar { background: var(--sidebar-bg); border-inline-end: 1px solid var(--border); box-shadow: none; width: var(--sidebar-w); }
html[dir="ltr"] .sidebar { right: auto; left: 0; }
html[dir="ltr"] .main-wrapper { margin-right: 0; margin-left: var(--sidebar-w); }
.sidebar-logo { background: transparent; border-bottom: 0; padding: 22px 20px 14px; }
.sidebar-logo .logo-icon { background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); border-radius: 12px; font-size: 16px; letter-spacing: .5px; }
.sidebar-logo .logo-text h1 { color: var(--text); font-size: 15px; }
.sidebar-logo .logo-text small { color: var(--text-muted); }
.nav-section-title { color: var(--text-muted); opacity: .7; letter-spacing: 1.2px; padding: 16px 22px 6px; font-size: 11px; }
.nav-item { margin: 2px 12px; padding: 10px 14px; border-radius: 10px; color: var(--sidebar-text); gap: 12px; font-size: 13.5px; position: relative; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--text); }
.nav-item.active { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); font-weight: 700; border: 0; }
.nav-item.active::before { content: ""; position: absolute; inset-block: 8px; inset-inline-end: -12px; width: 4px; border-radius: 4px; background: var(--primary); right: auto; left: auto; }
html[dir="ltr"] .nav-item.active { border-left: 0; }
html[dir="ltr"] .nav-item.active::before { inset-inline-end: auto; inset-inline-start: -12px; }
.nav-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0; }
.nav-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { background: var(--warning); color: #2a2100; border-radius: 20px; font-size: 10px; padding: 2px 7px; margin-inline-start: auto; margin-right: 0; margin-left: 0; font-weight: 800; }
.nav-summary-card { margin: 14px 14px 10px; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; }
.nav-summary-card svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.sidebar-footer { border-top: 1px solid var(--border); background: transparent; }
.sidebar-user .avatar { background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); }
.user-name { color: var(--text); }
.user-role { color: var(--text-muted); }

/* ---------------- topbar ---------------- */
.topbar { background: color-mix(in srgb, var(--bg-card) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); box-shadow: none; gap: 12px; }
.topbar-title { color: var(--text); font-size: 18px; font-weight: 800; }
.topbar-title small { color: var(--text-muted); font-weight: 500; }
.topbar-btn, .tb-btn { background: var(--bg-elev); color: var(--text-muted); border: 1px solid var(--border); border-radius: 10px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; text-decoration: none; font-size: 13px; font-weight: 700; padding: 0; transition: .15s; }
.topbar-btn:hover, .tb-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--bg-elev); }
.tb-btn svg, .topbar-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tb-btn.accent { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.tb-btn.lang { width: auto; padding: 0 12px; gap: 6px; }
.topbar-badge { position: absolute; top: -5px; inset-inline-end: -5px; background: var(--warning); color: #2a2100; border-radius: 20px; min-width: 18px; height: 18px; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; left: auto; right: auto; }
.topbar-actions { gap: 8px; display: flex; align-items: center; }
.topbar-date { color: var(--text-muted); font-size: 12px; }
.topbar-user-chip { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 4px 10px 4px 6px; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.topbar-user-avatar { background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); }
.topbar-user-meta small { color: var(--text-muted); }
.topbar-search { flex: 1; max-width: 420px; position: relative; margin-inline: 8px; }
.topbar-search input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); padding: 0 14px; padding-inline-end: 42px; font-family: inherit; font-size: 13px; }
.topbar-search input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.topbar-search button { position: absolute; inset-inline-end: 4px; top: 4px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.topbar-search button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.topbar-search kbd { position: absolute; inset-inline-end: 40px; top: 11px; font-size: 10px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; background: var(--bg-elev); }
.userdrop { position: relative; }
.userdrop-menu { display: none; position: absolute; inset-inline-end: 0; top: 48px; min-width: 210px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 1200; }
.userdrop.open .userdrop-menu { display: block; }
.userdrop-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); text-decoration: none; border-radius: 8px; font-size: 13px; }
.userdrop-menu a:hover { background: var(--bg-elev); color: var(--primary); }
.userdrop-menu svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; }

/* topbar title must never overflow the bar */
.topbar-title { line-height: 1.25; min-width: 0; flex: 0 1 auto; }
.topbar-title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(46vw, 560px); font-size: 11.5px; }
@media (max-width: 1280px) { .topbar-title small { display: none; } }
html[dir="ltr"] .form-control, html[dir="ltr"] input, html[dir="ltr"] textarea, html[dir="ltr"] select { text-align: left; }
.table td.ltr, .table th.ltr, td.ltr { white-space: nowrap; word-break: normal; }
.badge { white-space: nowrap; }

/* ---------------- cards / stats ---------------- */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { border-bottom: 1px solid var(--border); background: transparent; }
.card-title { color: var(--text); }
.page-content { background: transparent; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.stat-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.stat-value { color: var(--text); }
.stat-label { color: var(--text-muted); }
.stat-icon { border-radius: 12px; }
.stat-icon.primary, .stat-icon.accent { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.stat-icon.success { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.stat-icon.warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.stat-icon.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.stat-icon.info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.stats-grid.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .stats-grid.stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats-grid.stats-3 { grid-template-columns: 1fr; } }
.stat-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.hero-card { background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); border-radius: 18px; padding: 24px 26px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero-card .hero-label { font-size: 13px; opacity: .85; }
.hero-card .hero-value { font-size: 40px; font-weight: 800; line-height: 1.1; margin: 6px 0 12px; }
.hero-card .hero-value small { font-size: 14px; font-weight: 600; opacity: .8; }
.hero-card .hero-meter { height: 8px; border-radius: 8px; background: rgba(255,255,255,.28); overflow: hidden; margin: 10px 0 6px; }
.hero-card .hero-meter i { display: block; height: 100%; background: #fff; border-radius: 8px; }
.hero-card .hero-note { font-size: 12px; opacity: .85; }
.hero-card .spark { position: absolute; inset-inline-end: 10px; top: 14px; width: 46%; height: 70px; opacity: .9; }
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-grid .span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr 1fr; } .dash-grid .hero-card { grid-column: span 2; } }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid .span-2 { grid-column: auto; } }
.mini-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.mini-card .mc-title { color: var(--text-muted); font-size: 12.5px; display: flex; justify-content: space-between; margin-bottom: 4px; }
.mini-card .mc-value { font-size: 26px; font-weight: 800; color: var(--text); }
.mini-card .spark { width: 100%; height: 48px; margin-top: 6px; }
.spark-line { stroke: var(--primary); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: color-mix(in srgb, var(--primary) 14%, transparent); }
.hero-card .spark-line { stroke: #fff; }
.hero-card .spark-area { fill: rgba(255,255,255,.14); }
.bars { display: flex; align-items: flex-end; gap: 10px; padding-top: 18px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.bar { width: 100%; max-width: 26px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 40%, transparent)); }
.bar-val { font-size: 10px; color: var(--text-muted); margin-bottom: 3px; }
.bar-lbl { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 118px; height: 118px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; }
.donut::after { content: ""; position: absolute; inset: 22px; background: var(--bg-card); border-radius: 50%; }
.donut span { position: relative; z-index: 1; font-weight: 800; font-size: 20px; }
.donut-legend { list-style: none; font-size: 12.5px; color: var(--text-muted); display: grid; gap: 6px; }
.donut-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 7px; }
.donut-legend b { color: var(--text); margin-inline-start: 6px; }

/* ---------------- tables ---------------- */
.table thead th { background: var(--bg-elev); color: var(--text-muted); border: 0; font-size: 12px; text-transform: none; }
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.table tbody td { color: var(--text); }
.table-striped tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-elev) 55%, transparent); }
html[dir="ltr"] .table th, html[dir="ltr"] .table td { text-align: left; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; opacity: .35; font-size: 10px; }
th.sortable.asc::after { content: " ↑"; opacity: 1; color: var(--primary); }
th.sortable.desc::after { content: " ↓"; opacity: 1; color: var(--primary); }
.tbl-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0 12px; }
.tbl-tools input { height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); padding: 0 12px; min-width: 220px; font-family: inherit; font-size: 13px; }
.tbl-tools select { height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); padding: 0 8px; }
.tbl-tools .tbl-count { color: var(--text-muted); font-size: 12px; margin-inline-start: auto; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0 2px; }
.pager-info { color: var(--text-muted); font-size: 12.5px; }
.pager-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pg-btn { min-width: 36px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 13px; cursor: pointer; font-family: inherit; }
a.pg-btn:hover, button.pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); font-weight: 800; }
.pg-btn.disabled { opacity: .4; pointer-events: none; }
.pager-per select { height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); padding: 0 8px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar .form-control { max-width: 280px; }

/* ---------------- forms / buttons ---------------- */
.form-control, select.form-control, textarea.form-control, input.form-control { background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 10px; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); outline: 0; }
.form-control::placeholder { color: var(--text-muted); opacity: .7; }
.form-label { color: var(--text-muted); }
.btn { border-radius: 10px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: var(--on-accent); }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: var(--on-accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #05261a; }
.badge-success { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.badge-danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.badge-warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.badge-info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.alert-success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.alert-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.alert-warning { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.alert-info { background: color-mix(in srgb, var(--info) 12%, transparent); color: var(--info); }
html[dir="ltr"] .alert-success, html[dir="ltr"] .alert-danger, html[dir="ltr"] .alert-warning, html[dir="ltr"] .alert-info { border-right: 0; border-left: 4px solid currentColor; }
.text-muted { color: var(--text-muted) !important; }
.modal-box, .modal-content { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }

/* tabs bar used on settings-like pages */
.tabbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; padding: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; }
.tabbar a { padding: 9px 16px; border-radius: 10px; color: var(--text-muted); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.tabbar a:hover { color: var(--text); background: var(--bg-elev); }
.tabbar a.active { background: var(--primary); color: var(--on-accent); }

/* toggle switch for settings */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .sw-text strong { display: block; font-size: 14px; }
.switch-row .sw-text small { color: var(--text-muted); font-size: 12px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 26px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { inset-inline-start: 23px; }
.setting-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.kan-col { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; min-height: 160px; }
.kan-col h3 { font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between; margin-bottom: 10px; }
.kan-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; cursor: grab; font-size: 13px; }
.kan-card.dragging { opacity: .5; }
.kan-col.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--bg-card)); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--text-muted); padding: 6px 0; }
.cal-day { min-height: 92px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: 11px; overflow: hidden; }
.cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.cal-day.other { opacity: .35; }
.cal-day .n { font-weight: 800; font-size: 12px; margin-bottom: 4px; display: block; }
.cal-ev { display: block; padding: 2px 6px; border-radius: 6px; margin-bottom: 3px; background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-ev.high { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.cal-ev.med { background: color-mix(in srgb, var(--warning) 22%, transparent); }
@media (max-width: 800px) { .cal-day { min-height: 60px; } .cal-ev { font-size: 9px; } }

/* ---------------- auth pages ---------------- */
body.auth-page { background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--primary) 22%, transparent), transparent), radial-gradient(900px 500px at 0% 110%, color-mix(in srgb, var(--info) 14%, transparent), var(--bg)); display: block; }
.login-wrapper { background: none !important; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px 32px; width: 100%; max-width: 440px; color: var(--text); }
.login-card.wide { max-width: 620px; }
.login-logo { text-align: center; margin-bottom: 22px; }
.logo-circle { width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; }
.login-logo h1 { font-size: 21px; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.auth-tools { position: fixed; top: 16px; inset-inline-end: 16px; display: flex; gap: 8px; z-index: 50; }
.pw-wrap { position: relative; }
.pw-wrap .pw-eye { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 6px; }
.pw-wrap .pw-eye svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.pw-wrap input { padding-inline-end: 40px; }
.pw-meter { height: 5px; border-radius: 5px; background: var(--border); margin-top: 6px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; transition: .25s; }

/* ---------------- public landing ---------------- */
.pub-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px clamp(16px, 5vw, 64px); }
.pub-nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); text-decoration: none; }
.pub-nav .brand .logo-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 900; }
.pub-hero { padding: clamp(36px, 8vw, 90px) clamp(16px, 5vw, 64px); text-align: center; }
.pub-hero h1 { font-size: clamp(28px, 5vw, 52px); line-height: 1.2; margin-bottom: 14px; }
.pub-hero h1 em { font-style: normal; color: var(--primary); }
.pub-hero p { color: var(--text-muted); max-width: 640px; margin: 0 auto 26px; font-size: 16px; }
.pub-section { padding: 10px clamp(16px, 5vw, 64px) 40px; max-width: 1200px; margin: 0 auto; }
.pub-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.pub-feature { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.pub-feature h3 { margin: 10px 0 6px; font-size: 16px; }
.pub-feature p { color: var(--text-muted); font-size: 13.5px; }
.pub-feature .ico { width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.pub-feature .ico svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.pub-footer { text-align: center; color: var(--text-muted); padding: 24px; font-size: 12.5px; border-top: 1px solid var(--border); }
.estimator { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; max-width: 760px; margin: 0 auto; text-align: start; }
.est-total { font-size: 30px; font-weight: 800; color: var(--primary); }

/* ---------------- responsive sidebar ---------------- */
.sidebar-backdrop { display: none; }
@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); transition: transform .25s; z-index: 1300; }
  html[dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0) !important; box-shadow: var(--shadow-lg); }
  .main-wrapper { margin-right: 0 !important; margin-left: 0 !important; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1250; }
  .topbar-search { display: none; }
  .topbar-date, .topbar-user-meta { display: none; }
}
@media print { .sidebar, .topbar, .pager, .tbl-tools, .auth-tools { display: none !important; } .main-wrapper { margin: 0 !important; } }

/* ---- AUTO: surface overrides for legacy hard-coded colours ---- */
.topbar { background: var(--bg-card); }
.topbar-lang-btn { background: var(--bg-card); }
.topbar-btn { background: var(--bg-card); }
.topbar-badge { border: 2px solid var(--border); }
.topbar-user-chip { background: var(--bg-card); }
.topbar-user-chip:hover { border-color: var(--border); }
.card-header { background: var(--bg-card); }
.stat-card { background: var(--bg-card); }
.form-control { background: var(--bg-card); }
.leave-balance-card { background: var(--bg-card); }
.modal-box { background: var(--bg-card); }
.page-btn { background: var(--bg-card); }
.login-card { background: var(--bg-card); }
.tabs-nav { background: var(--bg-card); }
.tabs-nav .tab-btn.active { background: var(--bg-card); }
.global-action-overlay__dialog { background: var(--bg-card); }
.quick-action,
.quick-panel { background: var(--bg-card); }
.requirement-row { background: var(--bg-card); }
.legal-stage-card { background: var(--bg-card); }
.mini-doc-row { background: var(--bg-elev); }
.client-requirement-card { background: var(--bg-card); }
.requirement-note,
.requirement-done { background: var(--bg-elev); }
.timeline-item { background: var(--bg-card); }
.wizard-step { background: var(--bg-card); }
.status-step { background: var(--bg-card); }
.status-step span { background: var(--bg-elev); }
.suggestion-card { background: var(--bg-card); }
.busy-box { background: var(--bg-card); }
.modal-box { background: var(--bg-card); }
.modal-header { background: var(--bg-card); }
.modal-close { background: var(--bg-card); }
.table-responsive .table tr { background: var(--bg-card); }
.trademark-dossier-card { background: var(--bg-card); }
.tm-mark-preview { background: var(--bg-elev); }
.class-line { background: var(--bg-card); }
.case-hub .table tr { background: var(--bg-card); }

/* ---------------- smart quote wizard (public_quote/quote.php) ---------------- */
.wiz-wrap { max-width: 920px; margin: 0 auto; padding: 28px 16px 70px; }
.wiz-head { text-align: center; margin-bottom: 26px; }
.wiz-logo { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 900; text-decoration: none; }
.wiz-head h1 { font-size: clamp(22px, 4vw, 30px); margin-bottom: 6px; }
.wiz-head p { color: var(--text-muted); max-width: 560px; margin: 0 auto; }
.wiz-steps { list-style: none; display: flex; justify-content: space-between; gap: 6px; margin: 0 0 10px; padding: 0; }
.wiz-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; cursor: default; min-width: 0; }
.wiz-steps li.reach { cursor: pointer; }
.wiz-dot { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg-card); color: var(--text-muted); font-weight: 800; display: flex; align-items: center; justify-content: center; position: relative; padding: 0; font-family: inherit; transition: .2s; }
.wiz-dot .ck { display: none; } .wiz-dot .ck svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 3; }
.wiz-steps li.active .wiz-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 20%, transparent); }
.wiz-steps li.done .wiz-dot { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.wiz-steps li.done .num { display: none; } .wiz-steps li.done .ck { display: block; }
.wiz-lbl { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wiz-lbl strong { font-size: 12.5px; color: var(--text-muted); } .wiz-steps li.active .wiz-lbl strong, .wiz-steps li.done .wiz-lbl strong { color: var(--text); }
.wiz-lbl small { font-size: 11px; color: var(--text-muted); opacity: .8; }
.wiz-bar { height: 4px; background: var(--border); border-radius: 4px; margin: 0 20px 22px; overflow: hidden; }
.wiz-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--hero-from), var(--hero-to)); border-radius: 4px; transition: width .35s; }
html[dir="rtl"] .wiz-bar i { margin-inline-start: auto; }
.wiz-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 26px; }
.wiz-panel { display: none; animation: wizIn .25s ease; } .wiz-panel.active { display: block; }
@keyframes wizIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wiz-panel > h2 { font-size: 19px; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.wiz-panel > h2 svg { width: 22px; height: 22px; stroke: var(--primary); fill: none; stroke-width: 1.9; }
.wiz-sub { font-size: 15px; margin: 22px 0 12px; color: var(--text); padding-top: 16px; border-top: 1px dashed var(--border); }
.wiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.wiz-count { color: var(--text-muted); font-size: 13px; }
.form-control.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.class-line { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.cl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cl-remove svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; }
.sg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sg-card { text-align: start; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; color: var(--text); cursor: pointer; font-family: inherit; display: flex; flex-direction: column; gap: 4px; transition: .15s; }
.sg-card small { color: var(--text-muted); } .sg-card:hover { border-color: var(--primary); } .sg-card.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--bg-elev)); }
.drop { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 2px dashed var(--border); border-radius: 14px; background: var(--bg-elev); cursor: pointer; transition: .15s; min-width: 0; }
.drop:hover, .drop.has { border-color: var(--primary); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-ico { width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.drop-ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; transform: rotate(180deg); }
.drop-t { display: flex; flex-direction: column; min-width: 0; } .drop-t small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz-toggle { margin-top: 18px; padding: 14px 16px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; }
.wiz-toggle .switch-row { border: 0; padding: 0; }
.wiz-summary { display: grid; gap: 10px; margin: 0; }
.wiz-summary > div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 12px 14px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; }
.wiz-summary dt { color: var(--text-muted); font-size: 13px; } .wiz-summary dd { margin: 0; font-weight: 600; word-break: break-word; }
.wiz-toast { position: fixed; bottom: 24px; inset-inline: 0; margin: auto; width: max-content; max-width: 90vw; background: var(--danger); color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(12px); transition: .25s; z-index: 2000; pointer-events: none; }
.wiz-toast.show { opacity: 1; transform: none; }
@media (max-width: 680px) {
  .wiz-card { padding: 18px 14px; } .wiz-lbl small { display: none; } .wiz-lbl strong { font-size: 10.5px; }
  .wiz-dot { width: 34px; height: 34px; } .wiz-summary > div { grid-template-columns: 1fr; gap: 2px; }
  .wiz-nav .wiz-count { display: none; } .wiz-nav .btn-lg { width: 100%; }
}
