    :root { --bg:#f7f8fc; --surface:#fff; --border:#e6e9f0; --text:#0f172a; --muted:#64748b; --accent:#0ea5e9; }
    * { box-sizing: border-box; }
    body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--text); }
    .layout { min-height: 100vh; display:grid; grid-template-columns:260px 1fr; transition:grid-template-columns .2s ease; }
    .layout.collapsed { grid-template-columns:72px 1fr; }
    .sidebar { background:var(--surface); border-right:1px solid var(--border); padding:12px 10px; overflow:hidden; }
    .brand { display:flex; align-items:center; justify-content:space-between; margin:0 4px 12px; }
    .brand-text { font-size:13px; font-weight:700; letter-spacing:.8px; color:#0b1324; }
    .toggle { border:1px solid #cbd5e1; background:#fff; border-radius:8px; width:30px; height:30px; cursor:pointer; }
    .section-title { margin:10px 6px 6px; font-size:11px; color:#6b7280; text-transform:uppercase; letter-spacing:.8px; }
    .menu-item { display:flex; align-items:center; gap:8px; text-decoration:none; color:#1f2937; padding:8px; border-radius:10px; border:1px solid transparent; font-size:13px; white-space:nowrap; }
    .menu-item:hover { background:#f8fafc; border-color:#dbe2ea; }
    .menu-item.active { background:#e0f2fe; border-color:#bae6fd; color:#0369a1; font-weight:600; }
    .menu-sep { height:1px; background:#e5e7eb; margin:5px 8px; }
    .icon { width:16px; height:16px; flex:0 0 16px; }
    .icon svg { width:100%; height:100%; stroke:currentColor; fill:none; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
    .layout.collapsed .brand-text, .layout.collapsed .section-title, .layout.collapsed .label { display:none; }
    .content { padding:12px; }
    .panel { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; height:calc(100vh - 24px); display:flex; flex-direction:column; }
    .topbar { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:10px; flex-wrap:wrap; }
    h1 { margin:0; font-size:22px; }
    .sub { margin:4px 0 0; color:var(--muted); font-size:13px; }
    .actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
    .btn { border:1px solid #cbd5e1; background:#fff; border-radius:8px; padding:7px 10px; font-size:13px; cursor:pointer; }
    .search-input { border:1px solid #cbd5e1; border-radius:8px; padding:7px 10px; font-size:13px; width:220px; }
    .search-input:focus { outline:none; border-color:#0ea5e9; box-shadow:0 0 0 2px rgba(14,165,233,.2); }
    th.sortable { cursor:pointer; user-select:none; }
    th.sortable:hover { background:#e2e8f0; }
    th.sortable span { display:inline-flex; align-items:center; gap:4px; }
    th.sortable span::after { content:'↕'; opacity:.3; font-size:10px; }
    th.sort-asc span::after { content:'↑'; opacity:1; color:#0ea5e9; }
    th.sort-desc span::after { content:'↓'; opacity:1; color:#0ea5e9; }
    .table-wrap { flex:1; min-height:0; overflow:auto; border:1px solid var(--border); border-radius:10px; background:#fff; }
    table { width:100%; border-collapse:collapse; }
    th, td { border-bottom:1px solid var(--border); text-align:left; padding:8px 7px; font-size:13px; }
    th { color:#334155; background:#f8fafc; font-weight:600; position:sticky; top:0; z-index:1; }
    tr[data-id]:hover td { background:#f8fafc; }
    .col-actions { display:none; }
    .edit-mode-active .col-actions { display:table-cell; }
    tr.row-received  td { background:#fce7f3; }
    tr.row-cancelled td { color:var(--muted); text-decoration:line-through; opacity:.6; }
    .badge { display:inline-block; padding:2px 7px; border-radius:20px; font-size:11px; font-weight:600; }
    .badge-pending  { background:#fef3c7; color:#92400e; }
    .badge-sent     { background:#dbeafe; color:#1e40af; }
    .badge-received { background:#dcfce7; color:#166534; }
    .badge-cancelled{ background:#f1f5f9; color:#64748b; }
    .num { text-align:right; }
    .btn.danger  { background:#ef4444; border-color:#dc2626; color:#fff; }
    .btn.primary { background:var(--accent); border-color:#0284c7; color:#fff; }
    .btn-sm { padding:2px 8px; font-size:11px; border-radius:5px; border:1px solid #cbd5e1; background:#fff; cursor:pointer; }
    .btn-sm.edit   { border-color:#0ea5e9; color:#0ea5e9; }
    .btn-sm.del    { border-color:#ef4444; color:#ef4444; }
    .btn-sm:hover.edit { background:#e0f2fe; }
    .btn-sm:hover.del  { background:#fee2e2; }
    .overlay { display:none; position:fixed; inset:0; background:rgba(15,23,42,.45); z-index:100; align-items:center; justify-content:center; }
    .overlay.open { display:flex; }
    .modal { background:var(--surface); border:1px solid var(--border); border-radius:14px; width:520px; max-width:96vw; max-height:90vh; display:flex; flex-direction:column; }
    .modal-head { display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--border); }
    .modal-head h2 { margin:0; font-size:16px; }
    .modal-close { background:none; border:none; font-size:20px; cursor:pointer; color:var(--muted); line-height:1; }
    .modal-body { padding:16px; overflow-y:auto; flex:1; }
    .modal-foot { padding:12px 16px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; align-items:center; }
    .form-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
    .form-group { display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
    .form-group label { font-size:12px; font-weight:600; color:#334155; }
    .form-group input, .form-group select, .form-group textarea { border:1px solid #cbd5e1; border-radius:7px; padding:6px 8px; font-size:13px; color:var(--text); background:#fff; width:100%; }
    .form-group input:disabled { background:#f1f5f9; color:var(--muted); }
    .po-section { margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid var(--border); }
    .po-section:last-child { border-bottom:none; margin-bottom:0; }
    .po-section h4 { margin:0 0 8px; font-size:13px; font-weight:600; color:#334155; }
    .po-calc { background:#f8fafc; border:1px solid var(--border); border-radius:8px; padding:10px 12px; font-size:13px; }
    .po-calc-row { display:flex; justify-content:space-between; padding:3px 0; }
    .po-calc-row.total { font-weight:700; border-top:1px solid var(--border); margin-top:4px; padding-top:6px; }
    .check-row { display:flex; align-items:center; gap:8px; font-size:13px; }
    #toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:#1e293b; color:#fff; padding:10px 20px; border-radius:10px; font-size:13px; opacity:0; pointer-events:none; transition:opacity .25s, transform .25s; z-index:200; max-width:420px; text-align:center; box-shadow:0 4px 16px rgba(0,0,0,.25); }
    #toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
    #toast.toast-error { background:#dc2626; }
    #toast.toast-ok    { background:#16a34a; }
    
    /* PO Print Modal */
    #overlayPrint { position:fixed; inset:0; background:rgba(0,0,0,.5); display:none; align-items:center; justify-content:center; z-index:300; }
    #overlayPrint.open { display:flex; }
    .print-modal { background:#fff; border-radius:12px; max-width:850px; width:95%; max-height:90vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,.3); }
    .print-modal-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
    .print-modal-header h2 { margin:0; font-size:18px; }
    .print-modal-actions { display:flex; gap:8px; }
    .print-modal-content { flex:1; overflow-y:auto; padding:20px; background:#f8fafc; }
    .print-preview { background:#fff; padding:40px; box-shadow:0 2px 8px rgba(0,0,0,.1); max-width:210mm; margin:0 auto; }
    
    /* Print Styles */
    @media print {
      body * { visibility: hidden; }
      #overlayPrint, #overlayPrint * { visibility: visible; }
      #overlayPrint { position:absolute; left:0; top:0; width:100%; height:100%; background:#fff; display:block !important; }
      .print-modal { max-width:none; width:100%; height:100%; border-radius:0; box-shadow:none; }
      .print-modal-header, .print-modal-actions { display:none; }
      .print-modal-content { padding:0; overflow:visible; }
      .print-preview { padding:0; box-shadow:none; margin:0; }
    }
    
    .po-print-header { margin-bottom:20px; border-bottom:2px solid #334155; padding-bottom:15px; }
    .po-print-header h1 { margin:0 0 5px; font-size:24px; color:#0f172a; }
    .po-print-header .company-info { font-size:12px; color:#64748b; line-height:1.5; }
    .po-print-meta { display:flex; justify-content:space-between; margin-bottom:20px; font-size:13px; }
    .po-print-meta div { margin:4px 0; }
    .po-print-meta label { font-weight:600; color:#334155; }
    .po-print-table { width:100%; border-collapse:collapse; margin-bottom:20px; font-size:13px; }
    .po-print-table th { background:#f1f5f9; border:1px solid #cbd5e1; padding:8px 12px; text-align:left; font-weight:600; color:#334155; }
    .po-print-table td { border:1px solid #cbd5e1; padding:8px 12px; }
    .po-print-table .num { text-align:right; }
    .po-print-totals { margin-left:auto; width:250px; }
    .po-print-totals .row { display:flex; justify-content:space-between; padding:6px 0; border-bottom:1px solid #e2e8f0; }
    .po-print-totals .row.total { font-weight:700; border-bottom:2px solid #334155; font-size:15px; }
    
    @media (max-width:920px){ .layout,.layout.collapsed{grid-template-columns:1fr;} .sidebar{border-right:0;border-bottom:1px solid var(--border);} .panel{height:auto;} .layout.collapsed .brand-text,.layout.collapsed .section-title,.layout.collapsed .label{display:initial;} }
  
