/* AUTO-GENERATED by build_css.py — do not edit directly.
   Source files live in static/css/*.css.
   Built: 2026-05-02T09:58:09Z
   Order: 01_base.css -> 02_layout.css -> 03_panels.css -> 04_charts_filters.css -> 05_ribbon_alerts.css -> 06_calendar.css -> 07_drawer_modal.css -> 08_messaging.css -> 09_chat.css -> 10_insights.css -> 11_misc.css -> 12_responsive.css -> 13_print.css
*/

/* === 01_base.css === */
/* =============================================================================
   Malek365 — styles.css
   Organised top-down: variables/themes · layout · components · utilities ·
   responsive · print. Light and dark themes use the same CSS custom
   properties overridden inside `html.dark`.
============================================================================= */

/* =============================================================================
   THEMES — three palettes overriding the same CSS custom properties.
   Switch via the `data-theme` attribute on <html> (driven by setTheme() in
   base.html, persisted in localStorage). The legacy `html.dark` class also
   works so older saved prefs keep rendering correctly.
     default (:root)               = "original" — warm cream + terracotta
     html[data-theme="pro"]        = clean white + near-black
     html[data-theme="dark"]       = slate + blue accent (no browns)
============================================================================= */

:root {
  /* Original — warm cream + terracotta */
  --brand: #b45032;
  --brand-dark: #8a3c25;
  --brand-tint: #f4e3dc;
  --brand-soft: #e2a793;

  --bg: #f3ece6;
  --panel: #ffffff;
  --panel-2: #faf4ef;
  --ink: #1d1510;
  --muted: #7a6d6d;
  --border: #e3d4d1;
  --soft: #f7ecec;
  --ring: rgba(180, 80, 50, 0.18);

  --accent: var(--brand);
  --accent-ink: var(--brand-dark);

  --ok: #2f7d3b;
  --warn: #c27439;
  --bad: #b91c1c;

  --sidebar-w: 230px;
  --sidebar-w-collapsed: 64px;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 14, 10, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 14, 10, 0.06);
}

/* Pro — clean, minimal, corporate white */
html[data-theme="pro"] {
  --brand: #0f172a;          /* slate-900 for primary buttons */
  --brand-dark: #020617;
  --brand-tint: #f1f5f9;     /* pale accent surface */
  --brand-soft: #cbd5e1;

  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --soft: #f8fafc;
  --ring: rgba(15, 23, 42, 0.12);

  --accent: var(--brand);
  --accent-ink: var(--brand-dark);

  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* Dark — slate-900 base + blue accent (no browns) */
html[data-theme="dark"],
html.dark {
  --brand: #60a5fa;          /* blue-400 */
  --brand-dark: #3b82f6;     /* blue-500 */
  --brand-tint: #1e3a5f;     /* dark-blue tint */
  --brand-soft: #2563eb;

  --bg: #0b1220;             /* near-black, slight blue cast */
  --panel: #111827;          /* slate-900 */
  --panel-2: #0f172a;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --border: #1f2937;         /* slate-800 */
  --soft: #111827;
  --ring: rgba(96, 165, 250, 0.22);

  --accent: var(--brand);
  --accent-ink: #93c5fd;

  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

/* Global scale knob. The whole app is sized in `rem`, so dropping the
   root font-size shrinks padding, gaps, fonts, and rounded radii in
   one place. 15px ≈ 94% of the browser default (16px) — close to what
   the previous "manual zoom to 90%" achieved without the chrome
   sub-pixel blur. Bump to 14.5px for a tighter look or back to 16px
   to revert. */
html { font-size: 15px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}
html[dir="rtl"] body {
  font-family: "Segoe UI", "Tahoma", "Geeza Pro", "Arial", system-ui, sans-serif;
}


/* === 02_layout.css === */
/* =================== LAYOUT: SIDEBAR + APP WRAP =================== */
.app-wrap {
  margin-inline-start: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-inline-start 180ms ease;
}
html.nav-collapsed .app-wrap { margin-inline-start: var(--sidebar-w-collapsed); }

aside.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width 180ms ease;
  box-shadow: var(--shadow-sm);
}
html.nav-collapsed aside.sidebar { width: var(--sidebar-w-collapsed); }

.sidebar-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: 62px;
}
html.nav-collapsed .sidebar-top { justify-content: center; padding: 0.85rem 0.5rem; }
.sidebar-top .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--accent-ink);
  overflow: hidden;
}
.sidebar-top .brand img { height: 30px; width: auto; flex-shrink: 0; }
.sidebar-top .brand .brand-name {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  white-space: nowrap;
}
html.nav-collapsed .brand-name { display: none; }

/* ============================================================ */
/* Brand logos — Malek365 SVG mark + lockup, theme-aware swap.   */
/*                                                              */
/* The default Malek365 brand block in base.html renders six img */
/* tags (3 lockup variants × 3 mark variants). One of each is    */
/* visible at a time, picked by:                                 */
/*   1. theme    — main / white / dark via .brand-asset-X        */
/*   2. sidebar  — collapsed shows .brand-mark, expanded shows  */
/*                 .brand-lockup. The login pages always show   */
/*                 the lockup (no .brand-mark) so the rule is   */
/*                 keyed on .sidebar-top context for collapse.  */
/* ============================================================ */
.brand-default .brand-lockup, .brand-default .brand-mark { display: none; }
.brand-asset-main, .brand-asset-white, .brand-asset-dark { display: none; }

/* Default = "original" theme → main-color asset */
.brand-default .brand-lockup.brand-asset-main,
.login-logo.brand-asset-main,
.powered-by .brand-asset-main { display: inline-block; }

html[data-theme="pro"] .brand-default .brand-lockup.brand-asset-main,
html[data-theme="pro"] .login-logo.brand-asset-main,
html[data-theme="pro"] .powered-by .brand-asset-main { display: none; }
html[data-theme="pro"] .brand-default .brand-lockup.brand-asset-white,
html[data-theme="pro"] .login-logo.brand-asset-white,
html[data-theme="pro"] .powered-by .brand-asset-white { display: inline-block; }

html[data-theme="dark"] .brand-default .brand-lockup.brand-asset-main,
html[data-theme="dark"] .login-logo.brand-asset-main,
html[data-theme="dark"] .powered-by .brand-asset-main,
html.dark         .brand-default .brand-lockup.brand-asset-main,
html.dark         .login-logo.brand-asset-main,
html.dark         .powered-by .brand-asset-main { display: none; }
html[data-theme="dark"] .brand-default .brand-lockup.brand-asset-dark,
html[data-theme="dark"] .login-logo.brand-asset-dark,
html[data-theme="dark"] .powered-by .brand-asset-dark,
html.dark         .brand-default .brand-lockup.brand-asset-dark,
html.dark         .login-logo.brand-asset-dark,
html.dark         .powered-by .brand-asset-dark { display: inline-block; }

/* Collapsed sidebar — swap lockup → mark, same theme rules. */
html.nav-collapsed .brand-default .brand-lockup { display: none !important; }
html.nav-collapsed .brand-default .brand-mark.brand-asset-main { display: inline-block; }
html.nav-collapsed[data-theme="pro"] .brand-default .brand-mark.brand-asset-main { display: none; }
html.nav-collapsed[data-theme="pro"] .brand-default .brand-mark.brand-asset-white { display: inline-block; }
html.nav-collapsed[data-theme="dark"] .brand-default .brand-mark.brand-asset-main,
html.nav-collapsed.dark             .brand-default .brand-mark.brand-asset-main { display: none; }
html.nav-collapsed[data-theme="dark"] .brand-default .brand-mark.brand-asset-dark,
html.nav-collapsed.dark             .brand-default .brand-mark.brand-asset-dark { display: inline-block; }

/* Floating collapse tab on the trailing edge of the sidebar. Uses
   top/bottom + margin:auto to center absolutely without transforms,
   so the chevron glyph sits on the true pixel center. */
.nav-collapse-btn {
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-end: -12px;
  margin: auto 0;
  width: 24px; height: 24px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 41;
  box-shadow: var(--shadow-sm);
  line-height: 0;
}
.nav-collapse-btn:hover { color: var(--accent-ink); border-color: var(--brand-soft); }
.nav-collapse-btn svg {
  display: block;
  width: 10px; height: 10px;
  transition: transform 180ms ease;
}
html.nav-collapsed .nav-collapse-btn svg { transform: rotate(180deg); }
html[dir="rtl"] .nav-collapse-btn svg { transform: rotate(180deg); }
html[dir="rtl"].nav-collapsed .nav-collapse-btn svg { transform: rotate(0deg); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  transition: background 120ms;
}
.sidebar-nav a:hover { background: var(--soft); color: var(--accent-ink); }
.sidebar-nav a.active { background: var(--brand-tint); color: var(--accent-ink); font-weight: 600; }
.sidebar-nav a .icon {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; line-height: 1;
}
/* Lucide SVGs inside sidebar / footer / bell icons — size them via
   the wrapper rather than relying on their default 24px. */
.sidebar-nav a .icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.sidebar-foot .icon-btn .icon svg { width: 17px; height: 17px; stroke-width: 1.8; }
.bell .bell-icon svg { width: 17px; height: 17px; stroke-width: 1.8; }
html.nav-collapsed .sidebar-nav a .label,
html.nav-collapsed .nav-divider .label,
html.nav-collapsed .sidebar-foot .label { display: none; }

.nav-divider {
  padding: 0.75rem 0.75rem 0.3rem;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  margin-top: 0.4rem;
}

.sidebar-foot {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.3rem;
}
.sidebar-foot .icon-btn {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.45rem 0.75rem;
  border: none; background: transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  text-align: start;
}
.sidebar-foot .icon-btn:hover { background: var(--soft); color: var(--accent-ink); }
.sidebar-foot .icon-btn .icon { width: 22px; text-align: center; font-size: 1.05rem; }

/* ---- Sidebar user block (bottom of sidebar) ---- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.75rem;
  margin-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  user-select: none;
}
.sidebar-user .user-info {
  flex: 1;
  min-width: 0;      /* allow ellipsis when cramped */
  line-height: 1.2;
}
.sidebar-user .user-name {
  font-weight: 600; font-size: 0.88rem;
  color: var(--accent-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 0.76rem;
}
.sidebar-user .sidebar-logout {
  all: unset;
  width: 32px; height: 32px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.sidebar-user .sidebar-logout:hover {
  background: var(--soft);
  color: var(--bad);
}
.sidebar-user .sidebar-logout svg { width: 17px; height: 17px; stroke-width: 1.8; }
/* Collapsed (desktop icon-only): hide name+role, stack avatar + logout
   vertically so they both stay clickable. */
html.nav-collapsed .sidebar-user {
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.3rem;
  align-items: center;
}
html.nav-collapsed .sidebar-user .user-info { display: none; }

/* ---- Mobile close X button on sidebar-top (hidden on desktop) ---- */
.nav-close-btn {
  display: none;
  margin-inline-start: auto;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 0; cursor: pointer;
  color: var(--muted);
  align-items: center;
  justify-content: center;
}
.nav-close-btn:hover { color: var(--bad); border-color: var(--brand-soft); }
.nav-close-btn svg { width: 18px; height: 18px; stroke-width: 2; }

/* ---- Backdrop overlay behind the sidebar on mobile ---- */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 8, 0.42);
  z-index: 50;           /* under the sidebar (60) but over page content */
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
body.nav-open .nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Theme cycle button — show only the glyph matching the active theme */
.theme-btn .theme-icon-original,
.theme-btn .theme-icon-pro,
.theme-btn .theme-icon-dark { display: none; }
html:not([data-theme]) .theme-btn .theme-icon-original,
html[data-theme="original"] .theme-btn .theme-icon-original { display: inline; }
html[data-theme="pro"]      .theme-btn .theme-icon-pro { display: inline; }
html[data-theme="dark"]     .theme-btn .theme-icon-dark { display: inline; }

.privacy-btn .priv-label-off { display: none; }
body.privacy .privacy-btn .priv-label-on { display: none; }
body.privacy .privacy-btn .priv-label-off { display: inline; }
body.privacy .privacy-btn { color: var(--brand); }

/* Swap the privacy icon between eye (currently visible → click to hide)
   and eye-off (currently hidden → click to show). */
.privacy-btn .priv-icon-on { display: none; }
body.privacy .privacy-btn .priv-icon-off { display: none; }
body.privacy .privacy-btn .priv-icon-on { display: inline-flex; }

.lang-switch-v {
  display: flex; gap: 0.25rem;
  padding: 0.3rem 0.5rem 0.1rem;
  justify-content: center;
}
html.nav-collapsed .lang-switch-v { flex-direction: column; gap: 0.15rem; }
.lang-switch-v a {
  flex: 1;
  text-align: center;
  padding: 0.3rem 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.lang-switch-v a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.powered-by {
  display: flex; align-items: center; justify-content: center;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
}
.powered-by img { height: 18px; width: auto; opacity: 0.85; }
html.nav-collapsed .powered-by .label { display: none; }

/* =================== TOPBAR (now thin) + MAIN =================== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 52px;
}
.topbar .topbar-right {
  margin-inline-start: auto;
  display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap;
}
.topbar .today { color: var(--muted); font-size: 0.85rem; }
.nav-toggle {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 6px;
  padding: 0; cursor: pointer;
}
.nav-toggle span { display: block; margin: 5px auto; width: 18px; height: 2px; background: var(--brand-dark); }

main {
  max-width: 1500px;
  margin: 1.25rem auto;
  padding: 0 1.25rem 2rem;
}
h1, h2, h3 { color: var(--ink); margin-top: 0; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; margin-top: 1.5rem; }


/* === 03_panels.css === */
/* =================== PANELS, KPIs, TABLES, FORMS =================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  transition: transform 120ms;
}
.kpi:hover { transform: translateY(-1px); }
.kpi .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi .value { font-size: 1.45rem; font-weight: 600; margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.kpi.bad .value { color: var(--bad); }
.kpi.ok .value { color: var(--ok); }
.kpi.warn .value { color: var(--warn); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--panel);
}
th, td {
  text-align: start;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { background: var(--panel-2); font-weight: 600; color: var(--ink); position: sticky; top: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--soft); }

.status {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}
.status.paid { background: #dff3e2; color: var(--ok); }
html.dark .status.paid,
html[data-theme="dark"] .status.paid { background: #213d24; color: #7fd495; }
.status.partial { background: #fbe6c7; color: var(--warn); }
html.dark .status.partial,
html[data-theme="dark"] .status.partial { background: #3d2f1b; color: #e0a574; }
.status.pending { background: var(--soft); color: var(--brand-dark); }
.status.overdue { background: #fbdddd; color: var(--bad); }
html.dark .status.overdue,
html[data-theme="dark"] .status.overdue { background: #3b1e1e; color: #e99090; }
.status.vacant { background: var(--brand-tint); color: var(--brand-dark); }

a { color: var(--accent); }
a:hover { color: var(--accent-ink); }

.btn {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 120ms, border-color 120ms;
}
.btn:hover { background: var(--soft); border-color: var(--brand-soft); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.small { padding: 0.22rem 0.55rem; font-size: 0.8rem; }
.btn.full { width: 100%; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.danger:hover { background: #921616; }

form.inline { display: inline; }
form .row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
form .field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 180px; }
form label { color: var(--muted); font-size: 0.82rem; }
form input, form select {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: var(--panel);
  color: var(--ink);
}
form input:focus, form select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
dl.kv {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(170px, max-content) 1fr;
  gap: 0.35rem 1rem;
}
dl.kv dt { color: var(--muted); font-size: 0.88rem; }
dl.kv dd { margin: 0; font-weight: 500; }

.ar { direction: rtl; text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* =================== MATRIX / CALENDAR =================== */
.matrix-wrap { overflow-x: auto; }
.matrix-wrap th:first-child, .matrix-wrap td:first-child {
  position: sticky; inset-inline-start: 0; background: var(--panel-2); z-index: 1; min-width: 90px;
}
.matrix-wrap td.num.nonzero { background: #ecfdf5; }
html.dark .matrix-wrap td.num.nonzero,
html[data-theme="dark"] .matrix-wrap td.num.nonzero { background: #1e2e23; }


/* === 04_charts_filters.css === */
/* =================== CHARTS =================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1rem; margin-bottom: 1rem;
}
.chart-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column;
}
.chart-panel h2 { margin: 0 0 0.75rem 0; font-size: 1rem; }
.chart-panel .chart-wrap { position: relative; height: 280px; }
.chart-panel canvas { max-width: 100%; }
.chart-panel .chart-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.chart-panel .chart-head h2 { margin: 0; }
.chart-panel .chart-filter {
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--panel);
  color: var(--ink);
}

/* =================== SLICERS / SEARCH =================== */
.slicers { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.slicers .field { min-width: 160px; }
.slicers .filter-count { margin-inline-start: auto; color: var(--muted); font-size: 0.85rem; }

.more-filters { flex-basis: 100%; margin-top: 0.25rem; }
.more-filters > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.35rem 0;
  user-select: none;
  list-style: none;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::before {
  content: "▸";
  display: inline-block;
  margin-inline-end: 0.35rem;
  transition: transform 150ms ease;
}
.more-filters[open] > summary::before { transform: rotate(90deg); }
.more-filters > summary:hover { color: var(--accent-ink); }
.more-filters-body {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: flex-end;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.25rem;
}
.more-filters-body .field { min-width: 160px; }
/* The Apply button shouldn't carry the 160 px min-width the facet
   fields need — it only has to hug its text and sit exactly the same
   height as the inputs next to it. */
.more-filters-body .filter-apply { min-width: 0; }
.more-filters-body .filter-apply .btn {
  padding: 0.48rem 1.1rem;
  font-size: 0.95rem;
  line-height: 1.25;
}

.filter-chips {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}
.filter-chips .chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--brand-soft);
  background: var(--brand-tint);
  color: var(--brand-dark);
  border-radius: 999px;
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.filter-chips .chip:hover { background: var(--brand-soft); }
.filter-chips .chip .chip-x { opacity: 0.7; font-weight: 600; line-height: 1; }
.filter-chips .chip-clear {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.search-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.search-bar input[type="search"] {
  flex: 1; min-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: var(--panel);
  color: var(--ink);
}
.search-bar .count { color: var(--muted); font-size: 0.85rem; }

/* =================== UPCOMING LIST =================== */
.upcoming-list {
  display: flex; flex-direction: column; gap: 0.4rem;
  max-height: 420px; overflow-y: auto; padding-inline-end: 0.25rem;
}
.upcoming-item {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 0.5rem 0.75rem; align-items: center;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  transition: border-color 120ms;
}
.upcoming-item:hover { border-color: var(--brand-soft); }
.upcoming-item .client { font-weight: 600; color: var(--accent-ink); }
.upcoming-item .meta-line { font-size: 0.82rem; color: var(--muted); }
.upcoming-item .amount { font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; white-space: nowrap; }
.upcoming-item .days-chip { font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--muted); color: #fff; }
.upcoming-empty { padding: 1rem; color: var(--muted); font-style: italic; }

/* =================== CONSENT CLAUSE =================== */
.consent-text {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}
.consent-text p { margin: 0 0 0.55rem; }
.consent-text p:last-child { margin-bottom: 0; }

/* =================== TENANT AUTOCOMPLETE =================== */
.tenant-suggestions {
  position: absolute;
  top: 100%; inset-inline-start: 0; inset-inline-end: 0;
  z-index: 50;
  margin-top: 0.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.tenant-suggestion {
  all: unset;
  display: block;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  text-align: start;
}
.tenant-suggestion:last-child { border-bottom: none; }
.tenant-suggestion:hover,
.tenant-suggestion:focus { background: var(--brand-tint); }
#tenant-picker.tenant-picked {
  border-color: var(--brand);
  background: var(--brand-tint);
}


/* === 05_ribbon_alerts.css === */
/* =================== DEMO RIBBON =================== */
/* Shown at the top of main content when current_org.is_demo. Makes it
   unambiguous during sales demos that the data is fake. */
.demo-ribbon {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0 1.25rem 1rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid #e6a23c;
  background: repeating-linear-gradient(
    135deg,
    #fff6e1,
    #fff6e1 10px,
    #fde9bf 10px,
    #fde9bf 20px
  );
  color: #8a5a00;
  border-radius: 6px;
  font-size: 0.9rem;
}
.demo-ribbon-tag {
  display: inline-block;
  background: #e6a23c;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  flex-shrink: 0;
}
html.dark .demo-ribbon,
html[data-theme="dark"] .demo-ribbon {
  background: repeating-linear-gradient(135deg, #3a2a10, #3a2a10 10px, #2e210b 10px, #2e210b 20px);
  color: #f0cf94; border-color: #6e4f1a;
}
/* Small badge next to the sidebar brand name — visible even when the
   ribbon has scrolled off the viewport. */
.demo-badge {
  display: inline-block;
  margin-inline-start: 0.25rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #e6a23c;
  color: #fff;
  border-radius: 3px;
  vertical-align: middle;
}
html.nav-collapsed .demo-badge { display: none; }

/* =================== AI ANALYSIS PANEL =================== */
.panel.ai-analysis {
  border-inline-start: 3px solid var(--brand);
  background: var(--brand-tint);
}
html.dark .panel.ai-analysis,
html[data-theme="dark"] .panel.ai-analysis { background: rgba(255,255,255,0.03); }
.ai-body { font-size: 0.95rem; line-height: 1.55; }
.ai-body p { margin: 0 0 0.6rem; }
.ai-body p:last-child { margin-bottom: 0; }
.ai-body ul { margin: 0.25rem 0 0.6rem; padding-inline-start: 1.2rem; }
.ai-body li { margin: 0.1rem 0; }
.ai-body h3, .ai-body h4, .ai-body h5 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-ink);
}
.ai-body strong { font-weight: 600; }

/* =================== ALERTS =================== */
.alert { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.92rem; }
.alert-info  { background: var(--brand-tint); color: var(--brand-dark); border: 1px solid var(--brand-soft); }
.alert-success { background: #e3f3e6; color: #1d6a2c; border: 1px solid #b6dfbe; }
.alert-error { background: #fbdddd; color: var(--bad); border: 1px solid #f2b7b7; }
html.dark .alert-error,
html[data-theme="dark"] .alert-error { background: #3b1e1e; color: #e99090; border-color: #5c2a2a; }
html.dark .alert-success,
html[data-theme="dark"] .alert-success { background: #1d3221; color: #a4d3ae; border-color: #2f5236; }
.flash-stack { margin: 0 0 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.flash-stack .alert { margin-bottom: 0; }

/* =================== LOGIN =================== */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--brand-tint) 100%);
}
.login-box {
  max-width: 380px; width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 1.5rem 1.25rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-box .login-logo { max-width: 180px; height: auto; margin-bottom: 0.25rem; }
.login-box .login-sub { color: var(--muted); font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; }
.login-box h1 { margin: 1rem 0 1rem; font-size: 1.15rem; color: var(--brand-dark); }
.login-box form { text-align: start; }
.login-box .field { margin-bottom: 0.75rem; }
.login-box .field label { display: block; margin-bottom: 0.2rem; color: var(--muted); font-size: 0.85rem; }
.login-box .field input { width: 100%; padding: 0.55rem 0.65rem; }
.login-box .btn.primary.full { margin-top: 0.5rem; padding: 0.6rem; font-size: 1rem; }
.login-box .login-langs { margin-top: 1rem; display: flex; gap: 0.75rem; justify-content: center; }
.login-box .login-langs a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.login-box .login-langs a.active { color: var(--brand-dark); font-weight: 600; }


/* === 06_calendar.css === */
/* =================== CALENDAR =================== */
.cal-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; padding: 0.6rem 0.75rem; }
.cal-controls .cal-form { display: flex; gap: 0.4rem; }
.cal-controls select { padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--ink); }
table.calendar {
  table-layout: fixed; width: 100%;
  border-collapse: separate; border-spacing: 4px;
  background: transparent;
}
table.calendar th { background: transparent; font-size: 0.78rem; color: var(--muted); border: none; padding: 0.3rem 0.2rem; text-transform: uppercase; letter-spacing: 0.06em; }
table.calendar td {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  vertical-align: top;
  height: 110px; padding: 0.25rem; overflow: hidden;
  position: relative;
}
table.calendar td.off { background: transparent; border-color: transparent; }
table.calendar td.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
table.calendar td.has-payments { background: var(--panel-2); }
.day-num { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
table.calendar td.today .day-num { color: var(--brand-dark); }
.cal-pay {
  display: flex; justify-content: space-between; gap: 4px;
  font-size: 0.74rem; margin-top: 2px; padding: 2px 5px;
  border-radius: 4px; text-decoration: none; color: var(--ink); line-height: 1.15;
}
.cal-pay.paid { background: #dff3e2; color: var(--ok); }
.cal-pay.partial { background: #fbe6c7; color: var(--warn); }
.cal-pay.pending { background: var(--brand-tint); color: var(--brand-dark); }
.cal-pay.overdue { background: #fbdddd; color: var(--bad); }
.cal-pay.static { cursor: default; padding: 0.2rem 0.6rem; }
.cal-pay-client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.cal-pay-amt { font-variant-numeric: tabular-nums; font-weight: 600; }

/* =================== UNIT / PROPERTY GRANT CHECKLISTS =================== */
.property-grant-grid, .unit-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.4rem 0.75rem;
}
.unit-check {
  display: flex; align-items: flex-start; gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer; font-size: 0.88rem;
}
.unit-check:hover { border-color: var(--brand-soft); }
.unit-check input[type="checkbox"] { margin-top: 0.15rem; }
.unit-check span { display: flex; flex-direction: column; line-height: 1.25; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; }

.users-list { display: flex; flex-direction: column; }
.user-card { border-top: 1px solid var(--border); padding: 1rem 1.25rem; }
.user-card:first-child { border-top: none; }
.user-card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }


/* === 07_drawer_modal.css === */
/* =================== DRAWER =================== */
.drawer { position: fixed; inset: 0; z-index: 1000; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15,10,8,0.42); opacity: 0; transition: opacity 240ms ease; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; inset-inline-end: 0; bottom: 0;
  width: min(1100px, 96vw);
  background: var(--bg);
  box-shadow: -12px 0 40px rgba(0,0,0,0.28);
  transform: translateX(100%); transition: transform 260ms ease;
  overflow-y: auto;
}
html[dir="rtl"] .drawer-panel { transform: translateX(-100%); box-shadow: 12px 0 40px rgba(0,0,0,0.28); }
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.drawer-body { padding: 1rem 1rem 2rem; }
body.drawer-open { overflow: hidden; }

/* =================== MODAL STACK (over drawer) =================== */
.modal-stack { position: fixed; inset: 0; z-index: 1100; }
.modal-stack[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 14, 10, 0.45);
  opacity: 0; transition: opacity 200ms ease;
}
.modal-stack.open .modal-backdrop { opacity: 1; }
.modal-host {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  pointer-events: none;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.modal-stack.open .modal-host { transform: translateY(0); opacity: 1; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: min(760px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.1rem;
  pointer-events: auto;
}
.modal-card.modal-card-wide { width: min(980px, 100%); }
.modal-card .modal-section {
  margin: 1rem 0 0.5rem;
  font-size: 0.92rem;
  color: var(--brand-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.2rem;
  border-bottom: 1px dashed var(--border);
}
.modal-card .modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
body.modal-open { overflow: hidden; }


/* === 08_messaging.css === */
/* =================== BELL + MESSAGING =================== */
.bell {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--brand-dark);
  text-decoration: none;
  font-size: 1.05rem;
}
.bell:hover { border-color: var(--brand-soft); color: var(--accent-ink); }
.bell .bell-badge {
  position: absolute;
  top: -6px; inset-inline-end: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--bad); color: #fff;
  border-radius: 999px;
  font-size: 0.7rem; line-height: 18px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* Message thread view */
.message-thread { display: flex; flex-direction: column; gap: 0.75rem; }
.msg-post {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  background: var(--panel);
  max-width: 80ch;
}
.msg-post.msg-platform {
  background: var(--brand-tint);
  border-color: var(--brand-soft);
  align-self: flex-end;
}
.msg-post.msg-org {
  background: var(--panel);
  align-self: flex-start;
}
.msg-post .msg-head { margin-bottom: 0.35rem; }
.msg-post .msg-body {
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-attachments { margin-top: 0.55rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ink);
}
.attachment-chip:hover { border-color: var(--brand-soft); }

.notif-item.notif-unread {
  background: var(--brand-tint);
  border-inline-start: 3px solid var(--brand);
}


/* === 09_chat.css === */
/* =================== FLOATING AQARI CHAT (Phase 4) =================== */
/* Fixed to the trailing corner — right in LTR, left in RTL automatically. */
.malek-fab {
  position: fixed;
  bottom: 22px;
  inset-inline-end: 22px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(180, 80, 50, 0.35);
  transition: transform 120ms ease, box-shadow 180ms ease;
}
.malek-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(180, 80, 50, 0.45); }
.malek-fab-icon {
  font-size: 1.2rem; line-height: 1;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}
.malek-fab-label { letter-spacing: 0.02em; }

@media (max-width: 560px) {
  .malek-fab-label { display: none; }
  .malek-fab { padding: 0.85rem; width: 52px; height: 52px; justify-content: center; }
  .malek-fab-icon { font-size: 1.4rem; }
}

/* Popup chat panel */
.malek-popup {
  position: fixed;
  bottom: 88px;
  inset-inline-end: 22px;
  z-index: 901;
  width: min(380px, calc(100vw - 44px));
  max-height: min(600px, calc(100vh - 140px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(20, 14, 10, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aqari-rise 180ms ease;
}
@keyframes aqari-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.malek-popup[hidden] { display: none; }

.malek-popup-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--brand-tint);
  border-bottom: 1px solid var(--border);
}
.malek-popup-head strong { color: var(--brand-dark); letter-spacing: 0.02em; }

.malek-popup-thread {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  min-height: 180px;
}

.malek-popup-form {
  display: flex; gap: 0.4rem;
  padding: 0.6rem;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.malek-popup-form textarea {
  flex: 1;
  resize: none;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit; font-size: 0.9rem;
}
.malek-popup-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
}
.malek-popup-form .btn { align-self: flex-end; }

/* Popup bubbles are a bit tighter than the /insights page */
.malek-popup-thread .ai-msg { font-size: 0.88rem; padding: 0.5rem 0.75rem; max-width: 100%; }
.malek-popup-thread .ai-msg.ai-user { align-self: flex-end; }
.malek-popup-thread .ai-msg.ai-assistant { align-self: flex-start; background: var(--soft); }


/* === 10_insights.css === */
/* =================== AI INSIGHTS =================== */
.ai-chip {
  background: var(--brand-tint);
  border: 1px solid var(--brand-soft);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  color: var(--brand-dark);
}
.ai-panel {
  display: flex; flex-direction: column; gap: 0.75rem;
  min-height: 360px;
}
.ai-thread {
  display: flex; flex-direction: column; gap: 0.5rem;
  max-height: 58vh;
  overflow-y: auto;
  padding-inline-end: 0.25rem;
}
.ai-hint { padding: 0.75rem; }
.ai-sample {
  color: var(--accent-ink);
  text-decoration: underline dotted;
  cursor: pointer;
}
.ai-msg {
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  max-width: 90ch;
  line-height: 1.45;
}
.ai-msg.ai-user {
  align-self: flex-end;
  background: var(--brand-tint);
  border: 1px solid var(--brand-soft);
  color: var(--accent-ink);
}
.ai-msg.ai-assistant {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.ai-msg.ai-status {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}
.ai-msg.ai-thinking::after {
  content: "";
  display: inline-block;
  width: 0.75rem; height: 0.75rem;
  margin-inline-start: 0.35rem;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-msg.ai-error {
  color: var(--bad); font-style: normal;
}
.ai-meta { align-self: flex-start; margin-left: 0.9rem; }
.ai-form {
  display: flex; gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
.ai-form textarea {
  flex: 1; resize: vertical;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit; font-size: 0.95rem;
}
.ai-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
}


/* === 11_misc.css === */
/* =================== PRIVACY =================== */
body.privacy .chart-panel .chart-wrap {
  filter: blur(8px) saturate(0.4); user-select: none; pointer-events: none; position: relative;
}
body.privacy .chart-panel .chart-wrap::after {
  content: "****"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; letter-spacing: 0.3em;
  color: var(--brand-dark); font-weight: 700; pointer-events: none;
}
html.privacy-pending .kpi .value,
html.privacy-pending td.num, html.privacy-pending th.num,
html.privacy-pending .amount, html.privacy-pending .cal-pay-amt,
html.privacy-pending dl.kv dd { visibility: hidden; }

/* =================== PROPERTY SELECTOR =================== */
.property-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.88rem;
  color: var(--ink);
  max-width: 240px;
}

/* =================== REPORTS =================== */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.report-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.report-card h2 { margin: 0 0 0.25rem; color: var(--brand-dark); }
.report-card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }

.report-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap;
  padding: 1rem 0; margin-bottom: 1rem;
  border-bottom: 2px solid var(--brand);
}
.report-header .logo-group { display: flex; align-items: center; gap: 0.75rem; }
.report-header .logo-group img { height: 40px; }
.report-header h1 { margin: 0; }
.report-header .report-meta { color: var(--muted); font-size: 0.85rem; text-align: end; }

/* =================== UPCOMING CARD (legacy, kept for drawer) =================== */
.upcoming-card {
  display: grid; grid-template-columns: 1fr auto;
  gap: 1rem; align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-tint) 0%, var(--panel-2) 100%);
}

/* =================== PANEL HEADER / MISC =================== */
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.panel-header h2 { margin: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }


/* =================== BULK IMPORT (admin/bulk) =================== */
/* Numbered step badge sitting next to a section heading. */
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.55rem; height: 1.55rem; margin-inline-end: 0.5rem;
  background: var(--brand); color: #fff;
  border-radius: 50%;
  font-size: 0.85rem; font-weight: 600;
}

.bulk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .bulk-grid { grid-template-columns: 1fr; }
}

.summary-aside { position: sticky; top: 1rem; }
.summary-card  { padding: 1rem 1.25rem; }
.summary-empty { padding: 0.75rem 0; }
.summary-kv { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 0.75rem; margin: 0.5rem 0 0; }
.summary-kv dt { color: var(--muted); font-size: 0.85rem; }
.summary-kv dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }

.action-row {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 1rem; padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.action-row .btn.primary[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---- Dropzone ---- */
.dropzone {
  display: flex; align-items: center; justify-content: center;
  min-height: 140px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.dropzone:hover, .dropzone:focus { border-color: var(--brand); background: var(--brand-tint); outline: none; }
.dropzone.dz-hover { border-color: var(--brand); background: var(--brand-tint); }
.dropzone.dz-error { border-color: var(--bad); background: rgba(220, 60, 60, 0.05); }
.dropzone.dz-ok    { border-color: var(--ok);  background: rgba(60, 160, 90, 0.05); }
.dz-empty {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  color: var(--muted); padding: 1rem; text-align: center;
}
.dz-empty strong { color: var(--ink); }

.file-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 0.65rem; padding: 0.4rem 0.65rem;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
}
.file-chip .fc-name { font-weight: 500; }
.file-chip .fc-x {
  background: transparent; border: 0; color: var(--muted);
  font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 0.15rem;
}
.file-chip .fc-x:hover { color: var(--ink); }

/* ---- Sheet tabs (connected to the table — no border between active tab
       and the table top edge). ---- */
.preview-panel { margin-top: 1rem; overflow: hidden; }
.sheet-tabs {
  display: flex; gap: 0; padding: 0.5rem 0.5rem 0;
  background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.sheet-tab {
  position: relative;
  background: transparent; border: 1px solid transparent; border-bottom: 0;
  padding: 0.5rem 0.85rem;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  font-size: 0.92rem; font-weight: 500; color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.sheet-tab:hover { color: var(--ink); }
.sheet-tab.active {
  background: var(--panel); color: var(--ink);
  border-color: var(--border);
  border-bottom-color: var(--panel);
}
.sheet-tab .tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.4rem; height: 1.25rem; padding: 0 0.4rem;
  background: var(--border); color: var(--ink);
  border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sheet-tab.active .tab-badge { background: var(--brand-tint); color: var(--brand-dark); }

.sheet-table-wrap { overflow-x: auto; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sheet-table th, .sheet-table td {
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sheet-table th { background: var(--panel); font-weight: 600; }

/* ---- Inline alerts (validation rows) ---- */
.row-alert {
  padding: 0.5rem 0.75rem; margin-top: 0.45rem;
  border-radius: 6px; border-inline-start: 3px solid var(--muted);
  background: var(--panel-2); font-size: 0.88rem;
}
.row-alert-warning { border-inline-start-color: var(--warn); background: rgba(214, 158, 46, 0.08); }
.row-alert-error   { border-inline-start-color: var(--bad);  background: rgba(220, 60, 60, 0.08); }
.row-alert-info    { border-inline-start-color: var(--ok);   background: rgba(60, 160, 90, 0.08); }
.row-alert strong  { font-weight: 600; }


/* =================== CAPABILITY CARDS (Platform Team page) =================== */
.caps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.cap-card {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.65rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.cap-card:hover { border-color: var(--brand-soft); background: var(--panel-2); }
.cap-card.is-active {
  border-color: var(--brand);
  background: var(--brand-tint);
}
.cap-card input[type="checkbox"] {
  margin-top: 0.2rem; flex: 0 0 auto;
}
.cap-card .cap-body { flex: 1 1 auto; min-width: 0; }
.cap-card .cap-label { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.cap-card .cap-desc  { margin-top: 0.15rem; line-height: 1.4; }
.cap-card .cap-key {
  display: inline-block; margin-top: 0.3rem;
  font-size: 0.72rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted); opacity: 0.7;
}
.cap-card input[type="checkbox"]:disabled + .cap-body { opacity: 0.7; }


/* =================== USER MANAGEMENT (admin/users) =================== */
.user-counter {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--ink);
}
.user-counter strong { font-variant-numeric: tabular-nums; }

.invite-method-card {
  flex: 1 1 220px;
  display: flex; gap: 0.55rem; align-items: flex-start;
  padding: 0.65rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.invite-method-card:hover { border-color: var(--brand-soft); background: var(--panel-2); }
.invite-method-card input[type="radio"] { margin-top: 0.25rem; flex: 0 0 auto; }
.invite-method-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
}


/* === 12_responsive.css === */
/* =================== RESPONSIVE =================== */
@media (max-width: 980px) {
  main { padding: 0 0.9rem 1.5rem; margin: 0.75rem auto; }
  h1 { font-size: 1.2rem; } h2 { font-size: 0.98rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-panel .chart-wrap { height: 240px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  /* Sidebar becomes off-canvas drawer */
  .app-wrap { margin-inline-start: 0; }
  /* Override the desktop `html.nav-collapsed .app-wrap { margin-inline-start:
     var(--sidebar-w-collapsed) }` rule — otherwise a user whose browser had
     the sidebar collapsed on desktop keeps a 64 px phantom gutter on the
     inline-start edge of every mobile page. */
  html.nav-collapsed .app-wrap { margin-inline-start: 0; }
  aside.sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
    z-index: 60; width: var(--sidebar-w);
  }
  html[dir="rtl"] aside.sidebar { transform: translateX(100%); }
  body.nav-open aside.sidebar { transform: translateX(0); }
  html.nav-collapsed aside.sidebar { width: var(--sidebar-w); }
  html.nav-collapsed .sidebar-nav a .label,
  html.nav-collapsed .nav-divider .label,
  html.nav-collapsed .sidebar-foot .label { display: inline; }
  html.nav-collapsed .brand-name { display: inline; }
  .nav-toggle { display: block; }
  .nav-collapse-btn { display: none; }
  /* Mobile close X button inside the sidebar-top becomes visible so
     the drawer can be dismissed without reopening the topbar hamburger. */
  .nav-close-btn { display: inline-flex; }
  .topbar .today { display: none; }
  /* When the drawer is open, even the collapsed-state rules shouldn't
     hide the name + role — users need them visible inside the drawer. */
  body.nav-open .sidebar-user { flex-direction: row; padding: 0.6rem 0.75rem; align-items: center; gap: 0.55rem; }
  body.nav-open .sidebar-user .user-info { display: block; }

  /* Reports hub: stack the three cards vertically well before cards
     get squeezed to minmax's 320px minimum. */
  .report-cards { grid-template-columns: 1fr; gap: 0.75rem; }

  /* Bump the floating chat FAB up so it clears primary "Save" buttons
     at the bottom of forms on short viewports. */
  .malek-fab { bottom: 1.5rem; }
}

/* Report headers stack vertically well before phones — 720 px is roughly
   tablet-portrait, where the 3-column action row next to the meta block
   starts to crowd. */
@media (max-width: 720px) {
  .report-header {
    flex-direction: column;
    align-items: stretch;
  }
  .report-header .report-meta {
    text-align: start;
  }
  .report-header .report-meta > div[style*="justify-content:flex-end"] {
    justify-content: flex-start !important;
  }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 1.15rem; }
  .panel { padding: 0.85rem; }
  table { font-size: 0.85rem; }
  th, td { padding: 0.4rem 0.4rem; }
  .user-chip { padding: 0.15rem 0.45rem; }
  .user-chip .user-name { font-size: 0.8rem; }
  .upcoming-card { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; gap: 0.1rem 0; }
  dl.kv dt { margin-top: 0.4rem; font-size: 0.8rem; }

  /* ---- Topbar compact mode (user-chip + logout now live in the
     sidebar, so the row only carries the nav toggle + property select
     + bells + today). ---- */
  .topbar { gap: 0.5rem; padding: 0.45rem 0.7rem; }
  .topbar .topbar-right {
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .topbar .property-select {
    max-width: 55vw;
    min-width: 0;
    font-size: 0.85rem;
  }
  /* Shrink the bell buttons so two bells + a property dropdown don't
     collide on narrow viewports. */
  .bell { width: 30px; height: 30px; font-size: 0.95rem; }
  .bell .bell-icon svg { width: 15px; height: 15px; }
  .bell .bell-badge { min-width: 15px; height: 15px; font-size: 0.65rem; top: -4px; }

  /* ---- Forms: drop the 180 px min-width on narrow screens so fields
     sit full-width instead of awkwardly wrapping at half-column. ---- */
  form .field { min-width: 0; flex-basis: 100%; }
  /* Inputs + selects slightly larger tap targets. */
  form input, form select, form textarea { font-size: 1rem; padding: 0.55rem 0.65rem; }
  .btn { padding: 0.5rem 0.85rem; }

  /* ---- Drawer: full viewport edge-to-edge ---- */
  .drawer-panel { width: 100vw; }

  /* Report-header action buttons wrap with generous touch target. */
  .report-header .report-meta .btn { padding: 0.45rem 0.7rem; font-size: 0.85rem; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  table.calendar td { height: 80px; }
  .cal-pay-client { max-width: 100%; }
  .cal-pay-amt { display: none; }
}


/* === 13_print.css === */
/* =================== PRINT =================== */
@media print {
  /* --- Page setup --------------------------------------------------- */
  @page {
    size: A4;
    margin: 1.4cm 1.2cm 1.6cm 1.2cm;
  }
  @page :first {
    margin-top: 1.0cm;
  }

  /* --- Hide chrome -------------------------------------------------- */
  aside.sidebar, .topbar, .drawer, .btn, button, .nav-toggle,
  .chart-filter, #tenants-search, #contracts-search, .search-bar input,
  form.inline, .cal-controls, .slicers, .property-select, .lang-switch-v,
  .user-chip, .privacy-btn, .sidebar-foot, .sidebar-top, .flash-stack,
  .ai-analysis .small.muted, nav, footer, .breadcrumbs,
  .alert.alert-info, .alert.alert-error { display: none !important; }
  .app-wrap { margin: 0 !important; }
  html, body { background: #fff !important; color: #1d1510 !important; }
  body { font-family: 'Helvetica Neue', Arial, sans-serif !important;
         font-size: 9.5pt; line-height: 1.45; }
  main { max-width: 100% !important; margin: 0 !important;
         padding: 0 !important; }

  /* --- Report header / letterhead ---------------------------------- */
  .report-header {
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 0 0.6cm !important;
    position: relative;
    align-items: flex-start !important;
  }
  .report-header::before {
    content: "";
    position: absolute; left: 0; right: 0; top: -0.3cm;
    height: 0.18cm; background: #b45032;
    border-radius: 1px;
  }
  .report-header::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: -0.25cm;
    height: 1px; background: #1d1510;
  }
  .report-header { padding-top: 0.5cm !important; }
  .report-header .logo-group img {
    height: 1.0cm !important; width: auto !important;
  }
  .report-header h1 {
    font-size: 18pt !important; font-weight: 700;
    letter-spacing: 0.01em;
    color: #8a3c25 !important;
  }
  .report-header .report-meta {
    color: #4a3d34 !important;
    font-size: 8.5pt !important;
    line-height: 1.55;
  }

  /* --- Panels ------------------------------------------------------- */
  .panel {
    box-shadow: none !important;
    border: 1px solid #d8cdc7 !important;
    border-radius: 4px !important;
    background: #fff !important;
    page-break-inside: avoid;
    margin-bottom: 0.4cm !important;
    padding: 0.45cm 0.55cm !important;
  }
  .panel h2 {
    font-size: 11pt !important;
    margin: 0 0 0.25cm !important;
    color: #8a3c25 !important;
    border-bottom: 0.5pt solid #e3d4d1;
    padding-bottom: 0.15cm;
    letter-spacing: 0.01em;
  }
  .panel h3 { font-size: 10pt !important; margin: 0.3cm 0 0.15cm !important; }

  /* --- KPI grid ----------------------------------------------------- */
  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.25cm !important;
    margin-bottom: 0.4cm;
  }
  .kpi {
    border: 1px solid #d8cdc7 !important;
    border-radius: 3px !important;
    background: #fff !important;
    padding: 0.25cm 0.3cm !important;
    box-shadow: none !important;
    transform: none !important;
  }
  .kpi .label {
    font-size: 7.5pt !important;
    color: #7a6d6d !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .kpi .value {
    font-size: 12pt !important;
    color: #1d1510 !important;
    font-weight: 600;
    margin-top: 0.08cm;
  }
  .kpi.bad .value { color: #b03a2e !important; }
  .kpi.ok .value { color: #1d6a2c !important; }
  .kpi.warn .value { color: #b06a16 !important; }

  /* --- Charts ------------------------------------------------------- */
  .charts-grid { grid-template-columns: 1fr 1fr !important; gap: 0.3cm; }
  .chart-panel { min-height: auto !important; }
  .chart-wrap { height: 5.5cm !important; }
  canvas { max-height: 5.5cm !important; }

  /* --- Tables ------------------------------------------------------- */
  table {
    font-size: 8.5pt !important;
    border-collapse: collapse !important;
    width: 100%;
  }
  thead { display: table-header-group; }
  thead th {
    background: #fbf3ee !important;
    color: #8a3c25 !important;
    border-bottom: 1pt solid #b45032 !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 7.5pt !important;
    letter-spacing: 0.05em;
    padding: 0.18cm 0.2cm !important;
  }
  tbody td {
    padding: 0.16cm 0.2cm !important;
    border-bottom: 0.5pt solid #efe6e2 !important;
  }
  tr { page-break-inside: avoid; }

  /* --- AI block ----------------------------------------------------- */
  .ai-analysis {
    background: #fbf3ee !important;
    border-color: #b45032 !important;
  }

  /* --- Links neutralized -------------------------------------------- */
  a { color: #1d1510 !important; text-decoration: none !important; }
  a[href]::after { content: ""; }

  /* --- Status pills lose colored backgrounds when they'd misprint --- */
  .status { border: 0.5pt solid currentColor; background: transparent !important; }

  /* --- Page footer -------------------------------------------------- */
  .panel:last-of-type { margin-bottom: 0 !important; }
}
