/* ============================================================
   IMMOZIUM — Design tokens & base styles
   ============================================================ */

:root {
  /* =========================================================
     IMMOZIUM — BRAND
     ========================================================= */

  /* Primary — Dark Navy */
  --iz-primary: #11294E;
  --iz-primary-600: #1C4A78;
  --iz-primary-700: #0F2942;
  --iz-primary-hover: #0F2942;

  /* Secondary — Brand Green */
  --iz-secondary: #23A464;
  --iz-secondary-600: #1D8F57;
  --iz-secondary-700: #187447;
  --iz-secondary-hover: #1D8F57;

  /* Accent */
  --iz-accent: #23A464;
  --iz-accent-soft: #E7F6ED;


  /* =========================================================
     FUNCTIONAL
     ========================================================= */

  /* Success */
  --iz-success: #16A34A;
  --iz-success-soft: #E7F6ED;

  /* Warning */
  --iz-warning: #D97706;
  --iz-warning-soft: #FDF1E1;

  /* Danger */
  --iz-danger: #DC2626;
  --iz-danger-soft: #FBE9E9;

  /* Info */
  --iz-info: #2563EB;
  --iz-info-soft: #E9EFFD;


  /* =========================================================
     NEUTRALS
     ========================================================= */

  --iz-bg: #F5F8F7;
  --iz-surface: #FFFFFF;
  --iz-border: #E4E7EC;

  /* Main text */
  --iz-text: #11294E;
  --iz-text-muted: #5B6472;
  --iz-text-soft: #98A2B3;


  /* =========================================================
     SIDEBAR
     ========================================================= */

  --iz-sidebar-bg: #0F2942;
  --iz-sidebar-text: #C7D3E0;

  /* Active menu */
  --iz-sidebar-active: #163A5F;
  --iz-sidebar-active-text: #FFFFFF;


  /* =========================================================
     UI
     ========================================================= */

  --iz-radius-sm: 8px;
  --iz-radius-md: 12px;
  --iz-radius-lg: 16px;

  --iz-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --iz-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);


  /* =========================================================
     LAYOUT
     ========================================================= */

  --iz-sidebar-w: 268px;
  --iz-sidebar-w-collapsed: 84px;
}

.dark {
  --iz-bg: #0B1420;
  --iz-surface: #10192A;
  --iz-border: #223047;
  --iz-text: #E7ECF3;
  --iz-text-muted: #97A4B8;
  --iz-text-soft: #6B7A90;
  --iz-sidebar-bg: #081120;
  --iz-sidebar-text: #97A4B8;
  --iz-sidebar-active: #163A5F;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--iz-bg);
  color: var(--iz-text);
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

::selection {
  background: var(--iz-accent-soft);
  color: var(--iz-primary-700);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--iz-border);
  border-radius: 99px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

.iz-sidebar {
  width: var(--iz-sidebar-w);
  background: var(--iz-sidebar-bg);
  color: var(--iz-sidebar-text);
  flex-shrink: 0;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width .18s ease, transform .2s ease;
}

.iz-app.is-collapsed .iz-sidebar {
  width: var(--iz-sidebar-w-collapsed);
}

.iz-app.is-collapsed .iz-main {
  margin-left: var(--iz-sidebar-w-collapsed);
}

.iz-main {
  margin-left: var(--iz-sidebar-w);
  flex: 1;
  min-width: 0;
  transition: margin-left .18s ease;
}

.iz-sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  flex-shrink: 0;
}

.iz-sidebar-brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  background: linear-gradient(155deg, var(--iz-accent), #a5811b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--iz-primary-700);
  font-weight: 800;
  font-size: .95rem;
}

.iz-sidebar-brand .name {
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  font-size: 1.02rem;
}

.iz-sidebar-brand .sub {
  font-size: .68rem;
  color: var(--iz-sidebar-text);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.iz-app.is-collapsed .iz-sidebar-brand .name,
.iz-app.is-collapsed .iz-sidebar-brand .sub {
  display: none;
}

.iz-nav {
  flex: 1;
  overflow-y: auto;
  padding: .85rem .75rem;
}

.iz-nav-group {
  margin-bottom: .35rem;
}

.iz-nav-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #5C7089;
  padding: .9rem .6rem .35rem;
  font-weight: 600;
}

.iz-app.is-collapsed .iz-nav-label {
  display: none;
}

.iz-nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .58rem .65rem;
  border-radius: var(--iz-radius-sm);
  font-size: .865rem;
  font-weight: 500;
  color: var(--iz-sidebar-text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.iz-nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .85;
}

.iz-nav-link:hover {
  background: rgba(255, 255, 255, .05);
  color: #fff;
}

.iz-nav-link.active {
  background: var(--iz-sidebar-active);
  color: #fff;
}

.iz-nav-link.active svg {
  color: var(--iz-accent);
  opacity: 1;
}

.iz-nav-link .chev {
  margin-left: auto;
  width: 14px;
  height: 14px;
  transition: transform .15s;
}

.iz-nav-group.open .chev {
  transform: rotate(90deg);
}

.iz-app.is-collapsed .iz-nav-link span:not(.badge) {
  display: none;
}

.iz-app.is-collapsed .iz-nav-link {
  justify-content: center;
}

.iz-subnav {
  overflow: hidden;
  max-height: 0;
  transition: max-height .18s ease;
  padding-left: 2.15rem;
}

.iz-nav-group.open .iz-subnav {
  max-height: 400px;
}

.iz-subnav .iz-nav-link {
  font-size: .82rem;
  padding: .48rem .65rem;
}

.iz-app.is-collapsed .iz-subnav {
  display: none;
}

.iz-sidebar-foot {
  padding: .85rem;
  border-top: 1px solid rgba(255, 255, 255, .06);
  flex-shrink: 0;
}

/* Topbar */
.iz-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--iz-surface);
  border-bottom: 1px solid var(--iz-border);
}

.iz-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--iz-bg);
  border: 1px solid var(--iz-border);
  border-radius: var(--iz-radius-sm);
  padding: .5rem .75rem;
  color: var(--iz-text-soft);
  font-size: .85rem;
  width: 340px;
  max-width: 40vw;
}

.iz-search input {
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  color: var(--iz-text);
  font-size: .85rem;
}

.iz-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--iz-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--iz-border);
  background: var(--iz-surface);
  color: var(--iz-text-muted);
  position: relative;
  cursor: pointer;
}

.iz-icon-btn:hover {
  background: var(--iz-bg);
}

.iz-icon-btn svg {
  width: 18px;
  height: 18px;
}

.iz-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--iz-danger);
  border: 2px solid var(--iz-surface);
}

.iz-content {
  padding: 1.5rem;
  max-width: 1600px;
}

/* Cards */
.card {
  background: var(--iz-surface);
  border: 1px solid var(--iz-border);
  border-radius: var(--iz-radius-md);
  box-shadow: var(--iz-shadow-sm);
}

.kpi-card {
  padding: 1.1rem 1.25rem;
}

.kpi-label {
  font-size: .78rem;
  color: var(--iz-text-muted);
  font-weight: 500;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-top: .2rem;
}

.kpi-trend {
  font-size: .76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-top: .4rem;
}

.kpi-trend.up {
  color: var(--iz-success);
}

.kpi-trend.down {
  color: var(--iz-danger);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .22rem .55rem;
  border-radius: 99px;
  line-height: 1.3;
}

.badge-success {
  background: var(--iz-success-soft);
  color: var(--iz-success);
}

.badge-warning {
  background: var(--iz-warning-soft);
  color: var(--iz-warning);
}

.badge-danger {
  background: var(--iz-danger-soft);
  color: var(--iz-danger);
}

.badge-info {
  background: var(--iz-info-soft);
  color: var(--iz-info);
}

.badge-neutral {
  background: var(--iz-bg);
  color: var(--iz-text-muted);
  border: 1px solid var(--iz-border);
}

.badge-accent {
  background: var(--iz-accent-soft);
  color: #8a6d13;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  font-weight: 600;
  padding: .55rem 1rem;
  border-radius: var(--iz-radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--iz-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--iz-primary-600);
}

.btn-accent {
  background: var(--iz-accent);
  color: var(--iz-primary-700);
}

.btn-accent:hover {
  filter: brightness(1.05);
}

.btn-outline {
  background: var(--iz-surface);
  border-color: var(--iz-border);
  color: var(--iz-text);
}

.btn-outline:hover {
  background: var(--iz-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--iz-text-muted);
}

.btn-ghost:hover {
  background: var(--iz-bg);
}

.btn-danger {
  background: var(--iz-danger);
  color: #fff;
}

.btn-sm {
  padding: .4rem .7rem;
  font-size: .78rem;
}

/* Tables */
.iz-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .84rem;
}

.iz-table thead th {
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--iz-text-soft);
  font-weight: 600;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--iz-border);
  background: var(--iz-bg);
}

.iz-table thead th:first-child {
  border-top-left-radius: var(--iz-radius-sm);
}

.iz-table thead th:last-child {
  border-top-right-radius: var(--iz-radius-sm);
}

.iz-table tbody td {
  padding: .8rem .9rem;
  border-bottom: 1px solid var(--iz-border);
  color: var(--iz-text);
  vertical-align: middle;
}

.iz-table tbody tr:hover {
  background: var(--iz-bg);
}

.iz-table tbody tr:last-child td {
  border-bottom: none;
}

/* Form */
.field-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--iz-text);
  margin-bottom: .35rem;
  display: block;
}

.field-input,
select.field-input,
textarea.field-input {
  width: 100%;
  border: 1px solid var(--iz-border);
  background: var(--iz-surface);
  color: var(--iz-text);
  border-radius: var(--iz-radius-sm);
  padding: .6rem .75rem;
  font-size: .85rem;
  outline: none;
}

.field-input:focus {
  border-color: var(--iz-secondary);
  box-shadow: 0 0 0 3px rgba(47, 107, 138, .15);
}

.field-hint {
  font-size: .74rem;
  color: var(--iz-text-soft);
  margin-top: .3rem;
}

/* Modal */
.iz-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 26, .55);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.iz-modal-backdrop.open {
  display: flex;
}

.iz-modal {
  background: var(--iz-surface);
  border-radius: var(--iz-radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--iz-shadow-md);
  border: 1px solid var(--iz-border);
}

.iz-modal-head {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--iz-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.iz-modal-body {
  padding: 1.2rem 1.3rem;
  font-size: .87rem;
  color: var(--iz-text-muted);
}

.iz-modal-foot {
  padding: 1rem 1.3rem;
  border-top: 1px solid var(--iz-border);
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

/* Toasts */
#toast-stack {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: 320px;
  max-width: 90vw;
}

.iz-toast {
  background: var(--iz-surface);
  border: 1px solid var(--iz-border);
  border-left: 4px solid var(--iz-primary);
  box-shadow: var(--iz-shadow-md);
  border-radius: var(--iz-radius-sm);
  padding: .75rem .9rem;
  font-size: .82rem;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  animation: iz-toast-in .18s ease;
}

.iz-toast.success {
  border-left-color: var(--iz-success);
}

.iz-toast.warning {
  border-left-color: var(--iz-warning);
}

.iz-toast.danger {
  border-left-color: var(--iz-danger);
}

@keyframes iz-toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Empty / alert states */
.iz-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--iz-text-muted);
}

.iz-empty svg {
  width: 40px;
  height: 40px;
  margin: 0 auto .75rem;
  color: var(--iz-text-soft);
}

.iz-alert-list .item {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .65rem 0;
  border-bottom: 1px solid var(--iz-border);
}

.iz-alert-list .item:last-child {
  border-bottom: none;
}

/* Mobile bottom nav */
.iz-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .iz-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--iz-shadow-md);
  }

  .iz-app.is-mobile-open .iz-sidebar {
    transform: translateX(0);
  }

  .iz-main {
    margin-left: 0 !important;
  }

  .iz-search {
    display: none;
  }

  .iz-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--iz-surface);
    border-top: 1px solid var(--iz-border);
    padding: .4rem .2rem calc(.4rem + env(safe-area-inset-bottom));
  }

  .iz-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    font-size: .66rem;
    color: var(--iz-text-soft);
    padding: .3rem 0;
  }

  .iz-bottom-nav a svg {
    width: 20px;
    height: 20px;
  }

  .iz-bottom-nav a.active {
    color: var(--iz-primary);
  }

  .dark .iz-bottom-nav a.active {
    color: var(--iz-accent);
  }

  .iz-content {
    padding-bottom: 5.5rem;
  }

  #mobile-overlay.open {
    display: block;
  }
}

#mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 26, .5);
  z-index: 39;
}

.iz-scroll-x {
  overflow-x: auto;
}