:root{
    --bg: #f6f9ff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
  
    --primary: #1d4ed8;
    --primary-2: #3b82f6;
  
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --radius: 16px;
  }
  
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body{
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
    color: var(--text);
    background: var(--bg);
  }
  
  a { color: inherit; text-decoration: none; }
  
  .small{ font-size: .85rem; }
  .muted{ color: var(--muted); }
  .t-right{ text-align: right; }
  
  .h1{ margin: 0; font-size: 1.65rem; letter-spacing: -0.02em; }
  .h2{ margin: 0 0 .75rem; font-size: 1.1rem; letter-spacing: -0.01em; }
  
  .app-shell{ min-height: 100vh; display: flex; flex-direction: column; }
  .topbar{
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .icon-btn{
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 10px;
    width: 42px; height: 42px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(15,23,42,.04);
  }
  
  .brand{ display: flex; align-items: center; gap: 10px; flex: 1; }
  .brand-mark{
    width: 38px; height: 38px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    font-weight: 800;
  }
  .brand-title{ font-weight: 800; line-height: 1.1; }
  .brand-subtitle{ font-size: .85rem; color: var(--muted); margin-top: 2px; }
  
  .topbar-actions{ display: flex; align-items: center; gap: 10px; }
  .pill{
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: .85rem;
  }
  
  .shell-body{ display: flex; flex: 1; min-height: 0; }
  
  .sidebar{
    width: 260px;
    border-right: 1px solid var(--line);
    background: #fff;
    padding: 14px;
    display: flex; flex-direction: column;
    gap: 12px;
  }
  .sidebar-footer{ margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); }
  
  .nav{ display: flex; flex-direction: column; gap: 6px; }
  .nav-link{
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
    border: 1px solid transparent;
  }
  .nav-link:hover{ background: #f1f6ff; border-color: #dbeafe; }
  .nav-link.active{
    background: #eaf2ff;
    border-color: #bfdbfe;
    color: #0b3aa5;
  }
  .nav-ico{ width: 22px; text-align: center; }
  
  .nav-divider{ height: 1px; background: var(--line); margin: 8px 0; }
  
  .content{
    flex: 1;
    padding: 18px;
    min-width: 0;
  }
  
  .page{ max-width: 1200px; margin: 0 auto; }
  .page-header{
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
  }
  .page-actions{ display: flex; gap: 10px; flex-wrap: wrap; }
  
  .card{
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
  }
  
  .grid{ display: grid; gap: 14px; }
  .grid-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  
  .kpi{ padding: 18px; }
  .kpi-label{ color: var(--muted); font-size: .9rem; }
  .kpi-value{ font-size: 2rem; font-weight: 900; margin-top: 6px; letter-spacing: -0.03em; }
  .kpi-foot{ margin-top: 8px; }
  
  .list{ margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
  .dot{ display: inline-block; width: 10px; height: 10px; border-radius: 99px; margin-right: 8px; }
  .dot.ok{ background: #22c55e; }
  .dot.warn{ background: #f59e0b; }
  
  .stack{ display: grid; gap: 10px; }
  
  .btn{
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 650;
  }
  .btn:hover{ background: #f8fafc; }
  .btn-primary{
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border-color: transparent;
  }
  .btn-primary:hover{ filter: brightness(0.98); }
  .btn-ghost{
    background: transparent;
    border-color: transparent;
  }
  .btn-ghost:hover{ background: #f1f5f9; }
  
  .table-toolbar{
    display: flex; gap: 10px; flex-wrap: wrap;
    margin-bottom: 12px;
  }
  .input, .select{
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 220px;
    background: #fff;
  }
  .select{ min-width: 180px; }
  
  .table-wrap{ overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
  .table{ width: 100%; border-collapse: collapse; min-width: 760px; }
  .table th, .table td{ padding: 12px; border-bottom: 1px solid var(--line); }
  .table th{ text-align: left; font-size: .9rem; color: var(--muted); background: #fbfdff; }
  .table tr:hover td{ background: #f8fbff; }
  
  .badge{
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: .85rem;
    background: #fff;
  }
  .badge-ok{ background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
  .badge-warn{ background: #fffbeb; border-color: #fde68a; color: #92400e; }
  
  .form{ display: grid; gap: 14px; }
  .field{ display: grid; gap: 8px; }
  .label{ font-weight: 750; }
  .hint{ margin-top: 6px; }
  
  .row{ display: flex; gap: 10px; }
  
  /* Responsive */
  @media (max-width: 980px){
    .grid-3{ grid-template-columns: 1fr; }
    .grid-2{ grid-template-columns: 1fr; }
  }
  
  /* Mobile sidebar behavior */
  @media (max-width: 860px){
    .sidebar{
      position: fixed;
      top: 64px;
      left: 0;
      bottom: 0;
      transform: translateX(-105%);
      transition: transform .2s ease;
      z-index: 60;
      box-shadow: 0 15px 35px rgba(15,23,42,.18);
    }
    .sidebar.is-open{ transform: translateX(0); }
    .content{ padding: 14px; }
  }
  