/* ================================================================
   BYN SFA — Theme
   Each menu section carries its own accent (--accent) inherited
   from config/menu.php. Hover, active, and breadcrumbs all use it.
   ================================================================ */

:root {
  --bg: #F8FAFC;
  --surface: #ffffff;
  --line: #E5E7EB;
  --text: #0F172A;
  --text-2: #475569;
  --muted: #94A3B8;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow-md: 0 4px 16px rgb(15 23 42 / 0.08);
  --radius: 10px;

  /* Default accent — overridden per section */
  --accent: #7C3AED;
  --accent-soft: color-mix(in oklab, var(--accent) 12%, white);
  --accent-line: color-mix(in oklab, var(--accent) 30%, white);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

.byn-app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }

/* SIDEBAR -------------------------------------------------------- */
.byn-sidebar {
  background: linear-gradient(180deg, #0B1220 0%, #111827 100%);
  color: #E5E7EB;
  padding: 20px 14px;
  overflow-y: auto;
  position: sticky; top: 0; height: 100vh;
}
.byn-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.byn-brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #7C3AED 0%, #06B6D4 50%, #F59E0B 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: white; letter-spacing: .5px;
  box-shadow: 0 4px 12px rgba(124,58,237,.35);
}
.byn-brand-name { font-weight: 700; color: white; }
.byn-brand-sub { font-size: 11px; color: #94A3B8; letter-spacing: .5px; text-transform: uppercase; }

.byn-user-card { display: flex; align-items: center; gap: 10px; padding: 14px 8px; border-bottom: 1px solid rgba(255,255,255,.05); }
.byn-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #06B6D4, #7C3AED);
  color: white; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.byn-user-name { font-weight: 600; color: white; font-size: 13px; }
.byn-user-roles { font-size: 11px; color: #94A3B8; }

.byn-nav { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; }
.byn-nav-section { border-radius: 8px; }
.byn-nav-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; background: transparent; border: 0;
  color: #CBD5E1; cursor: pointer; border-radius: 8px;
  font-size: 13px; font-weight: 500; text-align: left;
  transition: background .15s, color .15s;
}
.byn-nav-toggle:hover { background: rgba(255,255,255,.04); color: white; }
.byn-nav-toggle.active { background: color-mix(in oklab, var(--accent) 22%, transparent); color: white; }
.byn-nav-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px color-mix(in oklab, var(--accent) 40%, transparent);
  flex: 0 0 28px;
}
.byn-nav-label { flex: 1; }
.byn-nav-caret { transition: transform .2s; opacity: .6; }
.byn-nav-toggle[aria-expanded="true"] .byn-nav-caret { transform: rotate(180deg); }

.byn-nav-children { list-style: none; margin: 0; padding: 4px 0 6px 38px; max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.byn-nav-children.open { max-height: 1200px; }
.byn-nav-children li { margin: 0; }
.byn-nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  color: #94A3B8; text-decoration: none; font-size: 12.5px;
  border-left: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.byn-nav-link:hover { color: white; background: rgba(255,255,255,.04); }
.byn-nav-link.active { color: white; border-left-color: var(--accent); background: color-mix(in oklab, var(--accent) 18%, transparent); }

/* MAIN ----------------------------------------------------------- */
.byn-main { display: flex; flex-direction: column; min-width: 0; }
.byn-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 8;
}
.byn-sidebar-toggle { background: transparent; border: 0; font-size: 22px; color: var(--text-2); }
.byn-page-title { flex: 1; font-size: 17px; font-weight: 600; }
.byn-topbar-actions { display: flex; align-items: center; gap: 10px; }
.byn-bell-wrap { position: relative; }
.byn-bell { background: transparent; border: 1px solid var(--line); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; }
.byn-bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #EF4444; display: none; }
.byn-bell-dot.show { display: block; }
.byn-bell-panel { position: absolute; right: 0; top: 46px; width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); z-index: 20; }
.byn-bell-header { padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.byn-bell-body { max-height: 460px; overflow-y: auto; }
.byn-bell-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.byn-bell-item { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.byn-bell-item .pill { width: 6px; align-self: stretch; border-radius: 6px; background: var(--accent); }
.byn-bell-item .ttl { font-weight: 600; font-size: 13px; }
.byn-bell-item .body { font-size: 12.5px; color: var(--text-2); }
.byn-bell-item .ts { font-size: 11px; color: var(--muted); }
.byn-bell-item.severity-warn .pill { background: #F59E0B; }
.byn-bell-item.severity-critical .pill { background: #EF4444; }
.byn-bell-item.severity-success .pill { background: #10B981; }

.byn-content { padding: 22px; }

/* CARDS / KPIs --------------------------------------------------- */
.byn-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.byn-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.byn-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.byn-kpi .label { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.byn-kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.byn-kpi .delta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.byn-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; }
.byn-card-title { font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.byn-card-title .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

.byn-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 980px) { .byn-grid-2 { grid-template-columns: 1fr; } }

/* Charts capped per instruction #6 (1080×1080 max) */
.byn-chart-wrap { position: relative; max-width: 1080px; max-height: 1080px; }
.byn-chart-wrap canvas { max-width: 1080px !important; max-height: 1080px !important; }

/* Tables --------------------------------------------------------- */
.byn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.byn-table th, .byn-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.byn-table thead th { background: var(--accent-soft); color: var(--text); border-bottom-color: var(--accent-line); font-weight: 600; }
.byn-table tbody tr:hover { background: var(--accent-soft); }

.byn-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.byn-pill.success { background: #ECFDF5; color: #065F46; }
.byn-pill.warn { background: #FEF3C7; color: #92400E; }
.byn-pill.danger { background: #FEE2E2; color: #991B1B; }
.byn-pill.muted { background: #F1F5F9; color: #475569; }

/* Forms ---------------------------------------------------------- */
.byn-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.byn-form-grid label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.byn-form-grid .full { grid-column: 1 / -1; }

/* Mobile --------------------------------------------------------- */
@media (max-width: 980px) {
  .byn-app { grid-template-columns: 1fr; }
  .byn-sidebar { position: fixed; left: -290px; width: 280px; transition: left .25s; z-index: 50; }
  .byn-sidebar.open { left: 0; }
}
