
  :root{
    --navy:#0b1727;
    --navy2:#122236;
    --teal:#0d9488;
    --teal-light:#14b8a6;
    --blue:#2563eb;
    --blue-light:#3b82f6;
    --amber:#d97706;
    --red:#dc2626;
    --green:#16a34a;
    --purple:#7c3aed;
    --bg:#eef2f6;
    --card:#ffffff;
    --border:#dce3ea;
    --text:#1e293b;
    --muted:#64748b;
    --radius:10px;
    --shadow:0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;height:100%;}
  body{
    font-family:'Segoe UI',-apple-system,BlinkMacSystemFont,Roboto,Arial,sans-serif;
    background:var(--bg);
    color:var(--text);
    font-size:14px;
    -webkit-font-smoothing:antialiased;
  }
  a{color:inherit;text-decoration:none;}
  ul{list-style:none;margin:0;padding:0;}
  button{font-family:inherit;cursor:pointer;}
  ::-webkit-scrollbar{width:10px;height:10px;}
  ::-webkit-scrollbar-track{background:transparent;}
  ::-webkit-scrollbar-thumb{background:#c3cedb;border-radius:10px;}

  /* ============ LOGIN ============ */
  #login-screen{
    position:fixed;inset:0;z-index:999;
    display:flex;align-items:center;justify-content:center;
    background:
      radial-gradient(circle at 20% 20%, rgba(13,148,136,.35), transparent 45%),
      radial-gradient(circle at 80% 80%, rgba(37,99,235,.35), transparent 45%),
      linear-gradient(135deg,#0b1727,#122236 60%,#0b1727);
    transition:opacity .4s ease, visibility .4s ease;
  }
  #login-screen.hide{opacity:0;visibility:hidden;pointer-events:none;}
  .login-box{
    width:960px;max-width:94vw;background:rgba(255,255,255,.98);border-radius:18px;
    display:flex;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.45);
  }
  .login-left{
    flex:1.1;background:linear-gradient(160deg,var(--teal),#0f766e 55%,var(--navy));
    color:#fff;padding:48px 40px;display:flex;flex-direction:column;justify-content:space-between;position:relative;
  }
  .login-left h1{font-size:26px;margin:18px 0 8px;line-height:1.3;}
  .login-left p{opacity:.85;line-height:1.6;font-size:13.5px;}
  .login-logo{display:flex;align-items:center;gap:10px;font-weight:700;font-size:18px;}
  .login-logo .cross{
    width:36px;height:36px;border-radius:9px;background:#fff;display:flex;align-items:center;justify-content:center;color:var(--teal);font-size:20px;font-weight:900;
  }
  .login-feat{margin-top:28px;display:flex;flex-direction:column;gap:12px;}
  .login-feat div{display:flex;gap:10px;align-items:flex-start;font-size:12.5px;opacity:.9;}
  .login-right{flex:1;padding:48px 44px;display:flex;flex-direction:column;justify-content:center;}
  .login-right h2{margin:0 0 4px;font-size:22px;}
  .login-right .sub{color:var(--muted);margin-bottom:26px;font-size:13px;}
  .field{margin-bottom:16px;}
  .field label{display:block;font-size:12.5px;font-weight:600;margin-bottom:6px;color:#334155;}
  .field input, .field select{
    width:100%;padding:11px 12px;border:1px solid var(--border);border-radius:8px;font-size:13.5px;background:#f8fafc;
  }
  .field input:focus,.field select:focus{outline:2px solid var(--teal-light);background:#fff;}
  .btn-login{
    width:100%;padding:12px;border:none;border-radius:8px;background:var(--teal);color:#fff;font-weight:700;font-size:14px;margin-top:6px;
    box-shadow:0 10px 20px rgba(13,148,136,.3);
  }
  .btn-login:hover{background:#0f766e;}
  .login-foot{margin-top:18px;font-size:11.5px;color:var(--muted);text-align:center;}
  .role-chip{display:flex;gap:8px;margin-bottom:18px;flex-wrap:wrap;}
  .role-chip span{padding:6px 10px;border-radius:999px;background:#f1f5f9;border:1px solid var(--border);font-size:11.5px;color:var(--muted);cursor:pointer;}
  .role-chip span.active{background:var(--teal);color:#fff;border-color:var(--teal);}

  /* ============ APP LAYOUT ============ */
  #app{display:none;height:100vh;width:100%;}
  #app.show{display:flex;}

  .sidebar{
    width:250px;flex-shrink:0;background:linear-gradient(195deg,var(--navy),#0d1b2c 80%);
    color:#cbd5e1;display:flex;flex-direction:column;height:100%;
  }
  .sidebar-brand{
    display:flex;align-items:center;gap:10px;padding:18px 18px;border-bottom:1px solid rgba(255,255,255,.08);
  }
  .sidebar-brand .cross{
    width:34px;height:34px;border-radius:9px;background:var(--teal);display:flex;align-items:center;justify-content:center;color:#fff;font-weight:900;font-size:18px;flex-shrink:0;
  }
  .sidebar-brand div b{display:block;color:#fff;font-size:14px;line-height:1.2;}
  .sidebar-brand div span{font-size:10.5px;color:#8ba3bd;}
  .sidebar-scroll{flex:1;overflow-y:auto;padding:14px 10px 20px;}
  .nav-group-title{font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;color:#5f7892;padding:14px 12px 6px;font-weight:700;}
  .nav-item{
    display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;font-size:13px;color:#cbd5e1;margin-bottom:2px;cursor:pointer;border-left:3px solid transparent;
  }
  .nav-item .ic{width:20px;text-align:center;font-size:14.5px;}
  .nav-item:hover{background:rgba(255,255,255,.06);}
  .nav-item.active{background:rgba(13,148,136,.18);color:#fff;border-left:3px solid var(--teal-light);font-weight:600;}
  .sidebar-foot{padding:14px;border-top:1px solid rgba(255,255,255,.08);font-size:11px;color:#6b8098;}

  .main{flex:1;display:flex;flex-direction:column;height:100%;overflow:hidden;}
  .topbar{
    height:60px;flex-shrink:0;background:#fff;border-bottom:1px solid var(--border);
    display:flex;align-items:center;justify-content:space-between;padding:0 22px;
  }
  .topbar-title{font-size:16px;font-weight:700;color:#0f2942;}
  .topbar-title span{display:block;font-size:11.5px;font-weight:400;color:var(--muted);}
  .topbar-right{display:flex;align-items:center;gap:18px;}
  .search-box{
    display:flex;align-items:center;gap:8px;background:#f1f5f9;border-radius:8px;padding:8px 12px;width:260px;color:var(--muted);font-size:12.5px;
  }
  .ic-btn{position:relative;width:36px;height:36px;border-radius:8px;background:#f1f5f9;display:flex;align-items:center;justify-content:center;font-size:15px;color:#334155;}
  .ic-btn .dot{position:absolute;top:6px;right:6px;width:7px;height:7px;background:var(--red);border-radius:50%;border:1.5px solid #fff;}
  .topbar-user{display:flex;align-items:center;gap:10px;padding-left:14px;border-left:1px solid var(--border);}
  .avatar{width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--teal),var(--blue));color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;}
  .topbar-user b{font-size:12.5px;display:block;}
  .topbar-user span{font-size:11px;color:var(--muted);}

  .content{flex:1;overflow-y:auto;padding:22px;}
  .page{display:none;}
  .page.active{display:block;animation:fade .25s ease;}
  @keyframes fade{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:translateY(0);}}

  .breadcrumb{font-size:11.5px;color:var(--muted);margin-bottom:14px;}
  .breadcrumb b{color:var(--teal);}

  /* ---- generic widgets ---- */
  .grid{display:grid;gap:16px;}
  .cols-4{grid-template-columns:repeat(4,1fr);}
  .cols-3{grid-template-columns:repeat(3,1fr);}
  .cols-2{grid-template-columns:repeat(2,1fr);}
  @media(max-width:1200px){.cols-4{grid-template-columns:repeat(2,1fr);} .cols-3{grid-template-columns:repeat(2,1fr);}}

  .card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);}
  .card-pad{padding:18px;}
  .card-head{display:flex;align-items:center;justify-content:between;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border);}
  .card-head h3{margin:0;font-size:14.5px;}
  .card-head p{margin:2px 0 0;font-size:11.5px;color:var(--muted);}
  .card-body{padding:18px;}

  .kpi{display:flex;flex-direction:column;gap:6px;padding:18px;position:relative;overflow:hidden;}
  .kpi .top{display:flex;justify-content:space-between;align-items:flex-start;}
  .kpi .ic-wrap{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:19px;}
  .kpi .val{font-size:26px;font-weight:800;color:#0f2942;}
  .kpi .lbl{font-size:12px;color:var(--muted);}
  .kpi .trend{font-size:11px;font-weight:700;padding:2px 7px;border-radius:6px;}
  .trend.up{color:var(--green);background:#dcfce7;}
  .trend.down{color:var(--red);background:#fee2e2;}

  table{width:100%;border-collapse:collapse;font-size:12.8px;}
  th{text-align:left;color:var(--muted);font-weight:600;font-size:11.5px;text-transform:uppercase;letter-spacing:.03em;padding:10px 12px;border-bottom:1px solid var(--border);background:#f8fafc;}
  td{padding:10px 12px;border-bottom:1px solid #eef1f5;}
  tr:last-child td{border-bottom:none;}
  tbody tr:hover{background:#f8fafc;}

  .badge{display:inline-block;padding:3px 10px;border-radius:999px;font-size:11px;font-weight:700;}
  .b-green{background:#dcfce7;color:#15803d;}
  .b-amber{background:#fef3c7;color:#b45309;}
  .b-red{background:#fee2e2;color:#b91c1c;}
  .b-blue{background:#dbeafe;color:#1d4ed8;}
  .b-gray{background:#f1f5f9;color:#475569;}
  .b-purple{background:#ede9fe;color:#6d28d9;}

  .btn{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:7px;border:1px solid transparent;font-size:12.5px;font-weight:600;}
  .btn-primary{background:var(--teal);color:#fff;}
  .btn-primary:hover{background:#0f766e;}
  .btn-outline{background:#fff;border-color:var(--border);color:#334155;}
  .btn-outline:hover{background:#f8fafc;}
  .btn-blue{background:var(--blue);color:#fff;}
  .btn-sm{padding:5px 10px;font-size:11.5px;}
  .toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;flex-wrap:wrap;gap:10px;}
  .toolbar .filters{display:flex;gap:8px;flex-wrap:wrap;}
  .input-sm{padding:8px 10px;border:1px solid var(--border);border-radius:7px;font-size:12.5px;background:#fff;}

  .section-title{font-size:19px;font-weight:800;color:#0f2942;margin:0 0 4px;}
  .section-sub{color:var(--muted);font-size:12.8px;margin:0 0 18px;}

  .tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:18px;}
  .tab{padding:10px 16px;font-size:13px;font-weight:600;color:var(--muted);border-bottom:2px solid transparent;cursor:pointer;}
  .tab.active{color:var(--teal);border-bottom-color:var(--teal);}

  /* bar chart css */
  .barchart{display:flex;align-items:flex-end;gap:10px;height:170px;padding:10px 6px 0;}
  .barchart .bar{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;height:100%;}
  .barchart .bar .fill{width:100%;border-radius:5px 5px 0 0;background:linear-gradient(180deg,var(--teal-light),var(--teal));}
  .barchart .bar .lbl{font-size:10.5px;color:var(--muted);}

  .donut{width:150px;height:150px;border-radius:50%;margin:0 auto;position:relative;}
  .donut::after{content:'';position:absolute;inset:20px;background:#fff;border-radius:50%;display:flex;}
  .donut-legend{display:flex;flex-direction:column;gap:8px;margin-top:4px;}
  .donut-legend div{display:flex;align-items:center;gap:8px;font-size:12px;}
  .dot{width:9px;height:9px;border-radius:2px;display:inline-block;}

  .ward-map{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;}
  .bed{border:1px solid var(--border);border-radius:9px;padding:10px;font-size:11.5px;position:relative;background:#fff;}
  .bed.kosong{background:#f0fdf4;border-color:#bbf7d0;}
  .bed.terisi{background:#fef2f2;border-color:#fecaca;}
  .bed.booking{background:#fffbeb;border-color:#fde68a;}
  .bed b{display:block;font-size:12.5px;margin-bottom:3px;}
  .bed .bed-badge{position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:50%;}

  .queue-list{display:flex;flex-direction:column;gap:8px;}
  .queue-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--border);border-radius:9px;}
  .queue-num{width:38px;height:38px;border-radius:9px;background:var(--navy);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px;flex-shrink:0;}
  .queue-item.current .queue-num{background:var(--teal);}

  .timeline{border-left:2px solid var(--border);margin-left:10px;padding-left:20px;}
  .timeline-item{position:relative;padding-bottom:22px;}
  .timeline-item::before{content:'';position:absolute;left:-26px;top:3px;width:11px;height:11px;border-radius:50%;background:var(--teal);border:2px solid #fff;box-shadow:0 0 0 2px var(--teal);}
  .timeline-item .date{font-size:11px;color:var(--muted);}
  .timeline-item .title{font-weight:700;font-size:13px;margin:2px 0;}

  .stock-bar{height:7px;border-radius:4px;background:#e2e8f0;overflow:hidden;width:100px;}
  .stock-bar .fill{height:100%;background:var(--green);}
  .stock-bar .fill.low{background:var(--amber);}
  .stock-bar .fill.crit{background:var(--red);}

  /* ---- FLOWCHART & ERD CANVAS ---- */
  .diagram-wrap{overflow:auto;border:1px solid var(--border);border-radius:var(--radius);background:
      linear-gradient(#f8fafc 1px, transparent 1px), linear-gradient(90deg,#f8fafc 1px, transparent 1px);
      background-size:24px 24px; background-color:#fff;}
  .canvas{position:relative;}
  svg.connector-layer{position:absolute;top:0;left:0;pointer-events:none;}

  .flow-swimlanes{position:relative;min-width:1700px;padding:20px 30px 50px;}
  .lane{display:flex;align-items:stretch;border-bottom:1px dashed #d8e0e8;min-height:120px;}
  .lane:last-child{border-bottom:none;}
  .lane-label{width:150px;flex-shrink:0;display:flex;align-items:center;font-size:12px;font-weight:800;color:#fff;padding:10px 14px;border-radius:8px;margin:14px 12px 14px 0;text-align:left;line-height:1.3;}
  .lane-track{flex:1;position:relative;display:flex;align-items:center;gap:70px;padding:20px 10px;flex-wrap:nowrap;}

  .fbox{
    width:150px;min-height:70px;border-radius:9px;background:#fff;border:1.5px solid var(--border);
    display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:10px;
    font-size:11.8px;font-weight:600;box-shadow:var(--shadow);position:relative;z-index:2;
  }
  .fbox .fic{font-size:18px;margin-bottom:4px;}
  .fbox.start-end{border-radius:40px;background:var(--navy);color:#fff;border-color:var(--navy);}
  .fbox.decision{
    width:130px;height:130px;border-radius:12px;transform:rotate(45deg);background:#fff7ed;border-color:var(--amber);display:flex;align-items:center;justify-content:center;
  }
  .fbox.decision .decision-inner{transform:rotate(-45deg);font-size:11px;font-weight:700;color:#92400e;width:88px;text-align:center;}
  .fbox.proc-teal{border-color:var(--teal);background:#f0fdfa;}
  .fbox.proc-blue{border-color:var(--blue);background:#eff6ff;}
  .fbox.proc-purple{border-color:var(--purple);background:#f5f3ff;}
  .fbox.proc-amber{border-color:var(--amber);background:#fffbeb;}

  .legend-row{display:flex;gap:18px;flex-wrap:wrap;margin-bottom:16px;font-size:12px;color:var(--muted);}
  .legend-row .lg-item{display:flex;align-items:center;gap:7px;}
  .legend-swatch{width:14px;height:14px;border-radius:4px;border:1.5px solid;}

  /* ERD */
  .erd-canvas{position:relative;min-width:1900px;min-height:1550px;padding:30px;}
  .erd-table{
    position:absolute;width:210px;background:#fff;border:1.5px solid var(--border);border-radius:8px;box-shadow:var(--shadow);z-index:2;overflow:hidden;
  }
  .erd-table .erd-head{padding:8px 12px;color:#fff;font-weight:800;font-size:12px;display:flex;align-items:center;gap:6px;}
  .erd-table.master .erd-head{background:var(--blue);}
  .erd-table.transaksi .erd-head{background:var(--teal);}
  .erd-table.keuangan .erd-head{background:var(--amber);}
  .erd-table.sistem .erd-head{background:var(--purple);}
  .erd-table .erd-row{display:flex;justify-content:space-between;padding:4.5px 12px;font-size:10.8px;border-bottom:1px solid #f1f5f9;}
  .erd-table .erd-row:last-child{border-bottom:none;}
  .erd-table .erd-row.pk{font-weight:800;color:#0f2942;background:#f8fafc;}
  .erd-table .erd-row .fk{color:var(--muted);font-size:9.5px;font-weight:700;}
  .erd-table .erd-row .k-tag{font-size:8.6px;font-weight:800;padding:1px 5px;border-radius:4px;}
  .k-tag.pk-tag{background:#fde68a;color:#78350f;}
  .k-tag.fk-tag{background:#dbeafe;color:#1e40af;}

  .info-callout{display:flex;gap:12px;background:#eff6ff;border:1px solid #bfdbfe;border-radius:9px;padding:14px 16px;font-size:12.5px;color:#1e3a5f;margin-bottom:18px;}

  .modal-bg{position:fixed;inset:0;background:rgba(15,23,42,.5);display:none;align-items:center;justify-content:center;z-index:500;}
  .modal-bg.show{display:flex;}
  .modal-box{background:#fff;border-radius:12px;width:560px;max-width:92vw;max-height:88vh;overflow:auto;}
  .modal-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border);}
  .modal-head h3{margin:0;font-size:15px;}
  .modal-close{width:28px;height:28px;border-radius:7px;background:#f1f5f9;display:flex;align-items:center;justify-content:center;font-size:14px;}
  .modal-body{padding:18px 20px;}
  .footer-form{display:flex;justify-content:flex-end;gap:10px;padding:14px 20px;border-top:1px solid var(--border);}
