* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-alt: #f4f4f5;
  --sidebar: #ffffff;
  --border: rgba(9, 9, 11, 0.09);
  --border-strong: rgba(9, 9, 11, 0.16);
  --text: #09090b;
  --muted: #71717a;
  --primary: #d97706;
  --primary-h: #b45309;
  --primary-soft: rgba(245, 158, 11, 0.12);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.18);
}

html.dark {
  --bg: #09090b;
  --surface: #18181b;
  --surface-alt: #27272a;
  --sidebar: #111114;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #fafafa;
  --muted: #a1a1aa;
  --primary: #f59e0b;
  --primary-h: #d97706;
  --primary-soft: rgba(245, 158, 11, 0.14);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.65);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

/* DEMO BANNER */
.demo-top {
  background: #6366f1;
  color: #fff;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
}
.demo-top a { color: #c7d2fe; font-weight: 700; text-decoration: none; }
.demo-top a:hover { text-decoration: underline; }

/* SHELL LAYOUT */
.fi-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 30px);
}

/* SIDEBAR FILAMENT */
.fi-sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: calc(100vh - 30px);
  overflow-y: auto;
}
.fi-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.fi-brand-left {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.3px;
}
.fi-logo-box {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.fi-ver {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 7px;
  border-radius: 6px;
}

.fi-nav-group { margin-bottom: 18px; }
.fi-nav-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 10px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.fi-nav-item {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.14s ease;
  margin-bottom: 2px;
}
.fi-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.fi-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.fi-nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
}
.fi-nav-item.active .fi-nav-badge {
  background: var(--primary);
  color: #fff;
}

.fi-sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}

/* MAIN AREA */
.fi-main-wrap { display: flex; flex-direction: column; min-width: 0; }

/* TOPBAR */
.fi-topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.fi-top-left { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 460px; }
.fi-burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}
.fi-global-search {
  position: relative;
  flex: 1;
}
.fi-global-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 36px 8px 34px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.fi-global-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.fi-search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); pointer-events: none; }
.fi-kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--muted); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }

.fi-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.fi-search-dropdown.open { display: block; }
.fi-gs-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.fi-gs-item:hover { background: var(--surface-alt); }
.fi-gs-tag { font-size: 10px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 7px; border-radius: 5px; }

.fi-top-right { display: flex; align-items: center; gap: 10px; }
.fi-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fi-icon-btn:hover { border-color: var(--primary); }
.fi-notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.fi-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12.5px;
  font-weight: 600;
}
.fi-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

/* CONTENT */
.fi-content {
  padding: 24px 28px 40px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
.fi-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.fi-breadcrumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.fi-page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; }
.fi-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.fi-btn {
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.fi-btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25); }
.fi-btn-primary:hover { background: var(--primary-h); }
.fi-btn-gray { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.fi-btn-gray:hover { background: var(--surface-alt); }
.fi-btn-danger { background: var(--danger); color: #fff; }
.fi-btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }

/* WIDGETS: STATS OVERVIEW */
.fi-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.fi-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 18px 20px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fi-stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.fi-stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.7px; }
.fi-stat-desc { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.fi-stat-desc.up { color: var(--success); }
.fi-stat-desc.amber { color: var(--primary); }
.fi-spark { width: 100%; height: 34px; margin-top: 6px; display: block; }

/* WIDGETS: CHARTS GRID */
.fi-charts-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.fi-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
.fi-charts-grid .fi-section { margin-bottom: 0; }
.fi-section-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.fi-section-title { font-size: 14.5px; font-weight: 700; }
.fi-section-sub { font-size: 12px; color: var(--muted); }
.fi-select {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.fi-chart-body { padding: 18px; }
.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  height: 190px;
  padding-top: 20px;
}
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-val { font-size: 10px; font-weight: 700; color: var(--muted); }
.bar-fill {
  width: 100%;
  max-width: 36px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  transition: height 0.35s ease, filter 0.15s;
}
.bar-col:hover .bar-fill { filter: brightness(1.15); }
.bar-lbl { font-size: 11px; color: var(--muted); font-weight: 600; }

.status-bars { display: flex; flex-direction: column; gap: 14px; }
.sb-row-top { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.sb-track { height: 9px; background: var(--surface-alt); border-radius: 99px; overflow: hidden; }
.sb-fill { height: 100%; border-radius: 99px; transition: width 0.35s ease; }

/* RESOURCE TABS */
.fi-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.fi-tab {
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fi-tab.active { background: var(--surface-alt); color: var(--primary); font-weight: 700; }
.fi-tab-pill { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }

/* TABLE */
.fi-table-tools {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.fi-bulk-bar {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--primary-soft);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.fi-bulk-bar.visible { display: flex; }
.fi-table-search {
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  width: 240px;
  font-family: inherit;
}
.fi-table-search:focus { border-color: var(--primary); }

.fi-table-scroll { overflow-x: auto; }
table.fi-table { width: 100%; border-collapse: collapse; }
table.fi-table th {
  background: var(--surface-alt);
  text-align: left;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
}
table.fi-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
table.fi-table tr:last-child td { border-bottom: none; }
table.fi-table tbody tr:hover td { background: var(--surface-alt); }
table.fi-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.fi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.b-success { background: var(--success-soft); color: var(--success); }
.b-warning { background: var(--warning-soft); color: var(--warning); }
.b-danger  { background: var(--danger-soft); color: var(--danger); }
.b-info    { background: var(--info-soft); color: var(--info); }

.fi-row-actions { display: flex; gap: 6px; }
.fi-link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 5px;
}
.fi-link-btn.amber { color: var(--primary); }
.fi-link-btn.danger { color: var(--danger); }
.fi-link-btn:hover { background: var(--surface-alt); }

.fi-table-foot {
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 10px;
}
.fi-pager { display: flex; gap: 5px; }
.fi-pager button {
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.fi-pager button:disabled { opacity: 0.4; cursor: default; }

/* CODE INSPECTOR */
.code-tabs { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.code-tab {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  font-family: monospace;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.code-tab.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.code-pre {
  background: #0d0e14;
  color: #e4e4e7;
  padding: 18px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
}

/* MODAL FILAMENT */
.fi-modal-ov {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.fi-modal-ov.open { display: flex; }
.fi-modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.fi-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fi-modal-head h3 { font-size: 16px; font-weight: 800; }
.fi-modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.fi-modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.fi-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.fi-field input, .fi-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.fi-field input:focus, .fi-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.fi-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fi-modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* NOTIF POPOVER */
.notif-pop {
  display: none;
  position: fixed;
  top: 94px;
  right: 24px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}
.notif-pop.open { display: block; }
.notif-head { padding: 12px 15px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 800; }
.notif-item { padding: 10px 15px; border-bottom: 1px solid var(--border); font-size: 12px; }
.notif-item:last-child { border-bottom: none; }

/* TOAST */
.fi-toast {
  position: fixed;
  top: 72px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-left: 4px solid var(--primary);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 600;
  transform: translateX(130%);
  transition: transform 0.25s ease;
}
.fi-toast.show { transform: translateX(0); }

.hidden { display: none !important; }

@media (max-width: 960px) {
  .fi-layout { grid-template-columns: 1fr; }
  .fi-sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 30px;
    bottom: 0;
    width: 260px;
    z-index: 250;
    box-shadow: var(--shadow-lg);
  }
  .fi-sidebar.mobile-open { display: flex; }
  .fi-burger { display: flex; align-items: center; justify-content: center; }
  .fi-stats-grid, .fi-charts-grid { grid-template-columns: 1fr; }
  .fi-content { padding: 18px 14px; }
}
@media (max-width: 520px) {
  .fi-two-col { grid-template-columns: 1fr; }
  .fi-user-chip span { display: none; }
}
