/* =====================================================================
   DJAYA ENTERPRISE THEME — djaya-theme.css
   Canonical, framework-agnostic cross-dashboard design system.

   Consumed by: console.atmadja.id, incident.atmadja.id, CRM, Billing,
   Support, and any future DJAYA dashboard — regardless of backend stack
   (PHP, Node, Laravel, etc). Pure CSS, zero build step, zero JS dependency.

   Reference implementation: this file is the single source of truth.
   Other products must vendor an unmodified copy of this file (or link it
   from a shared static host) and add product-specific rules in a SEPARATE
   stylesheet loaded after this one. Do not edit design tokens locally —
   propose changes here so every dashboard stays consistent.

   Companion spec: documents/DJAYA-ENTERPRISE-UI-UX-SYSTEM-SPECIFICATION-v1.0.md
   Version: 1.0.0
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  /* --- Brand palette --- */
  --djaya-olive: #5C6B3F;
  --djaya-olive-dark: #4E5B35;
  --djaya-olive-mid: #7A8A5A;
  --djaya-gold: #F2CB4E;
  --djaya-brick: #C8402F;

  --djaya-cream: #F6F0E6;
  --djaya-peach: #F2E6D5;
  --djaya-khaki: #E9E3B9;
  --djaya-sand: #C9C69A;
  --djaya-white: #FFFFFF;
  --djaya-row-alt: #FBF8F2;
  --djaya-row-hi: #FBF0C8;
  --djaya-border: #EDE7D8;

  --djaya-ink: #2B1B14;
  --djaya-charcoal: #3D3D3A;
  --djaya-muted: #8A8B78;

  /* --- Semantic aliases (use these in product-specific screens) --- */
  --color-bg: var(--djaya-cream);
  --color-surface: var(--djaya-white);
  --color-primary: var(--djaya-olive);
  --color-primary-hover: var(--djaya-olive-dark);
  --color-accent: var(--djaya-brick);
  --color-brand: var(--djaya-gold);
  --color-text: var(--djaya-ink);
  --color-text-muted: var(--djaya-muted);
  --color-border: var(--djaya-border);

  --radius-card: 0.75rem;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.08);

  --sidebar-width: 15rem;
  --footer-height: 2.75rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--djaya-cream) 0%, #f4f0e7 100%);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--djaya-olive); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--djaya-olive); font-weight: 700; margin: 0 0 0.5rem; }
h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }

.muted { color: var(--color-text-muted); }
.kicker {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.25em;
  color: var(--djaya-brick); font-weight: 700;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--djaya-olive);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}

/* --- Logo / brand placement (use in sidebar header AND login screen) ---
   Canonical structure:
     <div class="logo-badge">
       <div class="mark">DJ</div>          <!-- or <img class="djaya-logo-img"> -->
       <div>
         <div class="brand-name">DJAYA</div>
         <div class="brand-sub">PRODUCT NAME</div>
       </div>
     </div>
*/
.sidebar .logo-badge {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--djaya-olive-mid);
  margin-bottom: 0.75rem;
}
.sidebar .logo-badge .mark {
  width: 2.2rem; height: 2.6rem; border-radius: 0.6rem;
  background: var(--djaya-olive-dark);
  display: grid; place-items: center; font-weight: 700; color: var(--djaya-gold);
}
.sidebar .brand-name { font-weight: 700; font-size: 0.95rem; }
.sidebar .brand-sub { font-size: 0.7rem; color: var(--djaya-khaki); letter-spacing: 0.08em; }

/* Generic logo utility classes — usable outside the sidebar (topbar, PDF, email) */
.djaya-logo-img { display: block; height: 2.6rem; width: auto; object-fit: contain; }
.djaya-logo-mark {
  width: 2.2rem; height: 2.6rem; border-radius: 0.6rem;
  background: var(--djaya-olive-dark); color: var(--djaya-gold);
  display: grid; place-items: center; font-weight: 800; flex-shrink: 0;
}

.nav-section { padding: 0.5rem 0.75rem; }
.nav-section .nav-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--djaya-sand); padding: 0.75rem 0.75rem 0.35rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem; border-radius: 0.5rem;
  color: var(--djaya-khaki); font-weight: 600; font-size: 0.9rem;
}
.nav-link:hover { background: var(--djaya-olive-dark); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--djaya-olive-dark); color: #fff; box-shadow: inset 3px 0 0 var(--djaya-gold); }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar-context { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.mobile-menu-toggle { display: none; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem;
}
/* Avatar + name doubles as the "Profil Saya" entry point — no separate
   sidebar menu item for it (see spec §4.1 topbar rules). */
.user-chip-link {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--color-text); border-radius: var(--radius-pill);
  padding: 0.15rem 0.5rem 0.15rem 0.15rem; margin: -0.15rem 0 -0.15rem -0.15rem;
  transition: background 0.15s ease;
}
.user-chip-link:hover { background: var(--djaya-peach); text-decoration: none; }
.avatar-circle {
  width: 2rem; height: 2rem; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--djaya-olive) 0%, var(--djaya-olive-dark) 100%);
  color: var(--djaya-gold); font-weight: 800; font-size: 0.78rem;
  display: grid; place-items: center; text-transform: uppercase;
}

/* --- Role / admin status badge (canonical component) ---
   Usage: <span class="role-badge superadmin">SUPERADMIN</span>
   Roles map to a fixed visual so "who has elevated access" reads the same
   across every DJAYA product. Do not invent per-product role colors. */
.role-badge {
  background: var(--djaya-khaki); color: var(--djaya-olive);
  border-radius: var(--radius-pill); padding: 0.15rem 0.65rem;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
}
.role-badge.superadmin { background: var(--djaya-gold); color: var(--djaya-ink); }
.role-badge.admin { background: var(--djaya-sand); color: var(--djaya-ink); }
.role-badge.manager { background: var(--djaya-peach); color: var(--djaya-olive-dark); }
.role-badge.staff { background: var(--djaya-khaki); color: var(--djaya-olive); }
.role-badge.readonly { background: #e8e8e6; color: var(--djaya-muted); }

.content { padding: 1.5rem; flex: 1; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.35rem; flex-wrap: wrap; gap: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.section-card {
  background: var(--color-surface);
  border: 1px solid rgba(125, 124, 106, 0.12);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.section-title {
  display: flex; align-items: center; gap: 0.65rem;
  color: var(--djaya-olive); font-size: 1.05rem; font-weight: 800;
  margin: 0;
}
.section-title .mini-mark {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--djaya-gold) 0%, var(--djaya-brick) 100%);
  box-shadow: 0 0 0 4px var(--djaya-peach);
}
.muted-copy { color: var(--color-text-muted); font-size: 0.85rem; }

/* --- Cards / stats --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--color-surface);
  border: 1px solid rgba(125, 124, 106, 0.12);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); }
.card--olive { background: linear-gradient(135deg, var(--djaya-olive) 0%, var(--djaya-olive-dark) 100%); color: #fff; }
.card--olive h3, .card--olive .stat-num { color: #fff; }
.stat-num { font-size: 2.1rem; font-weight: 800; color: var(--djaya-olive); line-height: 1.1; }
.stat-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

.entity-summary {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem;
  margin-bottom: 1.25rem;
}
.entity-banner {
  background: linear-gradient(135deg, rgba(92,107,63,0.08), rgba(242,203,78,0.12));
  border: 1px solid rgba(92,107,63,0.15);
  border-radius: 1rem; padding: 1.15rem 1.2rem;
}
.entity-banner .meta-row {
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  margin-bottom: 0.7rem;
}
.meta-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--djaya-khaki); color: var(--djaya-olive);
  border-radius: var(--radius-pill); padding: 0.25rem 0.7rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.entity-banner h2 { margin: 0; font-size: 1.6rem; }
.summary-stack { display: grid; gap: 0.9rem; }
.key-value-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.85rem;
}
.key-value {
  background: var(--djaya-row-alt); border: 1px solid var(--djaya-border); border-radius: 0.75rem; padding: 0.8rem 0.85rem;
}
.key-value .label { display: block; color: var(--color-text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.2rem; }
.key-value .value { font-weight: 700; color: var(--djaya-ink); }

.inline-actions { display: flex; gap: 0.65rem; align-items: center; flex-wrap: wrap; }

.row-item {
  border: 1px solid var(--djaya-border); background: var(--djaya-row-alt);
  border-radius: 0.8rem; padding: 0.9rem; margin-bottom: 0.8rem;
}

.subtle-divider { border-top: 1px solid var(--djaya-border); margin: 0.8rem 0; }

.credential-reset-form { margin-bottom: 0.9rem; }
.credential-reset-form__row { display: flex; gap: 0.65rem; align-items: center; }
.credential-reset-form__row input { flex: 1 1 auto; min-width: 0; }
.credential-status-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.credential-status-actions .btn { min-width: 110px; justify-content: center; }

/* --- Tables --- */
.table-wrap { background: var(--color-surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; border: 1px solid rgba(125, 124, 106, 0.1); }
table { width: 100%; border-collapse: collapse; }
table thead th { background: linear-gradient(180deg, var(--djaya-olive) 0%, var(--djaya-olive-dark) 100%); color: #fff; text-align: left; padding: 0.8rem 1rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
table td, table th { border-bottom: 1px solid var(--djaya-border); padding: 0.78rem 1rem; font-size: 0.9rem; vertical-align: middle; }
table tbody tr:nth-child(even) { background: var(--djaya-row-alt); }
table tbody tr:hover { background: var(--djaya-row-hi); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border-radius: var(--radius-pill); padding: 0.62rem 1.3rem;
  font-weight: 700; font-size: 0.85rem; border: none; cursor: pointer;
  font-family: inherit; transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(0,0,0,0.08); }
.btn-primary { background: linear-gradient(135deg, var(--djaya-olive) 0%, var(--djaya-olive-dark) 100%); color: #fff; }
.btn-primary:hover { background: var(--djaya-olive-dark); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--djaya-olive); border: 1.5px solid var(--djaya-olive); }
.btn-secondary:hover { background: var(--djaya-peach); text-decoration: none; }
.btn-danger { background: linear-gradient(135deg, var(--djaya-brick) 0%, #a8332b 100%); color: #fff; }
.btn-danger:hover { opacity: 0.96; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.78rem; }
.btn-link { color: var(--djaya-brick); font-weight: 700; background: none; border: none; cursor: pointer; padding: 0; }

/* --- Forms --- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
label { font-weight: 600; font-size: 0.85rem; display: block; margin-bottom: 0.3rem; color: var(--djaya-charcoal); }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=tel], input[type=url], input[type=date], input[type=number],
select, textarea {
  width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--djaya-border);
  border-radius: 0.5rem; font-size: 0.9rem; font-family: inherit; background: #fff; color: var(--djaya-ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--djaya-olive-mid); border-color: var(--djaya-olive); }
.field { margin-bottom: 1rem; }
.checkbox-field { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-field input { width: auto; }

/* --- Badges / chips (domain status — see spec §3.1 for the semantic map) --- */
.chip { background: var(--djaya-khaki); color: var(--djaya-olive); border-radius: var(--radius-pill); padding: 0.2rem 0.75rem; font-size: 0.75rem; font-weight: 700; display: inline-block; }
.chip--active { background: #dff0d8; color: #2f6b2f; }
.chip--prospect { background: var(--djaya-khaki); color: var(--djaya-olive); }
.chip--suspended { background: #f6d9d5; color: var(--djaya-brick); }
.chip--inactive { background: #e8e8e6; color: var(--djaya-muted); }
.chip--terminated { background: #e8e8e6; color: var(--djaya-muted); }
.chip--pending { background: var(--djaya-peach); color: var(--djaya-brick); }

/* --- Alerts / flash --- */
.alert { border-radius: var(--radius-card); padding: 0.85rem 1.1rem; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #e7f2e0; color: #3a5a2a; border: 1px solid #cfe4c0; }
.alert-error { background: #fbe6e2; color: var(--djaya-brick); border: 1px solid #f0c7bd; }
.alert-info { background: var(--djaya-peach); color: var(--djaya-charcoal); border: 1px solid var(--djaya-border); }

/* --- Auth / login --- */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: var(--djaya-olive);
  background-image: radial-gradient(circle at 15% 10%, var(--djaya-olive-dark) 0%, transparent 45%),
                     radial-gradient(circle at 85% 90%, var(--djaya-olive-dark) 0%, transparent 45%);
}
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 2rem; }
.auth-logo { width: 3.2rem; height: 4.1rem; border-radius: 0.85rem; background: var(--djaya-olive); display: grid; place-items: center; margin: 0 auto 1rem; color: var(--djaya-gold); font-weight: 700; font-size: 1.4rem; }

/* --- Auth / login (premium split layout) --- */
.auth-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--djaya-cream);
}
.auth-aside {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(160deg, var(--djaya-olive) 0%, var(--djaya-olive-dark) 55%, #333e1e 100%);
  padding: 3rem 3.25rem; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside::before, .auth-aside::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.auth-aside::before {
  width: 22rem; height: 22rem; top: -8rem; right: -7rem;
  background: radial-gradient(circle, rgba(242, 203, 78, 0.22) 0%, transparent 70%);
}
.auth-aside::after {
  width: 18rem; height: 18rem; bottom: -7rem; left: -6rem;
  background: radial-gradient(circle, rgba(200, 64, 47, 0.2) 0%, transparent 70%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 0.75rem; }
.auth-brand .mark {
  width: 2.6rem; height: 3.15rem; border-radius: 0.7rem; background: var(--djaya-olive-dark);
  display: grid; place-items: center; font-weight: 800; color: var(--djaya-gold); font-size: 1.05rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset;
}
.auth-brand .brand-name { font-weight: 800; font-size: 1rem; letter-spacing: 0.02em; }
.auth-brand .brand-sub { font-size: 0.68rem; color: var(--djaya-khaki); letter-spacing: 0.12em; }
.auth-headline { margin: 2.5rem 0; }
.auth-headline .kicker { color: var(--djaya-gold); }
.auth-headline h1 { color: #fff; font-size: 2.1rem; margin: 0.6rem 0 0.75rem; max-width: 22rem; }
.auth-headline p { color: var(--djaya-khaki); max-width: 24rem; font-size: 0.92rem; }
.auth-feature-list { display: grid; gap: 0.9rem; margin-bottom: 1rem; }
.auth-feature { display: flex; align-items: flex-start; gap: 0.7rem; font-size: 0.85rem; color: var(--djaya-khaki); }
.auth-feature .dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-top: 0.4rem; flex-shrink: 0;
  background: var(--djaya-gold);
}
.auth-foot-note { font-size: 0.72rem; color: rgba(255,255,255,0.55); letter-spacing: 0.02em; }

.auth-form-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; background: var(--djaya-cream); }
.auth-panel-card { width: 100%; max-width: 380px; }
.auth-panel-card .auth-logo-sm {
  width: 3rem; height: 3.7rem; border-radius: 0.75rem; background: var(--djaya-olive);
  display: grid; place-items: center; margin-bottom: 1.1rem; color: var(--djaya-gold); font-weight: 800; font-size: 1.25rem;
}
.auth-panel-card h1 { font-size: 1.55rem; margin-bottom: 0.3rem; }
.auth-panel-card .auth-subtitle { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 1.6rem; }
.auth-input-icon { position: relative; }
.auth-input-icon input { padding-left: 2.4rem; }
.auth-input-icon .icon {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted); font-size: 0.95rem; pointer-events: none;
}
.auth-submit { width: 100%; justify-content: center; margin-top: 0.4rem; padding: 0.7rem 1.3rem; font-size: 0.9rem; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-form-panel { min-height: 100vh; }
}

.tabs { display: flex; gap: 0.35rem; margin-bottom: 1rem; border-bottom: 1px solid var(--color-border); }
.tab-link { padding: 0.6rem 1rem; font-weight: 700; color: var(--color-text-muted); border-bottom: 2px solid transparent; }
.tab-link.active { color: var(--djaya-olive); border-color: var(--djaya-olive); }

.pagination { display: flex; gap: 0.35rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 0.35rem 0.7rem; border-radius: 0.4rem; font-size: 0.85rem; border: 1px solid var(--color-border); }
.pagination a:hover { background: var(--djaya-peach); text-decoration: none; }
.pagination .current { background: var(--djaya-olive); color: #fff; border-color: var(--djaya-olive); }

.subtable { margin-top: 0.75rem; }
.empty-state { padding: 2.5rem; text-align: center; color: var(--color-text-muted); }

/* --- App Footer (canonical placement: end of .content, scrolls with page) ---
   Single-line format, always: {Dashboard Name} {Version} © {year} {Company Name} - {Tagline}
   Usage:
     <footer class="app-footer">
       <p class="app-footer-line">
         <strong>Master Pelanggan</strong> <span class="app-footer-version">v1.2.0</span>
         &copy; 2026 PT. Atmadja Jaya Utama
         <span class="app-footer-sep">-</span> Connecting Intelligence
       </p>
     </footer>
   Exactly one footer line per dashboard — do not split brand and legal text
   into separate left/right blocks; that reads as multiple competing footers.
  The footer contains no separate brand mark or brand prefix; the dashboard
  name is rendered directly as the first text in the line. */
.app-footer {
  display: flex; align-items: center; gap: 0.65rem;
  margin-top: 2rem; padding: 1rem 0 0.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem; color: var(--color-text-muted);
}
.app-footer-line { margin: 0; line-height: 1.5; }
.app-footer-line strong { color: var(--djaya-olive); font-weight: 700; }
.app-footer-version { color: var(--djaya-muted); font-variant-numeric: tabular-nums; }
.app-footer-sep { color: var(--djaya-sand); margin: 0 0.15rem; }

/* --- Responsive dashboard shell --- */
@media (max-width: 900px) {
  :root { --sidebar-width: 17rem; }
  body { overflow-x: hidden; }
  .app-shell { display: block; min-height: 100vh; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    width: var(--sidebar-width); max-width: 86vw;
    overflow-y: auto; transform: translateX(-105%);
    transition: transform 0.2s ease; box-shadow: 10px 0 30px rgba(43, 27, 20, 0.18);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim {
    display: block; position: fixed; inset: 0; z-index: 20; border: 0;
    background: rgba(43, 27, 20, 0.42); opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar.is-open + .sidebar-scrim { opacity: 1; pointer-events: auto; }
  body.mobile-nav-open { overflow: hidden; }
  .main { width: 100%; min-width: 0; }
  .topbar {
    min-height: 3.75rem; padding: 0.7rem 1rem; gap: 0.75rem;
  }
  .mobile-menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.5rem; min-height: 2.5rem; padding: 0 0.65rem;
    border: 1px solid var(--djaya-border); border-radius: 0.5rem;
    background: var(--djaya-white); color: var(--djaya-olive); font: 700 0.78rem/1 inherit;
    cursor: pointer;
  }
  .topbar > .user-chip { min-width: 0; gap: 0.4rem; }
  .topbar .user-chip-link span:last-child { display: none; }
  .topbar .role-badge { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn { padding: 0.45rem 0.75rem; }
  .content { padding: 1rem; min-width: 0; }
  .page-header { align-items: flex-start; margin-bottom: 1rem; }
  h1 { font-size: 1.55rem; line-height: 1.25; overflow-wrap: anywhere; }
  h2 { font-size: 1.25rem; }
  .page-header .btn { width: 100%; justify-content: center; }
  .section-card, .card { padding: 1rem; margin-bottom: 1rem; }
  .section-head { align-items: flex-start; }
  .section-title { min-width: 0; }
  .muted-copy { width: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0.2rem 0.75rem; }
  .form-grid [style*="grid-column"] { grid-column: auto !important; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .stat-num { font-size: 1.65rem; }
  .entity-summary { grid-template-columns: minmax(0, 1fr); }
  .key-value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { overflow-x: auto; margin-right: -1rem; padding-right: 1rem; scrollbar-width: thin; }
  .tab-link { flex: 0 0 auto; white-space: nowrap; padding: 0.6rem 0.75rem; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 680px; }
  .table-wrap table { width: max-content; min-width: 100%; }
  .inline-actions { align-items: stretch; }
  .inline-actions .btn { justify-content: center; }
  .report-customer-header { align-items: flex-start; }
  .report-customer-title { flex-wrap: wrap; }
  .auth-aside { display: none; }
  .auth-page { grid-template-columns: 1fr; }
  .app-footer { align-items: flex-start; }
}

@media (max-width: 520px) {
  .content { padding: 0.75rem; }
  .topbar { padding: 0.6rem 0.75rem; }
  .topbar-context > strong { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .avatar-circle { width: 1.8rem; height: 1.8rem; }
  .topbar .role-badge { display: none; }
  .topbar .btn { font-size: 0.75rem; }
  .stat-grid, .key-value-grid { grid-template-columns: minmax(0, 1fr); }
  .card--olive { grid-column: 1 / -1; }
  .page-header .inline-actions { width: 100%; }
  .page-header .inline-actions .btn { flex: 1 1 100%; }
  .section-card { border-radius: 0.65rem; }
  .btn { min-height: 2.5rem; }
  .row-item { padding: 0.75rem; }
}

/* --- Typeahead / search picker (avoids loading full record lists) --- */
.customer-search-wrap { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1px solid var(--djaya-border); border-radius: 0.6rem;
  box-shadow: var(--shadow-card); max-height: 260px; overflow-y: auto;
}
.search-result-item { padding: 0.6rem 0.85rem; font-size: 0.88rem; cursor: pointer; border-bottom: 1px solid var(--djaya-border); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--djaya-row-hi); }
.search-result-empty { padding: 0.6rem 0.85rem; font-size: 0.85rem; color: var(--color-text-muted); }
.locked-customer-chip {
  display: inline-flex; align-items: center; gap: 0.75rem;
  background: var(--djaya-peach); border: 1px solid var(--djaya-border); border-radius: var(--radius-pill);
  padding: 0.5rem 0.5rem 0.5rem 0.9rem; font-weight: 700; color: var(--djaya-olive); font-size: 0.88rem;
}

/* --- Logo asset preview (company profile / settings screens) --- */
.logo-preview-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--djaya-row-alt); border: 1px solid var(--djaya-border);
  border-radius: 0.75rem; padding: 0.85rem; margin-top: 0.4rem;
}
.logo-preview-img-wrap {
  width: 4.5rem; height: 4.5rem; border-radius: 0.6rem; background: #fff;
  border: 1px solid var(--djaya-border); display: grid; place-items: center;
  padding: 0.4rem; flex-shrink: 0; overflow: hidden;
}
.logo-preview-img-wrap img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}

/* --- Governance & report list styles --- */
.report-customer-block {
  background: var(--color-surface);
  border: 1px solid rgba(125, 124, 106, 0.15);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.report-customer-header {
  background: linear-gradient(135deg, rgba(92,107,63,0.06), rgba(242,203,78,0.08));
  border-bottom: 1px solid var(--djaya-border);
  padding: 0.9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
}
.report-customer-title {
  display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.05rem;
}
.report-customer-meta {
  display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; flex-wrap: wrap;
}

/* --- Document Print / PDF layout (official reports, RCA, invoices, etc.) --- */
.print-only-doc { display: none !important; }

@media print {
  @page {
    size: A4 portrait;
    margin: 1.2cm;
  }
  body, html {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt !important;
    font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  }
  .sidebar, .topbar, .page-header, .stat-grid, .section-card, .report-customer-block, .empty-state, .pagination, button, a.btn, .app-footer {
    display: none !important;
  }
  .app-shell, .main, .content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .print-only-doc {
    display: block !important;
  }
  .pdf-kop {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding-bottom: 0.85rem;
    margin-bottom: 0.75rem;
    border-bottom: 3px double #2B1B14;
  }
  .pdf-kop-left {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex: 1;
  }
  .pdf-logo-img {
    height: 4.8rem !important;
    width: auto !important;
    max-width: 5.5rem !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
  }
  .pdf-mark {
    width: 4.2rem;
    height: 4.8rem;
    border-radius: 0.5rem;
    background: #4E5B35;
    color: #F2CB4E;
    font-weight: 800;
    font-size: 1.8rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }
  .pdf-company-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .pdf-company {
    font-weight: 800;
    font-size: 1.3rem;
    color: #2B1B14;
    letter-spacing: 0.02em;
    line-height: 1.15;
  }
  .pdf-tagline {
    font-size: 0.84rem;
    font-weight: 700;
    color: #4E5B35;
    margin-top: 0.15rem;
  }
  .pdf-address {
    font-size: 0.74rem;
    color: #444;
    margin-top: 0.25rem;
    line-height: 1.35;
    max-width: 26rem;
  }
  .pdf-contact {
    font-size: 0.72rem;
    color: #555;
    margin-top: 0.15rem;
  }
  .pdf-kop-meta {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-left: 1rem;
    border-left: 1px solid #ddd;
  }
  .pdf-kop-meta table {
    font-size: 0.78rem;
    border-collapse: collapse;
  }
  .pdf-kop-meta td {
    padding: 0.15rem 0.35rem;
    border: none !important;
    vertical-align: top;
  }
  .pdf-kop-meta .meta-label {
    font-weight: 700;
    color: #333;
    white-space: nowrap;
  }
  .pdf-kop-meta .meta-val {
    color: #111;
  }
  .pdf-doc-title {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 800;
    margin: 1.2rem 0 1rem;
    color: #4E5B35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .pdf-section-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4E5B35;
    margin: 1rem 0 0.4rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #ccc;
  }
  .pdf-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.2rem;
  }
  .pdf-summary-table th, .pdf-summary-table td {
    border: 1px solid #bbb;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
    text-align: center;
  }
  .pdf-summary-table th {
    background: #f4f4f4 !important;
    font-weight: 700;
  }
  .pdf-customer-box {
    margin-bottom: 1rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    page-break-inside: avoid;
  }
  .pdf-customer-header {
    background: #f8f8f6 !important;
    padding: 0.45rem 0.75rem;
    font-size: 0.88rem;
    border-bottom: 1px solid #bbb;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .pdf-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid #ccc;
    background: #fff;
  }
  .pdf-service-table {
    width: 100%;
    border-collapse: collapse;
  }
  .pdf-service-table th, .pdf-service-table td {
    border: 1px solid #e0e0e0;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    text-align: left;
  }
  .pdf-service-table th {
    background: #fafafa !important;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
  }
  .pdf-sign-grid {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    page-break-inside: avoid;
  }
  .pdf-sign-box {
    width: 30%;
    text-align: center;
    font-size: 0.82rem;
  }
  .pdf-sign-space {
    height: 3.5rem;
  }
  .pdf-footer-note {
    margin-top: 1.8rem;
    padding-top: 0.5rem;
    border-top: 1px solid #ddd;
    font-size: 0.7rem;
    color: #666;
    text-align: center;
  }
}
