:root{
  --navy:#0a2d5e; --navy-2:#0e3a78; --blue:#1b6fc4; --blue-soft:#e8f1fb;
  --red:#e2231a; --ink:#1f2734; --muted:#7a8699; --line:#e6ebf2; --bg:#f4f6fb;
}
*{box-sizing:border-box}
body{margin:0;font-family:"Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;background:var(--bg);color:var(--ink)}

/* ---- Login ---- */
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:24px;position:relative;
  background:
    linear-gradient(135deg,rgba(10,45,94,.86),rgba(18,58,114,.78)),
    url('../img/login_bg.jpg') center/cover no-repeat fixed;}
.login-wrap::after{content:"";position:absolute;inset:0;
  background:radial-gradient(1000px 500px at 15% -10%,rgba(27,79,156,.45),transparent 60%);
  pointer-events:none}
.login-card{position:relative;z-index:1;width:100%;max-width:410px;background:rgba(255,255,255,.97);border-radius:16px;
  box-shadow:0 24px 70px rgba(4,20,48,.55);overflow:hidden;backdrop-filter:blur(2px)}
.login-foot-note{position:absolute;bottom:14px;left:0;right:0;text-align:center;color:rgba(255,255,255,.85);font-size:12px;z-index:1;text-shadow:0 1px 3px rgba(0,0,0,.5)}
.login-head{background:#fff;padding:26px 30px 6px;text-align:center}
.login-body{padding:8px 30px 30px}
.brand-logo{display:inline-flex;align-items:center;gap:10px;font-weight:800;font-size:26px;letter-spacing:.5px}
.brand-logo .m{background:var(--blue);color:#fff;width:44px;height:44px;border-radius:10px;
  display:grid;place-items:center;font-size:26px;box-shadow:inset 0 -6px 0 rgba(0,0,0,.12)}
.brand-logo .al{color:var(--navy)} .brand-logo .port{color:var(--red)}

/* ---- Layout ---- */
.app{display:flex;min-height:100vh}
.sidebar{width:250px;background:linear-gradient(180deg,var(--navy),#08234a);color:#cdd8ea;
  position:fixed;top:0;left:0;bottom:0;display:flex;flex-direction:column;z-index:1030}
.sidebar .side-head{padding:18px 18px;border-bottom:1px solid rgba(255,255,255,.08)}
.sidebar .brand-logo{font-size:20px;color:#fff}
.sidebar .brand-logo .al{color:#fff} .sidebar .brand-logo .m{width:36px;height:36px;font-size:20px;border-radius:8px}
.side-tag{font-size:11px;color:#8fa6c9;margin-top:6px;letter-spacing:.3px}
.side-nav{padding:12px 10px;overflow-y:auto;flex:1}
.side-nav a{display:flex;align-items:center;gap:11px;padding:11px 14px;border-radius:9px;
  color:#c7d3e8;text-decoration:none;font-size:14.5px;margin-bottom:3px;transition:.15s}
.side-nav a i{font-size:17px;width:20px;text-align:center}
.side-nav a:hover{background:rgba(255,255,255,.07);color:#fff}
.side-nav a.active{background:var(--blue);color:#fff;box-shadow:0 6px 16px rgba(27,111,196,.4)}
.side-sec{font-size:11px;text-transform:uppercase;letter-spacing:1px;color:#6d84a8;padding:14px 16px 6px}
.side-foot{padding:14px;border-top:1px solid rgba(255,255,255,.08);font-size:12px;color:#8fa6c9}

.main{margin-left:250px;flex:1;display:flex;flex-direction:column;min-width:0}
.topbar{height:64px;background:#fff;border-bottom:1px solid var(--line);display:flex;
  align-items:center;justify-content:space-between;padding:0 22px;position:sticky;top:0;z-index:1020}
.topbar h1{font-size:18px;margin:0;font-weight:700}
.content{padding:24px;flex:1}
.menu-toggle{display:none;background:none;border:0;font-size:22px;color:var(--navy)}

/* ---- Cards / stats ---- */
.card{border:1px solid var(--line);border-radius:14px;box-shadow:0 2px 10px rgba(20,40,80,.04)}
.card-header{background:#fff;border-bottom:1px solid var(--line);font-weight:700}
.stat{display:flex;align-items:center;gap:16px;padding:20px;background:#fff;border-radius:14px;
  border:1px solid var(--line);box-shadow:0 3px 14px rgba(20,40,80,.05)}
.stat .ic{width:54px;height:54px;border-radius:13px;display:grid;place-items:center;font-size:26px;color:#fff;flex:none}
.stat .val{font-size:28px;font-weight:800;line-height:1}
.stat .lbl{color:var(--muted);font-size:13px;margin-top:4px}
.ic-in{background:linear-gradient(135deg,#16a34a,#0f7a37)}
.ic-out{background:linear-gradient(135deg,#1b6fc4,#0e4c93)}
.ic-yard{background:linear-gradient(135deg,#f59e0b,#c76f05)}
.ic-total{background:linear-gradient(135deg,#6366f1,#3f43c9)}

.table thead th{background:var(--blue-soft);color:var(--navy);font-size:12.5px;text-transform:uppercase;
  letter-spacing:.4px;border-bottom:2px solid #d5e4f6}
.table td{vertical-align:middle;font-size:14px}
.mono{font-family:"Consolas",monospace;font-weight:600;letter-spacing:.3px}
.page-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-bottom:18px}
.page-head h2{margin:0;font-size:20px;font-weight:700}
.btn-navy{background:var(--navy);border-color:var(--navy);color:#fff}
.btn-navy:hover{background:var(--navy-2);color:#fff}
.required-star{color:var(--red)}
.form-label{font-weight:600;font-size:13.5px;color:#33415c}

/* ---- Print slip ---- */
@media print{ .no-print{display:none!important} .main{margin:0} body{background:#fff} }
.slip{max-width:820px;margin:0 auto;border:2px solid var(--navy);padding:0}
.slip-head{display:flex;justify-content:space-between;align-items:center;background:var(--navy);color:#fff;padding:12px 18px}
.slip table{width:100%;border-collapse:collapse}
.slip table td,.slip table th{border:1px solid #223;padding:8px 10px;font-size:13px}
.slip .lbl-cell{background:#eef3fb;font-weight:600;width:26%}

@media(max-width:900px){
  .sidebar{transform:translateX(-100%);transition:.25s} .sidebar.open{transform:none}
  .main{margin-left:0} .menu-toggle{display:block}
}

/* ===== Real logo image ===== */
.login-logo{max-width:200px;width:70%;height:auto;display:block;margin:0 auto}
.logo-chip{background:#fff;border-radius:12px;padding:10px 12px;display:inline-block;box-shadow:0 2px 8px rgba(0,0,0,.15)}
.logo-chip img{max-width:150px;width:100%;height:auto;display:block}
.side-head{text-align:center}
/* Print form logo */
.form-logo{height:64px;width:auto}
@media print{
  .form-logo{height:60px}
}

/* ===== Authentic Alport print form ===== */
.gform{max-width:900px;margin:0 auto;background:#fff;border:2px solid #0a2d5e;color:#111;font-size:12px}
.gform-head{display:flex;align-items:center;justify-content:space-between;border-bottom:2px solid #0a2d5e;padding:8px 12px;gap:10px}
.gform-head .title{flex:1;text-align:center}
.gform-head .title .t-tr{font-weight:700;font-size:15px;color:#0a2d5e;line-height:1.2}
.gform-head .title .t-so{font-weight:600;font-size:13px;color:#0a2d5e}
.gform-head .title .t-en{font-size:12px;color:#333;font-style:italic}
.gform-head .serial{text-align:right;font-size:12px;white-space:nowrap}
.gform-head .serial b{color:#b40000;font-size:16px;letter-spacing:1px}
.gsec{background:#0a2d5e;color:#fff;padding:4px 12px;font-weight:600;font-size:12px}
.gsec small{display:block;font-weight:400;opacity:.85;font-size:10px}
.gform table{width:100%;border-collapse:collapse}
.gform .kv td{border:1px solid #0a2d5e;padding:5px 10px;vertical-align:top}
.gform .kv td.k{background:#eef2f9;width:34%;font-weight:600}
.gform .kv td.k .lbl-tr{color:#0a2d5e}
.gform .kv td.k .lbl-so{font-size:11px;color:#345}
.gform .kv td.k .lbl-en{font-size:10px;color:#667;font-style:italic}
.gform .grid th{border:1px solid #0a2d5e;background:#0a2d5e;color:#fff;padding:5px 6px;font-size:11px;text-align:center}
.gform .grid th small{display:block;font-weight:400;opacity:.85;font-size:9px}
.gform .grid td{border:1px solid #0a2d5e;padding:8px 6px;text-align:center;font-size:12px;height:44px}
.gsign td{border:1px solid #0a2d5e;padding:6px 10px;height:78px;vertical-align:top;width:33.33%;font-size:10px;color:#0a2d5e}
.gsign td .role-tr{font-weight:700;font-size:11px}
.gnote{padding:6px 12px;font-size:11px;color:#b40000;font-weight:600;border-top:1px solid #0a2d5e;text-align:center}
.gform-foot{display:flex;justify-content:space-between;padding:4px 12px;font-size:11px;color:#555;border-top:1px solid #0a2d5e}
@page{size:A4;margin:12mm}
@media print{
  body{background:#fff !important;padding:0 !important}
  .gform{border-width:2px;max-width:100%}
}

/* ===== Excel-style printable report ===== */
.report-sheet{max-width:1000px;margin:0 auto;background:#fff;padding:22px;border:1px solid #ccd}
.rep-head{display:flex;align-items:center;justify-content:space-between;border-bottom:3px solid #0a2d5e;padding-bottom:10px;margin-bottom:14px}
.rep-logo{height:56px;width:auto}
.rep-meta{text-align:right;font-size:12px;color:#333;line-height:1.6}
.rep-title{text-align:center;font-weight:800;letter-spacing:1px;color:#0a2d5e;font-size:20px;margin:10px 0 8px}
.rep-table{width:100%;border-collapse:collapse;font-size:12.5px}
.rep-table th{background:#1656b4;color:#fff;border:1px solid #0a2d5e;padding:6px 8px;text-align:center;font-weight:700}
.rep-table td{border:1px solid #99a;padding:5px 8px;text-align:center}
.rep-table td.mono{text-align:left;font-family:ui-monospace,Menlo,Consolas,monospace;font-weight:600}
.rep-table .c-no{width:44px}
.rep-table .c-sz{width:54px}
.rep-table td.x{font-weight:800;color:#0a2d5e;background:#eef3fb}
.rep-table tbody tr:nth-child(even) td{background:#f6f8fc}
.rep-table td.empty{text-align:center;color:#889;padding:18px}
.rep-count{text-align:right;font-size:13px;margin-top:6px;color:#0a2d5e}
.rep-foot{margin-top:18px;text-align:center;font-size:11px;color:#667;border-top:1px solid #ccd;padding-top:8px}
@media print{
  body{background:#fff !important;padding:0 !important}
  .report-sheet{border:0;max-width:100%;padding:0}
  .rep-table th{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .rep-table td.x,.rep-table tbody tr:nth-child(even) td{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
.rep-break{page-break-before:always}
.rep-formno{font-size:12px;color:#667;font-weight:600}

/* Small stat cards for approval counts */
.stat-sm{padding:12px;text-align:center;justify-content:center}
.stat-sm .val{font-size:22px;font-weight:700;line-height:1}
.stat-sm .lbl{font-size:11px;color:#667}

/* ===== Per-form accent color + QR + approval stamp ===== */
.gform{--accent:#0a2d5e;position:relative}
.gform-head{border-bottom-color:var(--accent)}
.gform-head .title .t-tr,.gform-head .title .t-so{color:var(--accent)}
.gsec{background:var(--accent)}
.gform .grid th{background:var(--accent)}
.gform-foot{color:var(--accent)}
.gform-head .right-col{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.qrbox{background:#fff;padding:3px;border:1px solid #ddd;border-radius:4px}
.qrbox img,.qrbox canvas{display:block}
.qr-cap{font-size:8px;color:#667;text-align:center;margin-top:2px}
.gstamp{position:absolute;right:26px;bottom:96px;transform:rotate(-11deg);
  border:3px solid;border-radius:8px;padding:4px 14px;text-align:center;
  font-weight:800;letter-spacing:1px;opacity:.88;background:rgba(255,255,255,.4)}
.gstamp .st-main{font-size:20px;line-height:1}
.gstamp .st-sub{font-size:8px;font-weight:600;letter-spacing:0}
@media print{
  .gstamp{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .gsec,.gform .grid th{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
.side-nav a{display:flex;align-items:center}
.side-nav a .badge.ms-auto{margin-left:auto}

/* ===== Two copies on one A4 page ===== */
.print-sheet{max-width:900px;margin:0 auto}
.print-copy{page-break-inside:avoid;break-inside:avoid}
.print-copy .gform{font-size:10px}
.print-copy .gform-head{padding:4px 10px}
.print-copy .gform-head .title .t-tr{font-size:12px;line-height:1.1}
.print-copy .gform-head .title .t-so{font-size:11px}
.print-copy .gform-head .title .t-en{font-size:10px}
.print-copy .form-logo{height:42px}
.print-copy .serial b{font-size:13px}
.print-copy .gsec{padding:2px 10px;font-size:11px}
.print-copy .gsec small{font-size:9px}
.print-copy .kv td{padding:2px 8px}
.print-copy .grid th{padding:2px 4px}
.print-copy .grid td{height:26px;padding:3px 4px}
.print-copy .gsign td{height:38px;padding:3px 8px}
.print-copy .gnote{padding:2px 8px;font-size:9px}
.print-copy .gform-foot{padding:2px 10px;font-size:9px}
.print-copy .grid td{height:22px;padding:2px 4px}
.print-copy .gsec{padding:1px 10px;font-size:11px;line-height:1.25}
.print-copy .qrbox{padding:2px}
.print-copy .qrbox img,.print-copy .qrbox canvas{width:60px !important;height:60px !important}
.print-copy .gstamp{bottom:66px;padding:2px 10px}
.print-copy .gstamp .st-main{font-size:14px}
.copy-tag{background:var(--accent);color:#fff;font-size:9px;font-weight:700;letter-spacing:3px;text-align:center;padding:1px}
.cut-line{color:#888;font-size:10px;white-space:nowrap;overflow:hidden;padding:3px 0;text-align:center}
@media screen{ .print-copy{ margin-bottom:8px } }
@media print{
  @page{size:A4 portrait;margin:6mm}
  body{background:#fff !important;padding:0 !important}
  .print-sheet{max-width:100%}
  .cut-line{page-break-inside:avoid}
  .copy-tag,.gsec,.grid th,.gstamp{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* wide wordmark logo fits invoice header */
.gform-head .form-logo{height:auto;max-height:46px;max-width:150px;width:auto}
.print-copy .gform-head .form-logo{max-height:38px;max-width:130px}
.login-logo{max-width:260px;width:80%}
.logo-chip img{max-width:170px}
