/* =========================================================
   PrintShop Manager - main stylesheet
   ========================================================= */
:root {
    --bg: #f3f5fa;
    --card: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e6e9f2;
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-soft: #eef2ff;
    --side: #0f172a;
    --side-2: #1e293b;
    --ok: #16a34a;   --ok-soft: #dcfce7;
    --warn: #d97706; --warn-soft: #fef3c7;
    --bad: #dc2626;  --bad-soft: #fee2e2;
    --info: #0284c7; --info-soft: #e0f2fe;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt0 { margin-top: 0; }
.hidden { display: none; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: linear-gradient(180deg, var(--side) 0%, #111c36 100%); color: #cbd5e1; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; color: #fff; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #06b6d4); display: grid; place-items: center; font-size: 18px; color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.45); }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .2px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: #94a3b8; font-weight: 500; }
.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav-title { font-size: 10.5px; letter-spacing: 1.2px; color: #64748b; text-transform: uppercase; padding: 16px 10px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: #cbd5e1; font-weight: 500; margin-bottom: 2px; text-decoration: none; transition: background .15s, color .15s; }
.nav a i { width: 18px; text-align: center; font-size: 14px; color: #94a3b8; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.10)); color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
.nav a.active i { color: #a5b4fc; }
.nav .badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #334155; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.side-foot .who { line-height: 1.2; min-width: 0; }
.side-foot .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11px; color: #94a3b8; }

.main { margin-left: 248px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 28px; gap: 16px; position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 19px; letter-spacing: -.2px; }
.topbar .date { color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--ink); }
.content { padding: 24px 28px 40px; max-width: 1500px; width: 100%; }

/* ---------- notification bell ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 16px; color: var(--ink); }
.bell:hover { background: var(--brand-soft); }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 19px; height: 19px; line-height: 19px; border-radius: 20px; text-align: center; padding: 0 5px; border: 2px solid #fff; }
.bell-panel { display: none; position: absolute; right: 0; top: 48px; width: 380px; max-height: 480px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 48px rgba(15,23,42,.18); z-index: 60; }
.bell-panel.open { display: block; }
.bell-head { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.bell-sec { padding: 8px 16px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; background: #f8fafc; }
.bell-item { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #f1f4f9; color: var(--ink); text-decoration: none; }
.bell-item:hover { background: #f8fafc; text-decoration: none; }
.bell-item .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 13px; }
.ic-warn { background: var(--warn-soft); color: var(--warn); } .ic-bad { background: var(--bad-soft); color: var(--bad); } .ic-info { background: var(--info-soft); color: var(--info); }
.bell-item .t { font-weight: 600; font-size: 13px; } .bell-item .s { font-size: 12px; color: var(--muted); }
.bell-empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ---------- stat tiles ---------- */
.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; position: relative; overflow: hidden; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: none; }
.stat .lbl { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .val { font-size: 23px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.stat .hint { font-size: 12px; color: var(--muted); }
.ic-brand { background: var(--brand-soft); color: var(--brand); } .ic-ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span2 { grid-column: span 2; } .form-grid .span3 { grid-column: span 3; } .form-grid .span4 { grid-column: span 4; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.field label .req { color: var(--bad); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], select, textarea, .input {
    width: 100%; padding: 9px 12px; border: 1px solid #d5dbe8; border-radius: 9px; background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
input[readonly], .input[readonly] { background: #f8fafc; }
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.inline-check input { width: auto; }
.seg { display: inline-flex; background: #eef1f8; border-radius: 10px; padding: 4px; gap: 4px; }
.seg label { margin: 0; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg input { display: none; }
.seg input:checked + label { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.seg span { display: contents; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; transition: transform .05s, background .15s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.35); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ok { background: var(--ok); color: #fff; } .btn-ok:hover { background: #15803d; }
.btn-danger { background: var(--bad); color: #fff; } .btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: #fff; color: var(--ink); border-color: #d5dbe8; } .btn-ghost:hover { background: #f4f6fb; }
.btn-soft { background: var(--brand-soft); color: var(--brand); } .btn-soft:hover { background: #e0e7ff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; padding: 11px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fafbff; }
.tbl tr.click { cursor: pointer; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--line); }
.tbl .strong { font-weight: 600; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty i { display: block; font-size: 28px; margin-bottom: 8px; opacity: .5; }

/* ---------- pills / alerts ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; background: #eef1f8; color: #475569; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: #166534; } .pill-warn { background: var(--warn-soft); color: #92400e; }
.pill-bad { background: var(--bad-soft); color: #991b1b; } .pill-info { background: var(--info-soft); color: #075985; }
.pill-gst { background: #ede9fe; color: #5b21b6; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; display: flex; gap: 10px; align-items: flex-start; font-weight: 500; border: 1px solid; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #f0f9ff; color: #075985; border-color: #bae6fd; }

/* ---------- filter bar ---------- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; }
.filters .field { min-width: 140px; }
.filters .grow { flex: 1; min-width: 220px; }

/* ---------- dashboard widgets ---------- */
.remind { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid #eef1f7; color: var(--ink); text-decoration: none; }
.remind:last-child { border-bottom: 0; }
.remind:hover { background: #fafbff; text-decoration: none; }
.remind .main-t { font-weight: 600; } .remind .sub-t { color: var(--muted); font-size: 12.5px; }
.remind .grow { flex: 1; min-width: 0; }
.remind .amt { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 14px 8px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; width: 100%; justify-content: center; }
.chart .bar { width: 38%; max-width: 26px; border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-sales { background: linear-gradient(180deg, #818cf8, #4f46e5); } .bar-coll { background: linear-gradient(180deg, #34d399, #059669); }
.chart .lbl { font-size: 11px; color: var(--muted); margin-top: 6px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------- order detail ---------- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; }
.kv dt { color: var(--muted); font-size: 12.5px; } .kv dd { margin: 0; font-weight: 500; }
.totals { width: 100%; max-width: 340px; margin-left: auto; }
.totals td { padding: 6px 0; } .totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand td { border-top: 2px solid var(--ink); padding-top: 10px; font-size: 17px; font-weight: 800; }
.progress { height: 10px; border-radius: 10px; background: #e8ecf5; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #34d399, #059669); border-radius: 10px; }
.timeline { position: relative; padding-left: 22px; }
.timeline .ev { position: relative; padding-bottom: 14px; }
.timeline .ev:before { content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline:before { content: ''; position: absolute; left: -13px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }

/* ---------- tokens ---------- */
.token-card { text-align: center; padding: 26px 20px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; border-radius: var(--radius); box-shadow: 0 12px 30px rgba(79,70,229,.35); }
.token-card .lbl { text-transform: uppercase; letter-spacing: 2px; font-size: 12px; opacity: .85; }
.token-card .no { font-size: 64px; font-weight: 800; letter-spacing: 2px; line-height: 1.1; }
.token-card .sub { opacity: .9; }
.token-chip { display: inline-grid; place-items: center; min-width: 54px; height: 34px; padding: 0 10px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-weight: 800; letter-spacing: .5px; }

/* ---------- login ---------- */
.login-bg { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-hero { background: radial-gradient(circle at 20% 20%, #6366f1 0, transparent 45%), radial-gradient(circle at 80% 80%, #06b6d4 0, transparent 40%), #0f172a; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h2 { font-size: 36px; line-height: 1.15; letter-spacing: -.8px; max-width: 460px; }
.login-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; color: #cbd5e1; }
.login-hero li i { color: #34d399; margin-right: 10px; }
.login-box { display: grid; place-items: center; padding: 32px; }
.login-form { width: 100%; max-width: 380px; }
.login-form h3 { font-size: 26px; letter-spacing: -.5px; margin-bottom: 4px; }
.login-form .field { margin-bottom: 16px; }

/* ---------- misc ---------- */
.hint-box { background: var(--brand-soft); border: 1px dashed #c7d2fe; color: #3730a3; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; }
.link-row { cursor: pointer; }
.err { color: var(--bad); font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.tag { display: inline-block; font-size: 11px; background: #eef1f8; color: #475569; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cust-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--brand-soft); border: 1px solid #c7d2fe; border-radius: 12px; }
.cust-card .avatar { background: var(--brand); width: 46px; height: 46px; font-size: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-main, .g3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid .span3, .form-grid .span4 { grid-column: span 2; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .menu-btn { display: block; }
    .content { padding: 16px; }
    .topbar { padding: 0 14px; }
    .topbar .date { display: none; }
    .g2, .g4 { grid-template-columns: 1fr; }
    .login-bg { grid-template-columns: 1fr; } .login-hero { display: none; }
    .bell-panel { position: fixed; left: 12px; right: 12px; top: 68px; width: auto; }
}
@media print {
    .sidebar, .topbar, .no-print, .filters, .btn { display: none !important; }
    .main { margin: 0; } .content { padding: 0; max-width: none; }
    body { background: #fff; } .card { box-shadow: none; border-color: #ccc; }
}

/* ---------- misc additions ---------- */
.sticky { position: sticky; top: 84px; }
.g-order { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); align-items: start; }
@media (max-width: 1100px) { .g-order { grid-template-columns: 1fr; } .sticky { position: static; } }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; margin-right: 8px; }
.sum-row { display: flex; justify-content: space-between; padding: 5px 0; }
.sum-row.grand { border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 12px; font-size: 20px; font-weight: 800; }
.item-add { background: #f8faff; border: 1px dashed #c7d2fe; border-radius: 12px; padding: 16px; }
