:root{--nav:#191647;--nav2:#26205b;--primary:#4f46e5;--text:#17203a;--muted:#75809a;--bg:#f4f6fa;--line:#e3e7f0}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px Arial,sans-serif}.app{display:flex;min-height:100vh}.sidebar{width:258px;background:linear-gradient(180deg,#211d52,#131132);color:#c5c4e8;padding:22px 13px;position:fixed;inset:0 auto 0 0}.brand{display:flex;gap:11px;align-items:center;padding:0 8px 22px;border-bottom:1px solid #ffffff18;color:#fff}.brand-icon{background:#5c42ff;border-radius:13px;padding:10px 12px;font-size:22px}.brand b{display:block;font-size:16px}.brand small,.side-total small{display:block;color:#aaa8d0;margin-top:5px}nav{padding-top:12px}nav label{display:block;font-size:11px;font-weight:bold;color:#827fb6;margin:13px 12px 7px}nav a{display:flex;gap:13px;align-items:center;color:#c5c4e8;text-decoration:none;padding:12px;border-radius:13px;font-size:14px;margin-bottom:3px}nav a:hover,nav a.active{background:#5b50f3;color:#fff}.side-total{position:absolute;bottom:20px;left:13px;right:13px;background:#2b266c;border:1px solid #514a9b;border-radius:15px;padding:15px;color:#dcdcff}.side-total strong{display:block;font-size:19px;color:#fff;margin:8px 0}.progress{height:6px;background:#48447e;border-radius:8px}.progress i{display:block;width:69%;height:100%;background:linear-gradient(90deg,#8176ff,#00d7a1);border-radius:8px}.content{margin-left:258px;flex:1}header{height:75px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 25px}h1{font-size:21px;margin:0 0 3px}header small{color:var(--muted)}.top-actions{display:flex;gap:9px;align-items:center}.date,.btn{border-radius:12px;padding:10px 14px;font-weight:bold;text-decoration:none;white-space:nowrap}.date{border:1px solid var(--line);color:#53607c}.btn{color:#fff}.orange{background:#f45114}.green{background:#079d6d}.purple{background:#242052}.top-actions .purple{background:#2a255e}main{padding:28px;max-width:1120px;margin:auto}.hero{background:linear-gradient(110deg,#282260,#4737c9);color:white;border-radius:22px;padding:29px 32px;display:flex;justify-content:space-between;align-items:center;box-shadow:0 12px 24px #2d276433}.hero h2{margin:0 0 7px;font-size:16px}.hero .value{font-size:32px;font-weight:800;margin:14px 0}.hero small{color:#d6d4ff}.hero-side{display:flex;align-items:center;gap:36px}.chart-box{height:155px;width:312px;border:1px solid #ffffff29;border-radius:15px;padding:16px;color:#c7c5ee}.fake-chart{height:85px;border-bottom:2px solid #ffffff26;margin-top:8px;background:linear-gradient(160deg,transparent 44%,#7e77e6 45%,transparent 47%),linear-gradient(25deg,transparent 48%,#a69eff 49%,transparent 51%)}.donut{width:112px;height:112px;border-radius:50%;background:conic-gradient(#06d29d 69%,#ffffff27 0);display:grid;place-items:center;font-size:25px;font-weight:bold}.donut:after{content:"";position:absolute;width:78px;height:78px;background:#3c31af;border-radius:50%}.donut span{z-index:1}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin:24px 0}.card,.panel{background:#fff;border:1px solid var(--line);border-radius:16px;padding:20px;box-shadow:0 3px 10px #18224b08}.metric label{color:#69758f}.metric strong{display:block;font-size:22px;margin:18px 0 6px}.metric em{color:#07a66d;font-style:normal;font-weight:bold}.grid2{display:grid;grid-template-columns:1.5fr 1fr;gap:22px}.panel h3{margin:0 0 5px}.muted{color:var(--muted)}table{width:100%;border-collapse:collapse;background:#fff}th,td{text-align:left;padding:13px 11px;border-bottom:1px solid var(--line)}th{font-size:12px;color:#6e7791;background:#fafbfe}td strong{color:#202a43}.form-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:24px;max-width:1000px}.form-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:15px}.field label{display:block;font-weight:bold;margin-bottom:6px}.field input,.field select,.field textarea{width:100%;border:1px solid #dce1ec;border-radius:9px;padding:10px;font:inherit}.field textarea{min-height:80px}.wide{grid-column:1/-1}.submit{border:0;border-radius:10px;background:#4f46e5;color:white;padding:12px 20px;font-weight:bold;cursor:pointer}.alert{padding:12px 16px;border-radius:10px;margin-bottom:18px}.success{background:#e3f8ee;color:#087b55}.error{background:#ffe9e5;color:#b32e1b}.toolbar{display:flex;gap:10px;margin-bottom:17px}.toolbar input,.toolbar select{padding:10px;border:1px solid var(--line);border-radius:9px}.low{color:#e33b32;font-weight:bold}.ok{color:#0a9d6d;font-weight:bold}@media(max-width:900px){.sidebar{width:76px}.sidebar .brand div,nav label,nav a span,.side-total{display:none}.content{margin-left:76px}.top-actions .date{display:none}.cards{grid-template-columns:repeat(2,1fr)}.hero-side{display:none}.grid2{grid-template-columns:1fr}}

/* ===== Exact sales / warehouse form layout ===== */
.topbar{height:86px;padding:0 28px}
.page-heading h1{font-size:22px;letter-spacing:-.3px}
.page-heading small{font-size:13px}
.top-actions{gap:10px}
.top-actions .date{height:50px;min-width:159px;display:flex;align-items:center;justify-content:center;gap:5px;line-height:16px;font-size:12px}
.top-actions .date b{font-size:12px}
.top-btn{min-height:50px;display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 15px;border-radius:13px;color:#fff;text-decoration:none;font-weight:800;text-align:center;line-height:17px;box-shadow:0 3px 0 rgba(0,0,0,.08)}
.top-btn.orange{background:#fa4b0b}.top-btn.green{background:#009c6b}.top-btn.violet{background:#4f35f2}.top-btn.navy{background:#201b4e}
main{max-width:none;padding:28px 28px 42px}

.sales-page{display:grid;grid-template-columns:minmax(680px,1fr) 330px;gap:25px;align-items:start;max-width:1080px;margin:0 auto}
.sales-card,.summary-card,.recent-card{background:#fff;border:1px solid #e0e5ee;box-shadow:0 2px 5px rgba(23,32,58,.04)}
.sales-card{border-radius:16px;border-top:3px solid #ff5a0a;padding:25px 24px 20px;overflow:hidden}
.sales-card-head{display:flex;justify-content:space-between;align-items:flex-start;padding-bottom:14px;border-bottom:1px solid #e5e9f1}
.sales-card-head h2{margin:0;color:#182138;font-size:17px;letter-spacing:.1px}
.sales-card-head p{margin:3px 0 0;color:#60718e;font-size:13px}
.doc-badge{background:#fff0db;color:#fa4b0b;border-radius:15px;padding:6px 13px;font-size:11px;white-space:nowrap}
.sales-fields{display:grid;grid-template-columns:1fr 1fr 1.08fr;gap:13px;margin:20px 0}
.field label{font-size:13px;color:#31405e;margin-bottom:6px}.field label b{color:#ff520a}
.sales-fields input{height:36px;border:1px solid #d7dfed;border-radius:11px;width:100%;padding:0 12px;color:#2b3650;background:#fff}
.input-icon{position:relative}.input-icon input{padding-right:35px}.input-icon span{position:absolute;right:10px;top:9px;color:#687792;font-size:12px}
.product-search{border:2px dashed #b9caff;border-radius:11px;height:44px;display:flex;align-items:center;padding:0 13px;margin-bottom:20px;color:#a1a9b8}
.product-search input{border:0;outline:0;flex:1;font:inherit;font-size:14px;background:transparent;margin-left:8px;color:#48536a}
.search-icon{font-size:24px;color:#829ed3;line-height:1}.search-hint{font-size:11px;color:#9ba5b6}
.sales-table-wrap{overflow-x:auto;border-radius:9px}
.sales-table{min-width:780px;border-collapse:separate;border-spacing:0}
.sales-table thead th{background:#ff6208;color:#fff;border:0;height:52px;padding:0 12px;font-size:12px;white-space:nowrap}
.sales-table thead th:first-child{border-radius:8px 0 0 8px}.sales-table thead th:last-child{border-radius:0 8px 8px 0}
.sales-table td{height:70px;padding:9px 10px;border-bottom:1px solid #ebeff5;vertical-align:middle;color:#31405c}
.stt-col{width:50px;text-align:center}.unit-col{width:66px}.qty-col{width:95px}.price-col{width:115px}.money-col{width:125px}.remove-col{width:35px}
.row-no{text-align:center;color:#8895ab}
.product-cell{display:flex;align-items:center;gap:10px;min-width:315px}
.product-thumb{height:31px;width:31px;border-radius:8px;background:linear-gradient(145deg,#34465c,#101925);color:#fff;display:grid;place-items:center;font-size:15px;flex:none}
.product-select{border:0;outline:0;background:#fff;color:#28344e;font-weight:800;font-size:13px;max-width:285px}
.stock-label{display:block;color:#8b97aa;font-size:11px;margin-top:4px}.stock-label b{color:#6886a7}
.quantity-input,.price-input{width:80px;height:27px;border:1px solid #dbe2ee;border-radius:8px;text-align:center;color:#26324c;font-weight:700}
.price-input{width:105px}.amount-cell{font-weight:800;white-space:nowrap}.remove-row{border:0;background:transparent;color:#e55757;font-size:20px;cursor:pointer}
.quick-title{font-size:12px;color:#6b7d9a;margin-top:20px;margin-bottom:7px;font-weight:700}
.quick-products{display:flex;gap:6px;flex-wrap:wrap}.quick-product{border:0;background:#f0f4f9;color:#45607e;border-radius:8px;padding:6px 10px;font-size:11px;cursor:pointer}.quick-product:hover{background:#e3eafe;color:#4054c7}
.sales-bottom{margin-top:15px;display:flex;justify-content:flex-end;align-items:center}.row-note{color:#99a3b3;font-size:11px}.hidden-submit{display:none}

.sales-summary{display:flex;flex-direction:column;gap:16px}
.summary-card{border-radius:15px;border-top:3px solid #ff5a0a;padding:24px}
.summary-title{font-size:13px;color:#71809c;font-weight:800;letter-spacing:.3px}
.summary-total{font-size:28px;color:#f04b10;font-weight:900;margin:21px 0;border-bottom:1px dashed #d8deea;padding-bottom:18px}
.summary-line{display:flex;justify-content:space-between;color:#75839d;font-size:13px;padding:9px 0;border-bottom:1px dashed #d8deea}.summary-line b{color:#28334c;font-size:12px}
.words-box{background:#f6f8fb;border:1px solid #edf0f5;border-radius:11px;padding:13px;margin:16px 0;color:#33415b;font-size:12px;line-height:18px}.words-box i{font-weight:700}
.save-sale,.print-sale{width:100%;height:40px;border:0;border-radius:12px;color:#fff;font-weight:800;font-size:13px;cursor:pointer}.save-sale{background:#fb4b09}.print-sale{background:#10192f;margin-top:8px}.new-sale{display:block;text-align:center;color:#9aa5b7;text-decoration:none;font-size:12px;margin-top:13px}
.recent-card{border-radius:15px;padding:18px}.recent-card h3{font-size:13px;margin:0 0 13px;color:#27334d}.recent-item{display:flex;justify-content:space-between;align-items:center;background:#f7f9fc;border-radius:10px;padding:9px;margin-bottom:7px}.recent-item strong{display:block;color:#fa4b0b;font-size:11px}.recent-item small{display:block;color:#8492a8;font-size:10px;margin-top:4px;max-width:145px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.recent-value{text-align:right}.recent-value b{display:block;color:#2e3a53;font-size:11px}.recent-value small{max-width:none}.empty-recent{text-align:center;color:#9ba4b2;font-size:12px;padding:20px 5px}
.nav-icon{width:18px;text-align:center;font-size:16px}.nav-count{margin-left:auto;background:#ff4053;color:#fff;border-radius:10px;padding:3px 8px;font-size:11px}.download-badge{margin-left:auto;background:#b47a22;color:#fff;border-radius:10px;padding:3px 8px;font-size:10px;white-space:nowrap}
@media(max-width:1050px){.sales-page{grid-template-columns:1fr}.sales-summary{display:grid;grid-template-columns:1fr 1fr}.sales-fields{grid-template-columns:1fr 1fr}.sales-fields .field:last-child{grid-column:1/-1}}
@media(max-width:700px){.sales-page{display:block}.sales-summary{display:block;margin-top:18px}.sales-fields{grid-template-columns:1fr}.sales-fields .field:last-child{grid-column:auto}.top-actions .violet,.top-actions .navy{display:none}.top-actions .date{min-width:auto}.topbar{padding:0 14px}.page-heading small{display:none}main{padding:16px}.sales-card{padding:16px}.sales-card-head h2{font-size:14px}.doc-badge{display:none}}

/* ===== Final sales screen alignment ===== */
.sales-page{
    max-width:none;
    width:100%;
    margin:0;
    grid-template-columns:minmax(0,1fr) 330px;
}
.sales-editor,.sales-card{min-width:0}
.sales-table-wrap{width:100%;max-width:100%}
@media (min-width:1200px){
    .sales-page{gap:25px}
}


/* ===== Live product search for sales form ===== */
.product-search-wrap{position:relative;margin:20px 0 12px;z-index:20}
.product-search-wrap .product-search{margin:0}
.search-results{
    display:none;
    position:absolute;
    top:calc(100% + 6px);
    left:0;
    right:0;
    max-height:300px;
    overflow-y:auto;
    background:#fff;
    border:1px solid #dbe4f3;
    border-radius:12px;
    box-shadow:0 16px 32px rgba(29,43,77,.18);
    padding:6px;
}
.search-results.is-open{display:block}
.search-result{
    width:100%;
    min-height:58px;
    display:flex;
    align-items:center;
    gap:10px;
    text-align:left;
    border:0;
    border-bottom:1px solid #edf0f5;
    background:#fff;
    padding:8px 10px;
    cursor:pointer;
    color:#26344f;
}
.search-result:last-of-type{border-bottom:0}
.search-result:hover{background:#f2f5ff}
.search-result[hidden]{display:none}
.result-thumb{
    width:34px;height:34px;flex:0 0 34px;display:grid;place-items:center;
    border-radius:9px;background:linear-gradient(145deg,#334d6e,#131d31);color:#fff;
}
.result-main{min-width:0;flex:1}
.result-main b{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.result-main small{display:block;margin-top:3px;color:#7c8aa2;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.result-stock{font-size:10px;color:#7a879d;white-space:nowrap}
.result-stock b{color:#4b6f9c}
.result-price{min-width:88px;text-align:right;color:#f04b10;font-size:12px;white-space:nowrap}
.no-search-result{padding:18px 10px;text-align:center;color:#8d98aa;font-size:12px}
.no-search-result[hidden]{display:none}
@media(max-width:700px){
    .search-hint{display:none}
    .result-stock{display:none}
    .result-price{min-width:76px}
}


/* ===== Typography and invoice actions ===== */
html, body, button, input, select, textarea {
    font-family: "Segoe UI", "Inter", Arial, sans-serif;
    font-synthesis: none;
}

button, .btn, .top-btn, .save-sale, .print-sale, .quick-product {
    font-family: "Segoe UI", "Inter", Arial, sans-serif;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
    text-rendering: optimizeLegibility;
}

.summary-total, .amount-cell, .recent-value b, .side-total strong {
    font-variant-numeric: tabular-nums;
}

.words-box i {
    display: inline;
    font-family: "Segoe UI", "Inter", Arial, sans-serif;
    font-style: italic;
    font-weight: 600;
    color: #26344f;
}

.save-sale, .print-sale {
    display: block;
    padding: 0 12px;
    white-space: nowrap;
}

.print-sale {
    background: #10192f;
}

/* Biểu đồ xu hướng xuất bán 12 tháng */
.chart-box {
    width: 312px;
    min-height: 154px;
    padding: 15px 14px 8px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 15px;
    background: rgba(255,255,255,.055);
}
.chart-heading {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    color:#dcd9ff;
    font-size:13px;
    margin-bottom:3px;
}
.chart-heading span {
    color:#fff;
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
}
.trend-chart {
    height:108px;
    width:100%;
}
.trend-chart svg {
    display:block;
    width:100%;
    height:100%;
    overflow:visible;
}
.trend-chart svg line {
    stroke:rgba(255,255,255,.14);
    stroke-width:1;
}
.trend-area {
    fill:rgba(151,139,255,.20);
}
.trend-line {
    fill:none;
    stroke:#b7aeff;
    stroke-width:2.8;
    stroke-linecap:round;
    stroke-linejoin:round;
}
.trend-dot {
    fill:#fff;
    stroke:#887cff;
    stroke-width:1.8;
}
.trend-label {
    fill:#d9d6ff;
    font-size:9.5px;
}
.trend-empty {
    fill:#cbc7f3;
    font-size:10px;
}
.fake-chart {
    display:none !important;
}
/* Font ổn định cho nút bấm và form */
button, input, select, textarea, .btn, nav a {
    font-family:"Segoe UI", Inter, Arial, sans-serif;
    font-synthesis:none;
}
button, .btn {
    letter-spacing:0;
}

/* ===== KimKhiStore dashboard completion ===== */
@font-face{
    font-family:"Noto Sans JP";
    src:url("/fonts/NotoSansJP-Regular.ttf") format("truetype");
    font-style:normal;
    font-weight:100 900;
    font-display:swap;
}

:root{
    --font-ui:"Noto Sans JP","Segoe UI",Arial,sans-serif;
    --dashboard-purple:#4032b7;
    --dashboard-indigo:#5142d7;
    --dashboard-orange:#ff6208;
    --dashboard-green:#05b987;
}

html,body,button,input,select,textarea{
    font-family:var(--font-ui);
    font-synthesis:none;
    text-rendering:optimizeLegibility;
}

body{
    font-size:13px;
    letter-spacing:0;
}

main{
    max-width:none;
    padding:28px 28px 42px;
}

.dashboard-project-banner{
    min-height:84px;
    display:flex;
    align-items:center;
    gap:14px;
    padding:17px 20px;
    margin:0 0 22px;
    color:#fff;
    border-radius:17px;
    background:linear-gradient(100deg,#4026a8,#5a16a1);
    box-shadow:0 8px 18px rgba(45,31,142,.16);
}

.project-banner-icon{
    width:40px;
    height:40px;
    display:grid;
    place-items:center;
    flex:none;
    color:#18203a;
    background:#ffbf00;
    border-radius:12px;
    font-size:24px;
    font-weight:900;
}

.project-banner-content{
    flex:1;
    min-width:0;
}

.project-banner-content > div{
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:3px;
}

.project-banner-content strong{
    font-size:16px;
    line-height:1.25;
}

.project-banner-content small{
    color:#dcd8ff;
    font-size:12px;
}

.download-ready{
    padding:3px 8px;
    color:#322200;
    background:#ffc400;
    border-radius:8px;
    font-size:10px;
    font-weight:900;
    white-space:nowrap;
}

.project-download{
    flex:none;
    padding:10px 15px;
    color:#24194c;
    background:#ffbe00;
    border-radius:11px;
    font-size:12px;
    font-weight:800;
    text-decoration:none;
}

.dashboard-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    margin:0 0 22px;
}

.period-tabs{
    display:flex;
    gap:0;
    padding:3px;
    background:#e9edf5;
    border-radius:12px;
}

.period-tabs a{
    padding:8px 14px;
    color:#35415b;
    border-radius:9px;
    font-size:12px;
    font-weight:700;
    text-decoration:none;
}

.period-tabs a.selected{
    color:#24305b;
    background:#fff;
    box-shadow:0 1px 4px rgba(34,45,75,.12);
}

.period-label{
    padding:8px 14px;
    color:#65748f;
    background:#fff;
    border:1px solid #e3e8f1;
    border-radius:12px;
    font-size:12px;
}

.period-label b{
    color:#4f46e5;
}

.dashboard-hero{
    display:grid;
    grid-template-columns:minmax(330px,1fr) 312px 120px;
    align-items:center;
    gap:28px;
    min-height:274px;
    padding:28px 32px;
    color:#fff;
    background:linear-gradient(110deg,#292264,#4937c9);
    border-radius:22px;
    box-shadow:0 12px 24px rgba(45,39,116,.2);
}

.hero-kicker{
    color:#d7d4ff;
    font-size:12px;
    font-weight:800;
    letter-spacing:.1px;
}

.hero-value{
    margin:12px 0 7px;
    color:#fff;
    font-size:32px;
    font-weight:900;
    letter-spacing:.2px;
}

.hero-status{
    display:flex;
    align-items:center;
    gap:5px;
    color:#d5d2ff;
    font-size:12px;
}

.hero-status b{
    padding:4px 7px;
    color:#8effdb;
    background:rgba(0,0,0,.12);
    border-radius:6px;
}

.hero-stats{
    display:flex;
    gap:38px;
    margin-top:25px;
}

.hero-stats div{
    display:flex;
    flex-direction:column;
    gap:3px;
}

.hero-stats strong{
    font-size:17px;
}

.hero-stats span{
    color:#d2d1ff;
    font-size:11px;
}

.hero-actions{
    display:flex;
    gap:10px;
    margin-top:17px;
}

.hero-action{
    padding:9px 13px;
    color:#fff;
    border:1px solid rgba(255,255,255,.3);
    border-radius:10px;
    font-size:12px;
    font-weight:800;
    text-decoration:none;
}

.hero-action.primary{
    color:#342680;
    background:#fff;
    border-color:#fff;
}

.hero-trend-box{
    height:155px;
    padding:15px;
    border:1px solid rgba(255,255,255,.18);
    border-radius:15px;
    background:rgba(255,255,255,.06);
}

.hero-trend-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    color:#d8d4ff;
    font-size:12px;
}

.hero-trend-header strong{
    color:#fff;
    font-size:11px;
    white-space:nowrap;
}

.hero-trend-chart{
    height:108px;
    margin-top:5px;
}

.hero-trend-chart svg{
    width:100%;
    height:87px;
    overflow:visible;
}

.hero-trend-chart line{
    stroke:rgba(255,255,255,.17);
    stroke-dasharray:3 4;
}

.hero-trend-line{
    fill:none;
    stroke:#aaa2ff;
    stroke-width:2.5;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.hero-trend-dot{
    fill:#fff;
    stroke:#aaa2ff;
    stroke-width:1.5;
}

.hero-trend-labels{
    display:flex;
    justify-content:space-between;
    color:#d6d1ff;
    font-size:9px;
}

.safe-donut-wrap{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:9px;
    color:#dcd9ff;
    font-size:11px;
    text-align:center;
}

.safe-donut{
    --safe:69%;
    position:relative;
    width:108px;
    height:108px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    border-radius:50%;
    background:conic-gradient(#08d39c var(--safe),rgba(255,255,255,.16) 0);
}

.safe-donut::after{
    position:absolute;
    inset:11px;
    content:"";
    background:#3e31b2;
    border-radius:50%;
}

.safe-donut span,
.safe-donut small{
    position:relative;
    z-index:1;
}

.safe-donut span{
    color:#fff;
    font-size:25px;
    font-weight:900;
}

.safe-donut small{
    margin-top:3px;
    color:#d9d5ff;
    font-size:10px;
}

.dashboard-metric-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:16px;
    margin:24px 0;
}

.dashboard-metric-card{
    position:relative;
    min-height:134px;
    padding:20px;
    background:#fff;
    border:1px solid #e0e5ee;
    border-radius:16px;
    box-shadow:0 3px 10px rgba(24,34,75,.04);
}

.dashboard-metric-card > span{
    display:block;
    color:#65748f;
    font-size:12px;
}

.dashboard-metric-card > strong{
    display:block;
    margin:16px 0 4px;
    color:#17203a;
    font-size:21px;
    font-weight:900;
}

.dashboard-metric-card > small{
    color:#75819b;
    font-size:11px;
}

.dashboard-metric-card > b{
    float:right;
    margin-top:2px;
    color:#09a976;
    font-size:11px;
}

.metric-card-icon{
    float:right;
    width:31px;
    height:31px;
    display:grid;
    place-items:center;
    border-radius:10px;
    font-size:18px;
    font-weight:900;
}

.orange-icon{color:#ff5b16;background:#fff0e7}
.green-icon{color:#00a879;background:#e7fbf3}
.purple-icon{color:#8e31e6;background:#f5eaff}
.blue-icon{color:#4d55ff;background:#eef0ff}
.profit-value{color:#8015d8!important}

.dashboard-analytics-grid{
    display:grid;
    grid-template-columns:minmax(0,1.55fr) minmax(330px,.75fr);
    gap:22px;
    margin-top:22px;
}

.dashboard-panel{
    min-width:0;
    padding:20px;
    overflow:hidden;
    background:#fff;
    border:1px solid #dfe5ef;
    border-radius:16px;
    box-shadow:0 3px 10px rgba(24,34,75,.04);
}

.panel-heading,
.bottom-panel-title{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:15px;
}

.panel-heading h2,
.bottom-panel-title h2{
    margin:0;
    color:#17203a;
    font-size:15px;
    font-weight:900;
}

.panel-heading p{
    margin:3px 0 0;
    color:#74819b;
    font-size:11px;
}

.chart-legend{
    display:flex;
    align-items:center;
    gap:16px;
    color:#68758e;
    font-size:11px;
    white-space:nowrap;
}

.chart-legend span{
    display:flex;
    align-items:center;
    gap:5px;
}

.chart-legend i{
    width:11px;
    height:11px;
    display:inline-block;
    border-radius:2px;
}

.legend-in{background:#05b987}
.legend-out{background:#ff6208}
.legend-profit{height:3px!important;background:#a013f2}

.flow-chart{
    position:relative;
    height:252px;
    margin-top:17px;
    padding:10px 9px 0;
}

.flow-grid-lines{
    position:absolute;
    inset:10px 8px 29px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}

.flow-grid-lines i{
    display:block;
    border-top:1px dashed #e6eaf1;
}

.flow-bars{
    position:absolute;
    inset:10px 8px 0;
    display:grid;
    grid-template-columns:repeat(12,minmax(0,1fr));
    align-items:end;
}

.flow-month{
    position:relative;
    z-index:2;
    height:100%;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-end;
    gap:7px;
}

.bar-group{
    height:190px;
    display:flex;
    align-items:flex-end;
    gap:4px;
}

.flow-bar{
    display:block;
    width:11px;
    min-height:2px;
    border-radius:4px 4px 0 0;
}

.purchase-bar{background:#05b987}
.sales-bar{background:#ff6208}

.flow-month small{
    color:#68758e;
    font-size:10px;
}

.profit-line-svg{
    position:absolute;
    inset:10px 8px 29px;
    width:calc(100% - 16px);
    height:190px;
    z-index:3;
    overflow:visible;
    pointer-events:none;
}

.profit-line{
    fill:none;
    stroke:#a013f2;
    stroke-width:2.5;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.category-list{
    display:flex;
    flex-direction:column;
    gap:15px;
    margin-top:38px;
}

.category-title{
    display:flex;
    justify-content:space-between;
    gap:12px;
    margin-bottom:6px;
}

.category-title b{
    overflow:hidden;
    color:#24304d;
    font-size:12px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.category-title span{
    color:#506184;
    font-size:11px;
    white-space:nowrap;
}

.category-track,
.mini-progress{
    height:8px;
    overflow:hidden;
    background:#edf1f6;
    border-radius:8px;
}

.category-fill,
.mini-progress i{
    display:block;
    height:100%;
    border-radius:8px;
}

.color-0{background:#5548e9}
.color-1{background:#10b5d5}
.color-2{background:#09b77d}
.color-3{background:#f59d0b}
.color-4{background:#e8499b}

.dashboard-bottom-grid{
    display:grid;
    grid-template-columns:1.02fr 1.02fr 1.02fr;
    gap:22px;
    margin-top:22px;
}

.bottom-panel-title{
    align-items:center;
    margin-bottom:16px;
}

.bottom-panel-title a{
    color:#5141ed;
    font-size:11px;
    text-decoration:none;
}

.bottom-panel-title em{
    display:inline-grid;
    width:22px;
    height:18px;
    place-items:center;
    margin-left:5px;
    color:#fa4b0b;
    background:#ffe6de;
    border-radius:10px;
    font-size:10px;
    font-style:normal;
}

.top-product-row{
    padding:8px 0;
    border-bottom:1px solid #edf0f5;
}

.top-product-line{
    display:flex;
    justify-content:space-between;
    gap:12px;
    margin-bottom:6px;
}

.top-product-line b{
    overflow:hidden;
    color:#27334f;
    font-size:12px;
    font-weight:800;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.top-product-line span{
    color:#344264;
    font-size:11px;
    white-space:nowrap;
}

.top-product-row > small{
    display:block;
    margin-top:4px;
    color:#8a97ad;
    font-size:10px;
    text-align:right;
}

.mini-progress{
    height:6px;
}

.mini-progress i{
    background:linear-gradient(90deg,#ff7a05,#ff4b0b);
}

.stock-alert-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin:8px 0;
    padding:10px;
    background:#f7f9fc;
    border-radius:12px;
}

.stock-alert-row > div{
    min-width:0;
}

.stock-alert-row b{
    display:block;
    overflow:hidden;
    color:#27334f;
    font-size:11px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.stock-alert-row small{
    display:block;
    margin-top:2px;
    color:#79869e;
    font-size:10px;
}

.stock-alert-row small strong{
    color:#ee3e32;
}

.stock-alert-row a{
    flex:none;
    padding:5px 10px;
    color:#fff;
    background:#00a979;
    border-radius:8px;
    font-size:11px;
    font-weight:800;
    text-decoration:none;
}

.restock-all{
    display:block;
    margin-top:12px;
    padding:10px;
    color:#4939da;
    background:#eef0ff;
    border-radius:11px;
    font-size:11px;
    font-weight:800;
    text-align:center;
    text-decoration:none;
}

.recent-row{
    position:relative;
    display:grid;
    grid-template-columns:auto 1fr auto;
    gap:4px 8px;
    padding:9px 0;
    border-bottom:1px solid #edf0f5;
    color:inherit;
    text-decoration:none;
}

.recent-code{
    color:#fa4b0b;
    font-size:11px;
    font-weight:900;
}

.recent-row > strong{
    overflow:hidden;
    color:#39445d;
    font-size:11px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.recent-row > b{
    color:#fa4b0b;
    font-size:11px;
    white-space:nowrap;
}

.recent-row > small{
    grid-column:1 / 3;
    overflow:hidden;
    color:#8490a8;
    font-size:10px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.recent-row > em{
    color:#8b96aa;
    font-size:10px;
    font-style:normal;
    text-align:right;
}

.empty-state{
    padding:30px 8px;
    color:#8895aa;
    font-size:12px;
    text-align:center;
}

.safe-message{
    padding:16px 0;
    color:#00a979;
    font-size:12px;
    font-weight:800;
}

@media(max-width:1200px){
    .dashboard-hero{
        grid-template-columns:minmax(280px,1fr) 280px;
    }
    .safe-donut-wrap{display:none}
    .dashboard-bottom-grid{
        grid-template-columns:1fr 1fr;
    }
    .recent-panel{
        grid-column:1 / -1;
    }
}

@media(max-width:900px){
    .dashboard-project-banner{
        align-items:flex-start;
        flex-wrap:wrap;
    }
    .dashboard-hero{
        grid-template-columns:1fr;
    }
    .hero-trend-box{
        max-width:420px;
    }
    .dashboard-metric-grid{
        grid-template-columns:repeat(2,1fr);
    }
    .dashboard-analytics-grid,
    .dashboard-bottom-grid{
        grid-template-columns:1fr;
    }
    .recent-panel{
        grid-column:auto;
    }
}

@media(max-width:600px){
    .dashboard-metric-grid{
        grid-template-columns:1fr;
    }
    .dashboard-toolbar{
        align-items:flex-start;
        flex-direction:column;
    }
    .period-label{
        align-self:stretch;
        text-align:center;
    }
    .hero-stats{
        gap:18px;
    }
    .chart-legend{
        gap:7px;
        font-size:9px;
    }
}


/* Exact print-preview modal */
.print-preview-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 18px;
    background: rgba(7, 12, 30, .66);
    backdrop-filter: blur(7px);
}

.print-preview-dialog {
    width: min(768px, calc(100vw - 36px));
    max-height: calc(100vh - 72px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(5, 11, 30, .35);
}

.print-preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 84px;
    padding: 18px 28px;
    background: #fff;
    border-bottom: 1px solid #e4e8f0;
}

.print-preview-toolbar strong {
    display: block;
    color: #13213b;
    font-size: 15px;
    line-height: 1.35;
}

.print-preview-toolbar span {
    display: block;
    margin-top: 3px;
    color: #72819a;
    font-size: 12px;
}

.print-preview-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.preview-print-button {
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    background: #5141f4;
    color: #fff;
    font: 700 13px/1.2 "Noto Sans JP", "Segoe UI", sans-serif;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(81, 65, 244, .2);
}

.preview-close-button {
    color: #73829a;
    font-size: 28px;
    line-height: 1;
    text-decoration: none;
}

.preview-saved-file {
    margin: 12px 28px 0;
    padding: 9px 12px;
    border-radius: 8px;
    background: #eaf9f1;
    color: #087b55;
    font-size: 11px;
}

.preview-saved-file span {
    color: #4d8b72;
}

.print-paper {
    margin: 24px auto 34px;
    width: calc(100% - 70px);
    color: #111;
    font-family: "Times New Roman", "Noto Serif", serif;
    font-size: 12px;
    line-height: 1.35;
}

.paper-company {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    line-height: 1.45;
}

.paper-company strong {
    font-size: 14px;
}

.paper-form-code {
    min-width: 190px;
    text-align: center;
}

.paper-form-code strong,
.paper-form-code em {
    display: block;
}

.paper-form-code em {
    font-size: 10px;
}

.print-paper h1 {
    margin: 24px 0 2px;
    text-align: center;
    font-size: 20px;
    letter-spacing: .1px;
}

.paper-date {
    text-align: center;
    font-style: italic;
    line-height: 1.5;
}

.paper-meta {
    margin: 15px 0 14px;
    line-height: 1.55;
}

.paper-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    text-align: center;
}

.paper-table th,
.paper-table td {
    border: 1px solid #202020;
    padding: 5px 4px;
    vertical-align: middle;
}

.paper-table th:nth-child(1) { width: 7%; }
.paper-table th:nth-child(2) { width: 13%; }
.paper-table th:nth-child(3) { width: 27%; }
.paper-table th:nth-child(4) { width: 10%; }
.paper-table th:nth-child(5) { width: 10%; }
.paper-table th:nth-child(6) { width: 16%; }
.paper-table th:nth-child(7) { width: 17%; }

.paper-table thead th {
    font-weight: 700;
}

.paper-symbol-row th {
    font-style: italic;
}

.paper-product {
    text-align: left;
}

.paper-product strong,
.paper-product small {
    display: block;
}

.paper-product small {
    font-style: italic;
    font-size: 10px;
}

.paper-words {
    margin-top: 14px;
}

.paper-sign-date {
    margin-top: 18px;
    text-align: right;
    font-style: italic;
}

.paper-signatures {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    min-height: 80px;
    margin-top: 14px;
    text-align: center;
}

.paper-signatures strong,
.paper-signatures em {
    display: block;
}

.paper-signatures em {
    margin-top: 3px;
    font-size: 10px;
}

@media (max-width: 760px) {
    .print-preview-backdrop {
        padding: 10px;
    }

    .print-preview-dialog {
        width: 100%;
        max-height: calc(100vh - 20px);
    }

    .print-preview-toolbar {
        padding: 14px 16px;
    }

    .preview-print-button {
        padding: 9px 10px;
    }

    .print-paper {
        width: calc(100% - 28px);
        font-size: 10px;
    }

    .paper-company {
        gap: 10px;
    }

    .paper-form-code {
        min-width: 120px;
    }

    .paper-signatures {
        gap: 3px;
        font-size: 9px;
    }
}

@media print {
    body > * {
        visibility: hidden !important;
    }

    .print-preview-backdrop,
    .print-preview-backdrop * {
        visibility: visible !important;
    }

    .print-preview-backdrop {
        position: absolute;
        inset: 0;
        display: block;
        padding: 0;
        background: #fff;
    }

    .print-preview-dialog {
        width: 100%;
        max-height: none;
        overflow: visible;
        border-radius: 0;
        box-shadow: none;
    }

    .print-preview-toolbar,
    .preview-saved-file {
        display: none !important;
    }

    .print-paper {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    @page {
        size: A4;
        margin: 12mm;
    }
}

/* ===== Purchase receipt screen ===== */
.purchase-page{
    display:grid;
    grid-template-columns:minmax(0,1fr) 335px;
    gap:25px;
    width:100%;
    max-width:1080px;
    margin:0 auto;
    align-items:start;
}
.purchase-editor,.purchase-card{min-width:0}
.purchase-card,.purchase-summary-card,.purchase-tip{
    background:#fff;
    border:1px solid #e0e5ee;
    box-shadow:0 2px 5px rgba(23,32,58,.04);
}
.purchase-card{
    border-radius:16px;
    border-top:3px solid #05a975;
    padding:25px 24px 18px;
}
.purchase-card-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    padding-bottom:14px;
    border-bottom:1px solid #e5e9f1;
}
.purchase-card-head h2{
    margin:0;color:#182138;font-size:17px;letter-spacing:.1px
}
.purchase-card-head p{margin:3px 0 0;color:#60718e;font-size:13px}
.purchase-head-actions{display:flex;align-items:center;gap:9px;flex-wrap:wrap;justify-content:flex-end}
.low-stock-btn{
    border:1px solid #f4c84c;background:#fffdf1;color:#ed9c00;
    border-radius:16px;padding:7px 12px;font-size:11px;font-weight:800;cursor:pointer;
}
.low-stock-btn:hover{background:#fff5c9}
.purchase-badge{background:#dcf8ec!important;color:#009b6d!important}
.purchase-badge b{margin-left:4px}
.purchase-fields{
    display:grid;grid-template-columns:1fr 1fr 1.08fr;gap:13px;margin:20px 0
}
.purchase-fields .field label{font-size:13px;color:#31405e;margin-bottom:6px}
.purchase-fields .field label b{color:#05a975}
.purchase-fields input{
    height:36px;border:1px solid #d7dfed;border-radius:11px;width:100%;
    padding:0 12px;color:#2b3650;background:#fff;font:inherit
}
.purchase-input-icon{position:relative}
.purchase-input-icon input{padding-right:35px}
.purchase-input-icon span{position:absolute;right:10px;top:9px;color:#687792;font-size:12px;pointer-events:none}
.purchase-search-wrap{position:relative;margin:18px 0 20px;z-index:20}
.purchase-search-wrap .product-search{
    border-color:#9cebc9;background:#fbfffd;height:44px;margin:0
}
.purchase-search-wrap .search-icon{color:#72a6a0}
.purchase-search-wrap .product-search input{font-size:14px}
.purchase-search-wrap .search-results{border-color:#bde8d7}
.purchase-table-wrap{overflow-x:auto}
.purchase-table{min-width:730px;border-collapse:separate;border-spacing:0}
.purchase-table thead th{
    background:#009f6d;color:#fff;border:0;height:52px;padding:0 12px;
    font-size:12px;white-space:nowrap
}
.purchase-table thead th:first-child{border-radius:8px 0 0 8px}
.purchase-table thead th:last-child{border-radius:0 8px 8px 0}
.purchase-table td{
    height:65px;padding:8px 10px;border-bottom:1px solid #ebeff5;
    vertical-align:middle;color:#31405c
}
.purchase-table .stt-col{width:45px;text-align:center}
.purchase-table .unit-col{width:60px}.purchase-table .qty-col{width:98px}
.purchase-table .price-col{width:130px}.purchase-table .money-col{width:125px}
.purchase-table .remove-col{width:34px}
.purchase-product-cell{display:flex;align-items:center;gap:9px;min-width:300px}
.purchase-product-cell .product-thumb{
    height:31px;width:31px;border-radius:8px;background:linear-gradient(145deg,#34465c,#101925);
    color:#fff;display:grid;place-items:center;font-size:15px;flex:none
}
.purchase-product-cell b{display:block;color:#28344e;font-size:13px}
.purchase-product-cell small{display:block;color:#8b97aa;font-size:10px;margin-top:3px}
.purchase-table .unit-cell{color:#596a84;font-weight:700}
.purchase-number{
    width:84px;height:29px;border:1px solid #dbe2ee;border-radius:8px;
    text-align:center;color:#26324c;font-weight:700
}
.purchase-price{width:110px}
.row-amount{font-weight:800;white-space:nowrap;color:#27344f}
.remove-purchase-row{border:0;background:transparent;color:#e55757;font-size:21px;cursor:pointer}
.purchase-empty{
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    min-height:82px;color:#9aa5b7;font-size:12px;text-align:center;gap:5px
}
.purchase-empty strong{font-weight:500}
.purchase-empty[hidden]{display:none}
.quick-products-section{margin-top:15px}
.quick-products-section .quick-title{color:#6b7d9a;margin:0 0 7px;font-size:11px}
.quick-products-section .quick-products{display:flex;gap:6px;flex-wrap:wrap}
.quick-products-section .quick-product{border:0;background:#f0f4f9;color:#45607e;border-radius:8px;padding:6px 10px;font-size:11px;cursor:pointer}
.quick-products-section .quick-product:hover{background:#e3eafe;color:#4054c7}
.purchase-editor-footer{
    display:flex;justify-content:space-between;align-items:center;gap:12px;
    border-top:1px solid #edf0f5;margin-top:15px;padding-top:13px;color:#98a3b4;font-size:11px
}
.add-row-btn{
    border:1px solid #b9e8d6;background:#f2fff9;color:#008e64;
    border-radius:9px;padding:7px 11px;font-size:11px;font-weight:800;cursor:pointer;white-space:nowrap
}
.purchase-summary{display:flex;flex-direction:column;gap:15px}
.purchase-summary-card{
    border-radius:15px;border-top:3px solid #05a975;padding:24px
}
.purchase-summary .summary-title{font-size:13px;color:#71809c;font-weight:800;letter-spacing:.3px}
.purchase-total{
    font-size:28px;color:#009d6b;font-weight:900;margin:21px 0;
    border-bottom:1px dashed #d8deea;padding-bottom:18px;white-space:nowrap
}
.purchase-summary .summary-line{
    display:flex;justify-content:space-between;color:#75839d;font-size:13px;
    padding:9px 0;border-bottom:1px dashed #d8deea
}
.purchase-summary .summary-line b{color:#28334c;font-size:12px}
.purchase-summary .words-box{
    background:#f6f8fb;border:1px solid #edf0f5;border-radius:11px;
    padding:13px;margin:16px 0;color:#33415b;font-size:12px;line-height:18px
}
.purchase-summary .words-box i{font-weight:700;color:#26344f}
.save-purchase,.print-purchase{
    width:100%;height:40px;border:0;border-radius:12px;color:#fff;
    font-weight:800;font-size:13px;cursor:pointer
}
.save-purchase{background:#05a975}
.save-purchase:hover{background:#008f63}
.print-purchase{background:#10192f;margin-top:8px}
.save-purchase:disabled{opacity:.65;cursor:wait}
.new-purchase{display:block;text-align:center;color:#9aa5b7;text-decoration:none;font-size:12px;margin-top:13px}
.purchase-tip{
    border-radius:12px;padding:13px 15px;display:flex;flex-direction:column;
    gap:4px;color:#75839d;font-size:11px;line-height:17px
}
.purchase-tip strong{color:#28344f;font-size:12px}
@media(max-width:1050px){
    .purchase-page{grid-template-columns:1fr}
    .purchase-summary{display:grid;grid-template-columns:1fr 1fr}
    .purchase-fields{grid-template-columns:1fr 1fr}
    .purchase-fields .field:last-child{grid-column:1/-1}
}
@media(max-width:700px){
    .purchase-page{display:block}
    .purchase-summary{display:block;margin-top:18px}
    .purchase-fields{grid-template-columns:1fr}
    .purchase-fields .field:last-child{grid-column:auto}
    .purchase-card{padding:16px}
    .purchase-card-head{display:block}
    .purchase-head-actions{justify-content:flex-start;margin-top:12px}
    .purchase-editor-footer{align-items:flex-start;flex-direction:column}
}

.top-btn.violet{background:#4f35f2}.top-btn.violet:hover{background:#4028d8}


/* Purchase screen refinements: clearer workflow, search and responsive summary */
.purchase-page{max-width:2300px;grid-template-columns:minmax(0,1fr) 350px;gap:22px;align-items:start}
.purchase-page .purchase-card{padding:26px 26px 20px;border-radius:18px;border-top:4px solid #079d6d}
.purchase-kicker,.summary-eyebrow{font-size:10px;letter-spacing:.12em;font-weight:800;color:#07835e;margin-bottom:7px}
.purchase-card-head h2{text-transform:none;font-size:20px;line-height:1.3}
.purchase-card-head p{font-size:13px;margin-top:5px}
.purchase-head-actions{gap:8px}
.low-stock-btn{padding:9px 12px;border-radius:10px;font-size:12px}
.low-stock-btn b{display:inline-grid;place-items:center;min-width:18px;height:18px;margin-left:4px;padding:0 5px;border-radius:20px;background:#fff0be;color:#9b6500}
.purchase-fields{gap:15px;margin:23px 0}
.purchase-fields .field label{font-size:12px;font-weight:700;margin-bottom:7px}
.purchase-fields input{height:42px;border-radius:10px;font-size:13px;transition:border-color .15s,box-shadow .15s}
.purchase-fields input:focus,.purchase-number:focus,.product-search:focus-within{outline:0;border-color:#079d6d;box-shadow:0 0 0 3px #079d6d1c}
.purchase-search-wrap{margin:16px 0 22px;z-index:30}
.search-label{display:block;font-size:12px;font-weight:800;color:#35415a;margin-bottom:8px}
.purchase-search-wrap .product-search{height:50px;border:1px solid #b8e8d5;border-radius:12px;box-shadow:0 2px 8px #07835e0a}
.purchase-search-wrap .product-search input{font-size:14px}
.purchase-search-wrap .search-icon{font-size:21px;margin-left:14px}
.search-hint{font-size:10px;color:#71809a;background:#f3f6fa;padding:5px 7px;border-radius:6px;margin-right:9px}
.search-help{font-size:11px;color:#8290a5;margin:7px 2px 0}
.purchase-search-wrap .search-results{top:calc(100% + 5px);max-height:360px;border:1px solid #d6e4df;border-radius:12px}
.search-result{min-height:66px;padding:10px 12px;gap:12px}
.search-result:hover,.search-result.is-active{background:#effaf5}
.result-main b{font-size:13px;color:#24334a}
.result-main b span{color:#a1acba}
.result-main small{font-size:11px;white-space:normal}
.result-stock{font-size:11px}
.result-stock.is-low b{color:#bd7214}
.result-price{font-size:12px;color:#087f5d;font-weight:700}
.purchase-table-heading{display:flex;align-items:center;justify-content:space-between;margin:0 0 9px}
.purchase-table-heading>div{display:flex;align-items:baseline;gap:9px}
.purchase-table-heading b{font-size:14px;color:#2c3952}
.purchase-table-heading span{font-size:11px;color:#8b97a9}
.add-row-btn{padding:8px 12px;font-size:11px}
.purchase-table-wrap{border-radius:10px}
.purchase-table{min-width:760px}
.purchase-table thead th{height:46px;font-size:11px}
.purchase-table td{height:66px}
.purchase-product-cell b{font-size:12px}
.purchase-product-cell small{font-size:10px}
.purchase-number{height:36px;width:90px;max-width:100%;border:1px solid #dce3ec;border-radius:8px;padding:0 8px;font:inherit;text-align:right;color:#26344f}
.purchase-price{width:135px}
.row-amount{font-weight:800;color:#25344d;white-space:nowrap}
.remove-purchase-row{width:30px;height:30px;border-radius:8px;border:1px solid #f0d9d7;background:#fff8f7;color:#c34d40;font-size:19px;cursor:pointer}
.remove-purchase-row:hover{background:#ffecea}
.purchase-empty{padding:30px 12px;gap:7px}
.purchase-empty .empty-icon{width:34px;height:34px;display:grid;place-items:center;border-radius:50%;background:#eff7f3;color:#07835e;font-size:21px}
.purchase-empty strong{font-size:13px;color:#34415a}
.purchase-empty span:last-child{font-size:11px}
.quick-products-section{margin-top:19px;padding:15px 15px 13px;border:1px solid #e7edf1;border-radius:12px;background:#fbfcfd}
.quick-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.quick-head>div{display:flex;flex-direction:column;gap:4px}
.quick-head b{font-size:13px;color:#2e3b52}
.quick-head small{font-size:10px;color:#8591a4}
.quick-add-all{border:1px solid #bfe9d6;border-radius:8px;background:#f1fff8;color:#07835e;padding:7px 9px;font-size:10px;font-weight:800;cursor:pointer;white-space:nowrap}
.quick-products-section .quick-products{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.quick-products-section .quick-product{display:flex;align-items:center;gap:8px;text-align:left;min-width:0;padding:8px 9px;border:1px solid #edf0f2;background:#fff;border-radius:9px;color:#43506a}
.quick-products-section .quick-product:hover{border-color:#b6e5d1;background:#f5fff9}
.quick-warning{display:grid;place-items:center;width:20px;height:20px;flex:0 0 20px;border-radius:50%;background:#fff3d5;color:#bd7b0a;font-weight:900}
.quick-product>span:nth-child(2){display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.quick-product b{font-size:10px;overflow:hidden;text-overflow:ellipsis}
.quick-product small{font-size:9px;color:#8290a4}
.quick-plus{color:#07835e;font-size:17px}
.quick-empty{padding:10px 4px;color:#7c8a9d;font-size:11px}
.purchase-editor-footer{margin-top:18px;padding-top:13px}
.purchase-summary{position:sticky;top:18px}
.purchase-summary-card{padding:23px;border-radius:17px;border-top:4px solid #079d6d}
.purchase-summary .summary-eyebrow{margin-bottom:5px}
.purchase-summary .summary-title{font-size:14px;color:#34415a;font-weight:700}
.purchase-total{font-size:31px;margin:16px 0 12px;padding-bottom:17px;white-space:normal;overflow-wrap:anywhere}
.purchase-summary .summary-line{font-size:12px;padding:11px 0}
.purchase-summary .summary-line b{font-size:12px}
.purchase-summary .words-box{margin:14px 0;padding:12px;display:flex;flex-direction:column;gap:5px}
.purchase-summary .words-box b{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:#8491a4}
.purchase-summary .words-box i{font-size:12px;line-height:1.5;font-style:normal}
.summary-validation{padding:9px 10px;margin:12px 0 10px;border-radius:8px;background:#fff8e8;color:#946b18;font-size:10px}
.summary-validation span{margin-right:5px;color:#e3a527}
.summary-validation.is-ready{background:#effaf4;color:#17825c}
.summary-validation.is-ready span{color:#079d6d}
.save-purchase,.print-purchase{height:44px;border-radius:10px;font-size:12px;display:flex;justify-content:center;align-items:center;gap:8px}
.save-purchase:hover,.print-purchase:hover{filter:brightness(.96);transform:translateY(-1px)}
.save-purchase.is-saving,.print-purchase.is-saving{opacity:.75;cursor:wait}
.print-purchase{margin-top:9px}
.save-note{text-align:center;font-size:10px;color:#8a96a8;line-height:1.5;margin:11px 0 0}
.new-purchase{margin-top:12px;color:#68758b;font-weight:600}
.purchase-tip{padding:15px;gap:7px;font-size:11px}
.purchase-tip span{line-height:1.45}
.purchase-inline-notice{padding:11px 13px;border-radius:9px;margin:0 0 14px;font-size:12px;font-weight:700}
.purchase-inline-notice[data-type="success"]{background:#eaf8f0;color:#08784f}
.purchase-inline-notice[data-type="info"]{background:#edf4ff;color:#345e9b}
.purchase-inline-notice[data-type="error"]{background:#fff0ed;color:#b33828}
.row-flash{animation:purchaseFlash .7s ease}
@keyframes purchaseFlash{50%{background:#eafff3}}
@media(max-width:1150px){
 .purchase-page{grid-template-columns:minmax(0,1fr) 310px;gap:16px}
 .purchase-page .purchase-card{padding:21px 18px}
 .purchase-fields{grid-template-columns:1fr 1fr}
 .purchase-fields .field:last-child{grid-column:1/-1}
}
@media(max-width:850px){
 .purchase-page{grid-template-columns:1fr}
 .purchase-summary{position:static}
 .purchase-summary-card{display:block}
}
@media(max-width:600px){
 .purchase-page .purchase-card{padding:17px 13px}
 .purchase-card-head{flex-direction:column}
 .purchase-head-actions{justify-content:flex-start}
 .purchase-fields{grid-template-columns:1fr;gap:11px}
 .purchase-fields .field:last-child{grid-column:auto}
 .purchase-table-heading{align-items:flex-start}
 .purchase-table-heading>div{flex-direction:column;gap:3px}
 .quick-products-section .quick-products{grid-template-columns:1fr}
 .search-help{line-height:1.45}
 .purchase-summary-card{padding:18px}
}


/* Editable blank line in purchase receipt */
.manual-product-cell { display: grid; gap: 6px; min-width: 240px; }
.purchase-product-select {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #cfd9e8;
    border-radius: 8px;
    background: #fff;
    color: #26354d;
    font: inherit;
}
.purchase-product-select:focus {
    outline: 3px solid rgba(0, 166, 112, .16);
    border-color: #00a670;
}
.manual-product-info { color: #71809a; font-size: 11px; line-height: 1.45; }


/* ===== Inventory / materials catalogue ===== */
.content main:has(.materials-screen) {
    max-width: 1600px;
}
.materials-screen {
    display: grid;
    gap: 17px;
    width: 100%;
    min-width: 0;
}
.materials-toolbar-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 13px 15px;
    background: #fff;
    border: 1px solid #e1e7f0;
    border-radius: 17px;
    box-shadow: 0 3px 12px rgba(23, 32, 58, .045);
}
.materials-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.45fr) minmax(150px, .95fr) minmax(165px, 1fr) 40px;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.materials-search {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    height: 40px;
    border: 1px solid #dce4ef;
    border-radius: 11px;
    background: #fff;
    transition: border-color .16s, box-shadow .16s;
}
.materials-search:focus-within {
    border-color: #8795f3;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .09);
}
.materials-search > svg {
    width: 17px;
    height: 17px;
    margin-left: 12px;
    flex: 0 0 17px;
    fill: none;
    stroke: #8a98ad;
    stroke-width: 1.8;
}
.materials-search input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 8px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #293750;
    font: inherit;
}
.materials-search input::placeholder { color: #8b97aa; }
.materials-clear-search {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    margin-right: 6px;
    border-radius: 7px;
    color: #8290a4;
    text-decoration: none;
    font-size: 20px;
}
.materials-clear-search:hover { background: #f0f3f8; color: #34435d; }
.materials-select {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 31px 0 12px;
    border: 1px solid #dce4ef;
    border-radius: 11px;
    background: #fff;
    color: #35435b;
    font: inherit;
    outline: none;
}
.materials-select:focus {
    border-color: #8795f3;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .09);
}
.materials-search-submit {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: #f1f4f9;
    color: #4f5d74;
    cursor: pointer;
}
.materials-search-submit:hover { background: #e8edf5; color: #3730a3; }
.materials-search-submit svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}
.materials-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: max-content;
}
.materials-view-switch {
    display: flex;
    align-items: center;
    padding: 3px;
    border: 1px solid #e1e7f0;
    border-radius: 10px;
    background: #f6f8fb;
}
.view-switch-button {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 7px;
    color: #7a879b;
    text-decoration: none;
}
.view-switch-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}
.view-switch-button:hover { color: #4138c7; background: #fff; }
.view-switch-button.is-active {
    color: #293750;
    background: #fff;
    box-shadow: 0 1px 4px rgba(23, 32, 58, .12);
}
.materials-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 39px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s, box-shadow .15s, background .15s;
}
.materials-action-button:hover { transform: translateY(-1px); }
.materials-action-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}
.materials-export {
    color: #087b59;
    background: #f0faf5;
    border-color: #d7eee3;
}
.materials-export:hover { background: #e6f7ef; }
.materials-add {
    color: #fff;
    background: #5145e5;
    box-shadow: 0 3px 8px rgba(79, 70, 229, .18);
}
.materials-add:hover { background: #4338ca; box-shadow: 0 5px 13px rgba(79, 70, 229, .23); }

.materials-panel {
    overflow: hidden;
    background: #fff;
    border: 1px solid #e1e7f0;
    border-radius: 17px;
    box-shadow: 0 3px 12px rgba(23, 32, 58, .04);
}
.materials-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 67px;
    padding: 12px 17px;
    border-bottom: 1px solid #edf0f5;
}
.materials-panel-heading h2 {
    margin: 0 0 4px;
    color: #27354e;
    font-size: 15px;
    font-weight: 750;
}
.materials-panel-heading > div:first-child > span {
    color: #8a96a9;
    font-size: 11px;
}
.materials-quick-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 13px;
}
.summary-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #68758a;
    font-size: 11px;
    white-space: nowrap;
}
.summary-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.dot-low { background: #f0a32e; }
.dot-zero { background: #e45151; }
.summary-value {
    padding-left: 12px;
    border-left: 1px solid #e7ebf1;
    color: #26344e;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.summary-value small {
    color: #8b96a8;
    font-size: 10px;
    font-weight: 500;
}
.materials-table-scroll { width: 100%; overflow-x: auto; }
.materials-table {
    width: 100%;
    min-width: 1000px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}
.materials-table .col-code { width: 7%; }
.materials-table .col-name { width: 12%; }
.materials-table .col-spec { width: 20%; }
.materials-table .col-category { width: 8%; }
.materials-table .col-unit { width: 6%; }
.materials-table .col-price { width: 8%; }
.materials-table .col-stock { width: 5%; }
.materials-table .col-value { width: 8%; }
.materials-table .col-actions { width: 5%; }
.materials-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #eef3f8;
    color: #34435b;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.35;
    white-space: normal;
}
.materials-table tbody td {
    height: 76px;
    padding: 11px 8px;
    border-bottom: 1px solid #edf0f5;
    color: #44516a;
    font-size: 11px;
    line-height: 1.45;
    vertical-align: middle;
    overflow-wrap: anywhere;
}
.materials-table tbody tr:last-child td { border-bottom: 0; }
.materials-table tbody tr:hover td { background: #fbfcff; }
.materials-table .text-right { text-align: right; }
.materials-table .text-center { text-align: center; }
.material-code {
    color: #5145e5;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.material-name-cell strong {
    display: block;
    color: #202c43;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.42;
}
.material-spec-cell { color: #738198 !important; }
.material-category-cell { color: #607087 !important; }
.material-unit-cell { color: #485770 !important; }
.price-cost { color: #27364d !important; font-variant-numeric: tabular-nums; }
.price-retail { color: #ed5a20 !important; font-variant-numeric: tabular-nums; }
.price-wholesale { color: #773ce5 !important; font-variant-numeric: tabular-nums; }
.stock-number {
    display: inline-block;
    min-width: 24px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}
.stock-safe { color: #087f61 !important; }
.stock-low { color: #e4473e !important; }
.stock-zero { color: #b42318 !important; }
.stock-min { color: #8692a5 !important; font-variant-numeric: tabular-nums; }
.stock-value-cell { white-space: nowrap; color: #24324a !important; font-variant-numeric: tabular-nums; }
.stock-value-cell strong { font-size: 10px; }
.stock-value-cell small { display: inline-block; margin-left: 2px; color: #67758a; font-weight: 700; }
.material-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.material-row-actions form { margin: 0; }
.icon-action {
    display: grid;
    place-items: center;
    width: 27px;
    height: 29px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
}
.icon-action svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.edit-action { color: #607693; }
.delete-action { color: #8290a4; }
.edit-action:hover { background: #eef2ff; color: #4f46e5; }
.delete-action:hover { background: #fff0ee; color: #d43c32; }
.stock-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}
.stock-state i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-state.stock-safe { background: #eaf8f1; }
.stock-state.stock-low { background: #fff5e8; }
.stock-state.stock-zero { background: #fff0ef; }
.materials-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 285px;
    padding: 30px;
    text-align: center;
}
.empty-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: #f0f2ff;
    color: #5145e5;
    font-size: 27px;
}
.materials-empty-state h3 { margin: 14px 0 4px; color: #293750; font-size: 15px; }
.materials-empty-state p { margin: 0 0 17px; color: #8390a4; font-size: 12px; }
.materials-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    padding: 15px;
}
.material-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid #e5eaf1;
    border-radius: 13px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.material-card:hover {
    transform: translateY(-2px);
    border-color: #cdd5f9;
    box-shadow: 0 7px 18px rgba(31, 42, 75, .07);
}
.material-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.material-card h3 { margin: 12px 0 5px; color: #24324a; font-size: 14px; line-height: 1.4; }
.material-specification { min-height: 31px; margin: 0; color: #7e8ba0; font-size: 11px; line-height: 1.45; }
.material-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.material-tags span { padding: 5px 7px; border-radius: 6px; background: #f3f6fa; color: #637188; font-size: 10px; }
.material-card-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px 0; border-top: 1px solid #edf0f5; }
.material-card-metrics > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.material-card-metrics small { color: #8a96a8; font-size: 10px; }
.material-card-metrics strong { color: #2e3b52; font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.material-card-metrics em { color: #8a96a8; font-size: 9px; font-style: normal; font-weight: 500; }
.material-card-metrics .metric-wide { grid-column: 1 / -1; padding-top: 8px; border-top: 1px dashed #e8edf3; }
.material-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid #edf0f5; }
.material-card-actions form { margin: 0; }
.material-edit-action, .material-delete-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #64758f;
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.material-edit-action svg, .material-delete-action svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.material-edit-action:hover { background: #eef2ff; color: #4f46e5; }
.material-delete-action:hover { background: #fff0ee; color: #c9362b; }
.materials-footnote {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #7e8ba0;
    font-size: 11px;
    line-height: 1.5;
}
.footnote-icon {
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 1px solid #b8c5d8;
    border-radius: 50%;
    color: #75849b;
    font-size: 10px;
    font-weight: 700;
}
.product-form-page { width: 100%; max-width: 1020px; margin: 0 auto; }
.product-back-link { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 15px; color: #65758e; font-size: 12px; font-weight: 700; text-decoration: none; }
.product-back-link:hover { color: #4f46e5; }
.product-form-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; }
.product-form-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: #eeedff; color: #5145e5; font-size: 25px; }
.product-form-mark-edit { background: #eef4ff; color: #53759c; font-size: 19px; }
.product-form-heading h2 { margin: 0 0 4px; color: #26344c; font-size: 20px; }
.product-form-heading p { margin: 0; color: #7d899c; font-size: 12px; }
.product-form-card { padding: 24px; border: 1px solid #e1e7f0; border-radius: 16px; background: #fff; box-shadow: 0 3px 12px rgba(23,32,58,.04); }
.product-form-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.product-form-section-title > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #f0f1ff; color: #5145e5; font-size: 10px; font-weight: 800; }
.product-form-section-title div { display: flex; flex-direction: column; gap: 3px; }
.product-form-section-title strong { color: #2c3a53; font-size: 12px; }
.product-form-section-title small { color: #8995a8; font-size: 10px; }
.section-separated { padding-top: 19px; border-top: 1px solid #edf0f5; }
.product-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 21px; }
.product-edit-grid .field { min-width: 0; }
.product-edit-grid .field label { color: #43516a; font-size: 11px; }
.product-edit-grid .field input, .product-edit-grid .field select, .product-edit-grid .field textarea {
    min-height: 39px;
    border: 1px solid #dce4ef;
    border-radius: 9px;
    background: #fff;
    color: #2b3951;
    font: inherit;
    font-size: 12px;
    outline: none;
}
.product-edit-grid .field input:focus, .product-edit-grid .field select:focus, .product-edit-grid .field textarea:focus {
    border-color: #8795f3;
    box-shadow: 0 0 0 3px rgba(79,70,229,.09);
}
.product-edit-grid .field textarea { min-height: 72px; resize: vertical; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: 1 / -1; }
.product-input-suffix { position: relative; }
.product-input-suffix input { padding-right: 38px !important; }
.product-input-suffix span { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: #8491a4; font-size: 11px; }
.product-current-stock { display: flex; align-items: center; gap: 6px; min-height: 39px; padding: 0 11px; border: 1px solid #e4eaf1; border-radius: 9px; background: #f6f8fb; color: #25344d; font-size: 13px; font-weight: 800; }
.product-current-stock span { color: #8793a6; font-size: 10px; font-weight: 500; }
.product-help-text { display: block; margin-top: 5px; color: #8b97a9; font-size: 10px; }
.product-field-error { display: block; min-height: 14px; margin-top: 4px; color: #c03932; font-size: 10px; }
.product-validation-summary { margin-bottom: 14px; color: #b42318; font-size: 12px; }
.product-validation-summary:empty { display: none; }
.product-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding-top: 17px; border-top: 1px solid #edf0f5; }
.product-cancel-button, .product-save-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border-radius: 9px; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
.product-cancel-button { border: 1px solid #dce4ef; background: #fff; color: #62718a; }
.product-cancel-button:hover { background: #f7f9fc; }
.product-save-button { border: 1px solid #5145e5; background: #5145e5; color: #fff; }
.product-save-button:hover { background: #4338ca; }
.product-save-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.nav-count.nav-count-empty { background: #8b95a8; }

@media (max-width: 1250px) {
    .materials-toolbar-card { grid-template-columns: 1fr; }
    .materials-toolbar-actions { justify-content: flex-end; }
}
@media (max-width: 900px) {
    .materials-filter-form { grid-template-columns: minmax(0, 1fr) minmax(140px, .8fr) minmax(155px, .9fr) 40px; }
    .materials-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .materials-filter-form { grid-template-columns: minmax(0, 1fr) 40px; }
    .materials-filter-form .materials-select { grid-column: 1 / -1; }
    .materials-search { grid-column: 1; }
    .materials-search-submit { grid-column: 2; grid-row: 1; }
    .materials-toolbar-actions { flex-wrap: wrap; justify-content: space-between; }
    .materials-panel-heading { align-items: flex-start; flex-direction: column; }
    .materials-quick-summary { justify-content: flex-start; }
    .materials-grid { grid-template-columns: 1fr; }
    .product-edit-grid { grid-template-columns: 1fr; }
    .field-span-2, .field-span-3 { grid-column: auto; }
    .product-form-card { padding: 17px; }
    .product-form-heading h2 { font-size: 17px; }
}


/* Import vật tư và khai báo tồn đầu kỳ */
.materials-import {
    color: #3156a5;
    background: #eff5ff;
    border-color: #dce8fb;
}
.materials-import:hover { background: #e5efff; }
.materials-opening {
    color: #7a4c0d;
    background: #fff8e8;
    border-color: #f3e5bd;
}
.materials-opening:hover { background: #fff1d1; }

.inventory-setup-page {
    display: grid;
    gap: 18px;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    min-width: 0;
}
.setup-back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    color: #69778d;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}
.setup-back-link:hover { color: #4f46e5; }
.setup-page-heading {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 2px 2px 5px;
}
.setup-heading-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 14px;
    color: #fff;
    box-shadow: 0 5px 13px rgba(79, 70, 229, .17);
}
.setup-heading-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.import-heading-icon { background: linear-gradient(145deg,#5574f4,#4f46e5); }
.opening-heading-icon { background: linear-gradient(145deg,#f0a634,#d88715); }
.setup-page-heading h2 {
    margin: 2px 0 4px;
    color: #24324a;
    font-size: 21px;
    line-height: 1.25;
    font-weight: 780;
}
.setup-page-heading p { margin: 0; color: #78869c; font-size: 12px; line-height: 1.5; }
.setup-page-heading .setup-eyebrow {
    margin-bottom: 2px;
    color: #8591a4;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
}
.import-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(285px, .8fr);
    align-items: start;
    gap: 17px;
}
.import-main-card,
.import-guide-card,
.opening-table-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e1e7f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(23,32,58,.04);
}
.import-main-card { padding: 22px; }
.import-step-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 17px;
}
.import-step-heading > div { display: grid; gap: 4px; }
.import-step-heading strong { color: #293750; font-size: 13px; }
.import-step-heading small { color: #8793a6; font-size: 11px; }
.step-number {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 10px;
    background: #eef1ff;
    color: #5145e5;
    font-size: 11px;
    font-weight: 800;
}
.template-download-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    padding: 9px 12px;
    border: 1px solid #dce7f7;
    border-radius: 9px;
    background: #f6f9ff;
    color: #35588d;
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}
.template-download-button:hover { background: #edf4ff; }
.template-download-button svg,
.setup-primary-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.upload-step-heading {
    padding: 18px 0 13px;
    border-top: 1px solid #edf0f5;
}
.import-upload-form { display: grid; gap: 15px; }
.import-dropzone {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 25px 18px 22px;
    border: 1.5px dashed #cbd7e8;
    border-radius: 13px;
    background: #fafcff;
    text-align: center;
}
.upload-cloud-icon {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border-radius: 13px;
    background: #edf2ff;
    color: #5145e5;
}
.upload-cloud-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.import-dropzone label { color: #293750; font-size: 12px; font-weight: 750; }
.import-dropzone input[type=file] {
    width: min(100%, 390px);
    padding: 8px;
    border: 1px solid #dce4ef;
    border-radius: 9px;
    background: #fff;
    color: #516078;
    font: inherit;
    font-size: 11px;
}
.import-dropzone small { color: #8b97aa; font-size: 10px; }
.import-upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}
.setup-primary-button,
.setup-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 39px;
    padding: 0 15px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}
.setup-primary-button {
    border: 1px solid #4f46e5;
    background: #5145e5;
    color: #fff;
    box-shadow: 0 3px 8px rgba(79,70,229,.15);
}
.setup-primary-button:hover { background: #4338ca; }
.setup-secondary-button { border: 1px solid #dfe5ee; background: #fff; color: #68758a; }
.setup-secondary-button:hover { background: #f7f9fc; }
.import-safe-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 17px;
    padding: 11px 12px;
    border-radius: 9px;
    background: #f0faf5;
    color: #4b7664;
    font-size: 10px;
    line-height: 1.5;
}
.import-safe-note > span {
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    border-radius: 50%;
    background: #d9f2e5;
    color: #078153;
    font-weight: 800;
}
.import-guide-card { padding: 19px 18px; }
.guide-heading { display: flex; align-items: center; gap: 10px; padding-bottom: 13px; border-bottom: 1px solid #edf0f5; }
.guide-heading > div { display: grid; gap: 3px; }
.guide-heading strong { color: #293750; font-size: 12px; }
.guide-heading small { color: #909bad; font-size: 10px; }
.guide-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: #edf2ff;
    color: #5145e5;
    font-weight: 800;
}
.import-rule-list { display: grid; gap: 13px; margin: 15px 0 18px; padding: 0; list-style: none; }
.import-rule-list li { display: flex; align-items: flex-start; gap: 9px; }
.import-rule-list li > span {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 7px;
    background: #f1f4f8;
    color: #65748c;
    font-size: 9px;
    font-weight: 800;
}
.import-rule-list li div { display: grid; gap: 3px; }
.import-rule-list strong { color: #3c4a61; font-size: 10px; }
.import-rule-list small { color: #8591a4; font-size: 10px; line-height: 1.5; }
.category-reference { padding-top: 13px; border-top: 1px solid #edf0f5; }
.category-reference > strong { color: #536179; font-size: 10px; }
.category-reference p { color: #8894a6; font-size: 10px; }
.category-reference-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.category-reference-tags span {
    padding: 5px 8px;
    border: 1px solid #e4eaf2;
    border-radius: 7px;
    background: #f8fafc;
    color: #69768b;
    font-size: 9px;
}
.import-error-panel {
    padding: 14px 16px;
    border: 1px solid #f2c9c5;
    border-radius: 13px;
    background: #fff7f6;
    color: #9c3831;
}
.import-error-title { display: flex; align-items: center; gap: 9px; }
.import-alert-icon {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #fee3e0;
    color: #be3c34;
    font-weight: 900;
}
.import-error-title div { display: grid; gap: 3px; }
.import-error-title strong { font-size: 11px; }
.import-error-title small { color: #a5645e; font-size: 10px; }
.import-error-panel ul { display: grid; gap: 4px; margin: 11px 0 0 34px; padding: 0; font-size: 10px; }

.opening-stock-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border: 1px solid #f2e1b9;
    border-radius: 12px;
    background: #fffaf0;
}
.warning-symbol {
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    border-radius: 50%;
    background: #fff0ca;
    color: #9a6812;
    font-size: 12px;
    font-weight: 850;
}
.opening-stock-warning strong { color: #72551f; font-size: 11px; }
.opening-stock-warning p { margin: 4px 0 0; color: #8a7650; font-size: 10px; line-height: 1.5; }
.opening-stock-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.opening-summary-card {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 73px;
    padding: 13px 15px;
    border: 1px solid #e3e8f0;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 2px 9px rgba(23,32,58,.035);
}
.opening-summary-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 800;
}
.summary-total-icon { background: #eef2ff; color: #5145e5; }
.summary-ready-icon { background: #eaf8f1; color: #078153; }
.summary-locked-icon { background: #f1f3f6; font-size: 13px; }
.opening-summary-card div { display: grid; gap: 3px; }
.opening-summary-card small { color: #8793a6; font-size: 10px; }
.opening-summary-card strong { color: #26344d; font-size: 18px; line-height: 1; }
.opening-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px,1fr) minmax(170px,.7fr) auto;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e1e7f0;
    border-radius: 13px;
    background: #fff;
}
.opening-search-box { display: flex; align-items: center; height: 39px; border: 1px solid #dce4ef; border-radius: 9px; }
.opening-search-box:focus-within { border-color: #8795f3; box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.opening-search-box svg { width: 16px; height: 16px; margin: 0 9px 0 11px; flex: 0 0 16px; fill: none; stroke: #8793a6; stroke-width: 1.8; }
.opening-search-box input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: #34435b; font: inherit; font-size: 11px; }
.opening-filter-bar select { height: 39px; padding: 0 12px; border: 1px solid #dce4ef; border-radius: 9px; background: #fff; color: #495872; font: inherit; font-size: 11px; }
.opening-filter-submit { min-width: 90px; height: 39px; border: 0; border-radius: 9px; background: #eef2ff; color: #4f46e5; font-size: 11px; font-weight: 750; cursor: pointer; }
.opening-filter-submit:hover { background: #e3e9ff; }
.opening-stock-form { min-width: 0; }
.opening-validation-summary {
    margin-bottom: 10px;
    padding: 11px 13px;
    border: 1px solid #f2c9c5;
    border-radius: 10px;
    background: #fff7f6;
    color: #a33a32;
    font-size: 10px;
}
.opening-table-card { width: 100%; }
.opening-table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 17px;
    border-bottom: 1px solid #edf0f5;
}
.opening-table-heading h3 { margin: 0 0 4px; color: #293750; font-size: 13px; }
.opening-table-heading p { margin: 0; color: #8692a4; font-size: 10px; }
.opening-unit-note { color: #909bad; font-size: 9px; white-space: nowrap; }
.opening-table-scroll { width: 100%; overflow-x: auto; }
.opening-table { width: 100%; min-width: 930px; border-collapse: collapse; table-layout: fixed; }
.opening-table th {
    padding: 11px 10px;
    border-bottom: 1px solid #e4e9f0;
    background: #f1f5f9;
    color: #536178;
    font-size: 10px;
    font-weight: 750;
    text-align: left;
}
.opening-table td {
    height: 60px;
    padding: 9px 10px;
    border-bottom: 1px solid #eef1f5;
    color: #526078;
    font-size: 10px;
    vertical-align: middle;
}
.opening-table tbody tr:last-child td { border-bottom: 0; }
.opening-table tbody tr:hover td { background: #fbfcfe; }
.opening-table th:nth-child(1) { width: 11%; }
.opening-table th:nth-child(2) { width: 22%; }
.opening-table th:nth-child(3) { width: 15%; }
.opening-table th:nth-child(4) { width: 12%; }
.opening-table th:nth-child(5) { width: 14%; }
.opening-table th:nth-child(6) { width: 15%; }
.opening-table th:nth-child(7) { width: 11%; }
.opening-number { text-align: right !important; font-variant-numeric: tabular-nums; }
.opening-number small { color: #8995a8; font-size: 9px; }
.opening-code { color: #5145e5; font-family: ui-monospace,Consolas,monospace; font-size: 9px; font-weight: 700; overflow-wrap: anywhere; }
.opening-product-name { display: block; color: #2b3850; font-size: 10px; line-height: 1.4; }
.opening-unit { display: block; margin-top: 3px; color: #909bad; font-size: 9px; }
.opening-category { color: #68768b; }
.opening-old-value { color: #8894a6 !important; }
.opening-quantity-input {
    width: min(120px,100%);
    height: 33px;
    padding: 0 9px;
    border: 1px solid #cfd9e8;
    border-radius: 8px;
    background: #fff;
    color: #27364d;
    font: inherit;
    font-size: 11px;
    font-weight: 750;
    text-align: right;
    outline: none;
}
.opening-quantity-input:focus { border-color: #6e7af0; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.opening-quantity-input.is-locked { border-color: #e6e9ee; background: #f3f5f8; color: #929cad; }
.opening-row-error { display: block; color: #c23a32; font-size: 9px; }
.opening-status { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 20px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.opening-status.ready { background: #eaf8f1; color: #087f61; }
.opening-status.locked { background: #f1f3f6; color: #788397; }
.opening-locked-row td { background: #fcfcfd; }
.opening-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 15px;
    border-top: 1px solid #edf0f5;
    color: #8591a4;
    font-size: 10px;
}
.opening-table-footer strong { color: #47566e; }
.opening-save-button { min-height: 36px; }
.opening-empty-state { display: grid; justify-items: center; padding: 45px 20px; color: #8995a8; }
.opening-empty-state span { font-size: 26px; color: #9ca8b9; }
.opening-empty-state strong { margin-top: 6px; color: #495770; font-size: 12px; }
.opening-empty-state p { margin: 5px 0 0; font-size: 10px; }
.opening-stock-inline-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    grid-column: 1/-1;
    padding: 11px 12px;
    border: 1px solid #dfe9fb;
    border-radius: 9px;
    background: #f5f8ff;
    color: #637492;
    font-size: 10px;
    line-height: 1.5;
}
.opening-stock-inline-note > span {
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    border-radius: 50%;
    background: #e5edff;
    color: #4f46e5;
    font-size: 10px;
    font-weight: 800;
}
@media(max-width:1000px) {
    .import-workspace { grid-template-columns: 1fr; }
    .materials-toolbar-actions { flex-wrap: wrap; }
}
@media(max-width:700px) {
    .setup-page-heading h2 { font-size: 18px; }
    .import-main-card { padding: 16px; }
    .template-download-button { padding: 8px; font-size: 10px; }
    .opening-stock-summary { grid-template-columns: 1fr; gap: 8px; }
    .opening-filter-bar { grid-template-columns: 1fr 1fr; }
    .opening-search-box { grid-column: 1/-1; }
    .opening-filter-submit { grid-column: 1/-1; }
    .opening-table-heading { align-items: flex-start; flex-direction: column; }
    .opening-unit-note { white-space: normal; }
    .opening-table-footer { align-items: flex-start; flex-direction: column; }
}

.opening-stock-inline-note a { color: #4f46e5; font-weight: 750; text-decoration: none; }
.opening-stock-inline-note a:hover { text-decoration: underline; }

/* Quản lý nhóm vật tư, tài khoản và đăng nhập */
.page-intro{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:0 0 20px}.page-intro h2{font-size:24px;margin:4px 0 6px;color:#17203a}.page-intro p{margin:0;color:#75809a}.eyebrow{font-size:10px;font-weight:800;letter-spacing:1.2px;color:#6960dc}.action-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 16px;border:0;border-radius:10px;font-weight:700;text-decoration:none;cursor:pointer;font-size:13px;white-space:nowrap}.action-btn.primary{background:linear-gradient(135deg,#6258ec,#493ed0);color:white;box-shadow:0 5px 12px #5348d32a}.action-btn.primary:hover{filter:brightness(1.06)}.action-btn.light{background:#f3f5fa;color:#505c76;border:1px solid #e5e8f0}.action-btn.dark{background:#262052;color:white}.stat-strip{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}.stat-strip>div{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px 19px}.stat-strip span{display:block;color:#75809a;font-size:12px}.stat-strip b{display:block;font-size:24px;margin-top:8px;color:#242052}.management-panel{padding:18px 0 0;overflow:hidden}.searchbar{display:flex;gap:9px;padding:0 18px 18px}.searchbar input{flex:1;min-width:160px;border:1px solid #dfe4ef;border-radius:10px;padding:11px 13px;font:inherit;outline:none}.searchbar input:focus,.field input:focus,.field select:focus,.field textarea:focus,.auth-form input:focus{border-color:#7a70ea;box-shadow:0 0 0 3px #6358e21a}.table-scroll{overflow-x:auto}.management-table{border-collapse:collapse;width:100%;min-width:740px}.management-table th{background:#f8f9fc;padding:13px 16px;text-align:left;color:#78839a;font-size:10px;letter-spacing:.5px;border-top:1px solid #eef0f5}.management-table td{padding:14px 16px;border-top:1px solid #eef0f5;color:#39445e;font-size:13px}.management-table tbody tr:hover{background:#fbfcff}.management-table strong{color:#212b44}.management-table .right{text-align:right}.code-badge{display:inline-block;background:#f0efff;color:#4f46c8;border-radius:7px;padding:5px 9px;font-weight:700;font-size:11px}.count-badge,.status-pill,.role-pill{display:inline-block;border-radius:20px;padding:5px 9px;font-size:11px;font-weight:700;background:#eff3f9;color:#53617c}.actions{white-space:nowrap}.actions form{display:inline}.text-action{background:none;border:0;padding:5px 6px;color:#5147cf;font:inherit;font-weight:700;font-size:12px;text-decoration:none;cursor:pointer}.danger-text{color:#d44848}.empty-state{text-align:center;padding:36px!important;color:#7b8498!important}.form-wrap{max-width:860px;margin:auto}.data-form{padding:25px}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px 18px}.field{display:flex;flex-direction:column;gap:7px}.field.full{grid-column:1/-1}.field label{font-weight:700;color:#3b4660;font-size:13px}.field label em{color:#e35555;font-style:normal}.field input,.field select,.field textarea{width:100%;border:1px solid #dfe4ef;border-radius:9px;padding:11px 12px;color:#26324d;font:inherit;background:#fff;outline:none}.field textarea{resize:vertical}.field small{font-size:11px;color:#818ba0}.field span[data-valmsg-for]{color:#d44848;font-size:11px}.form-footer{display:flex;justify-content:flex-end;gap:10px;margin-top:25px;padding-top:18px;border-top:1px solid #edf0f5}.validation{color:#c23c3c;margin:8px 0}.validation ul{margin:3px 0;padding-left:20px}.role-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:13px;margin-bottom:18px}.role-card{display:flex;gap:12px;align-items:flex-start;background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px}.role-card b{font-size:13px}.role-card p{font-size:11px;color:#75809a;line-height:1.5;margin:5px 0 0}.role-icon{width:34px;height:34px;display:grid;place-items:center;border-radius:10px;font-size:17px}.role-icon.violet{color:#5b50d5;background:#f0efff}.role-icon.blue{color:#2974c8;background:#eaf4ff}.role-icon.green{color:#06895e;background:#e8f8f1}.role-pill.admin{background:#f0efff;color:#574bd0}.role-pill.manager{background:#eaf4ff;color:#2873ba}.role-pill.staff{background:#e8f8f1;color:#06895e}.status-pill.enabled{background:#e7f8f0;color:#07875d}.status-pill.disabled{background:#fff0f0;color:#c74444}.user-cell{display:flex;align-items:center;gap:10px}.user-cell small{display:block;color:#8b94a7;font-size:10px;margin-top:3px}.avatar,.user-avatar-small{width:34px;height:34px;display:inline-grid;place-items:center;border-radius:50%;background:#efedff;color:#5548cf;font-weight:800}.notice-box{background:#f6f7ff;border:1px solid #e5e4fc;border-radius:10px;padding:13px 15px;margin-top:22px;color:#454c71;font-size:12px}.notice-box p{margin:5px 0 0;color:#737d96}.check-line{display:flex!important;flex-direction:row!important;align-items:center;gap:8px;font-weight:500!important}.check-line input{width:auto}.hidden{display:none}.user-menu{display:flex;align-items:center;gap:8px;margin-left:5px;border-left:1px solid #e7eaf1;padding-left:12px}.user-avatar-small{width:31px;height:31px;font-size:12px}.user-name{font-size:11px;font-weight:700;color:#313b55;white-space:nowrap}.user-name small{display:block;font-weight:400;color:#8490a3;font-size:10px}.logout-btn{border:0;background:#f4f5fa;color:#636d83;border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:17px}.auth-page{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at 15% 10%,#e2e1ff 0,transparent 32%),linear-gradient(140deg,#f4f6fc,#eeeff8)}.auth-card{width:min(100%,440px);background:#fff;border:1px solid #e5e8f1;border-radius:22px;padding:34px 38px;box-shadow:0 22px 70px #25205218}.auth-brand{display:flex;align-items:center;gap:12px;padding-bottom:25px;border-bottom:1px solid #edf0f5}.auth-brand .brand-icon{color:#fff}.auth-brand b{display:block;font-size:16px;color:#242052}.auth-brand small{font-size:9px;letter-spacing:1px;color:#8a91a4}.auth-welcome{margin:28px 0 20px}.auth-welcome h1{font-size:23px;margin:8px 0}.auth-welcome p{color:#7b859a;margin:0;font-size:13px}.auth-form{display:flex;flex-direction:column;gap:9px}.auth-form label{font-weight:700;font-size:12px;color:#3d4760;margin-top:6px}.auth-form input{padding:12px;border:1px solid #dfe4ef;border-radius:9px;outline:none;font:inherit}.auth-submit{width:100%;margin-top:12px;padding:13px}.auth-submit span{margin-left:auto}.auth-foot{text-align:center;color:#9aa2b2;font-size:10px;margin-top:23px}
@media(max-width:900px){.role-cards{grid-template-columns:1fr}.top-actions .date{display:none}.user-name{display:none}.stat-strip{grid-template-columns:1fr 1fr}.page-intro h2{font-size:20px}}
@media(max-width:620px){.sidebar{width:68px;padding:12px 7px}.brand{padding:4px 0 14px;justify-content:center}.brand>div,.sidebar nav label,.sidebar nav a span:not(.nav-icon),.nav-count,.side-total{display:none!important}.sidebar nav a{justify-content:center;padding:12px 5px}.nav-icon{font-size:19px}.content{margin-left:68px}header{height:auto;min-height:66px;padding:10px 12px}header small,.top-actions .top-btn span{display:none}main{padding:15px}.top-actions{gap:5px}.top-actions .top-btn{padding:9px}.page-intro{align-items:flex-start}.page-intro p{font-size:12px}.action-btn{padding:10px;font-size:11px}.stat-strip{grid-template-columns:1fr}.field-grid{grid-template-columns:1fr}.field.full{grid-column:auto}.data-form{padding:18px}.searchbar{padding:0 12px 14px}.auth-card{padding:26px 22px}.user-menu{padding-left:6px}.logout-btn{width:28px}.management-table td,.management-table th{padding:12px}}


/* Transaction history and client-side receipt downloads */
.history-panel{padding:0;overflow:hidden}
.history-heading{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--line,#e4e9f2)}
.history-heading strong{display:block;color:#20284a;font-size:16px}
.history-heading small{display:block;margin-top:4px;color:#77819a}
.history-table-wrap{width:100%;overflow-x:auto}
.history-table{width:100%;min-width:820px;border-collapse:collapse}
.history-table th{background:#f6f8fc;color:#68748f;font-size:11px;font-weight:700;letter-spacing:.04em;text-align:left;padding:13px 16px}
.history-table td{padding:13px 16px;border-top:1px solid #edf0f6;color:#25304a;vertical-align:middle}
.history-table tr:hover td{background:#fbfcff}
.history-table td strong{color:#4338ca}
.history-download{padding:8px 12px;font-size:12px;margin:2px}
.history-empty{padding:34px!important;text-align:center;color:#7a849b!important}
.history-note{margin:0;padding:12px 20px;border-top:1px solid #edf0f6;color:#68748f;font-size:12px}
.toolbar form{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.toolbar form input{min-width:250px}
.page-intro{display:flex;align-items:center;justify-content:space-between;margin:4px 0 18px}
.page-intro h2{margin:5px 0;color:#20284a;font-size:23px}
.page-intro p{margin:0;color:#77819a}
.page-intro .eyebrow{color:#68748f;font-size:11px;font-weight:700;letter-spacing:.08em}
@media(max-width:700px){
  .history-table th,.history-table td{padding:10px}
  .toolbar form input{min-width:0;flex:1}
  .page-intro h2{font-size:20px}
}

/* Readability refinements: material groups, product list, and opening stock grid */
.management-panel .management-table th {
    background: #e5ebf3;
    color: #111827;
    font-size: 12px;
    font-weight: 800;
    padding: 14px 16px;
    border-bottom: 1px solid #cbd5e1;
}
.management-panel .management-table td {
    color: #111827;
    font-size: 14px;
    padding: 15px 16px;
}
.management-panel .management-table td .muted {
    color: #111827 !important;
}
.management-panel .management-table td strong {
    color: #111827;
}

.materials-screen .materials-table thead th {
    background: #e5ebf3;
    color: #111827;
    font-size: 12px;
    padding: 13px 9px;
    border-bottom: 1px solid #cbd5e1;
}
.materials-screen .materials-table tbody td {
    color: #111827;
    font-size: 13px;
    padding: 12px 9px;
}
.materials-screen .materials-table .material-name-cell strong {
    color: #111827;
    font-size: 13px;
}
.materials-screen .materials-table .material-code {
    color: #111827;
    font-size: 11px;
}
.materials-screen .materials-table .material-spec-cell,
.materials-screen .materials-table .material-category-cell,
.materials-screen .materials-table .material-unit-cell {
    color: #111827 !important;
}

.opening-stock-page .opening-table th {
    background: #e5ebf3;
    color: #111827;
    font-size: 12px;
    font-weight: 800;
    padding: 13px 11px;
    border-bottom: 1px solid #cbd5e1;
}
.opening-stock-page .opening-table td {
    color: #111827;
    font-size: 12px;
    padding: 11px;
}
.opening-stock-page .opening-table input,
.opening-stock-page .opening-table select {
    color: #111827;
    font-size: 13px;
}

/* Excel import panel for material groups */
.category-import-panel {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.45fr);
    gap: 16px 24px;
    align-items: center;
    margin: 0 0 18px;
    padding: 20px 22px;
    border: 1px solid #dce4ef;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 100%);
    box-shadow: 0 8px 24px rgba(25, 42, 70, .05);
}
.category-import-copy h3 {
    margin: 4px 0 6px;
    color: #111827;
    font-size: 17px;
}
.category-import-copy p {
    margin: 0;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.55;
}
.category-import-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.category-import-form {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin: 0;
}
.category-file-label {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #d4dce8;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    font-size: 13px;
    font-weight: 650;
}
.category-file-input {
    width: min(240px, 100%);
    max-width: 240px;
    color: #111827;
    font-size: 12px;
}
.category-import-hint {
    grid-column: 1 / -1;
    color: #4b5563;
    font-size: 12px;
}
.import-row-errors {
    margin: 0 0 14px;
    padding: 14px 16px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: #fff7f7;
    color: #7f1d1d;
}
.import-row-errors pre {
    margin: 8px 0 0;
    white-space: pre-wrap;
    font: inherit;
    font-size: 12px;
}
@media (max-width: 900px) {
    .category-import-panel { grid-template-columns: 1fr; }
    .category-import-actions { justify-content: flex-start; }
    .category-import-hint { grid-column: 1; }
}
@media (max-width: 600px) {
    .category-import-form { width: 100%; }
    .category-file-input { max-width: 100%; }
}



/* Báo cáo doanh thu: giao diện bộ lọc, thẻ tổng hợp và bảng ngày */
.revenue-intro{align-items:flex-end;gap:18px}
.revenue-export{white-space:nowrap}
.revenue-filter{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;padding:16px 18px}
.revenue-field{display:flex;flex-direction:column;gap:6px;min-width:145px}
.revenue-field label{font-size:12px;font-weight:700;color:#334155}
.revenue-field select,.revenue-field input{height:42px;padding:0 12px;border:1px solid #d7e0ec;border-radius:10px;background:#fff;color:#111827;font:inherit}
.revenue-period-select{min-width:170px}
.period-part{display:none}
.period-part.is-visible{display:flex}
.revenue-submit{height:42px;white-space:nowrap}
.revenue-period-caption{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:14px 2px;color:#64748b;font-size:13px}
.revenue-period-caption strong{color:#111827}
.revenue-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:14px 0 18px}
.revenue-summary-card{min-width:0;padding:18px 20px;border:1px solid #dce4ee;border-radius:15px;background:#fff;box-shadow:0 5px 16px rgba(25,45,75,.045);display:flex;flex-direction:column;gap:8px}
.revenue-summary-card small{color:#64748b;font-size:12px}
.revenue-summary-card strong{color:#111827;font-size:24px;line-height:1.2;overflow-wrap:anywhere}
.revenue-summary-card span{color:#64748b;font-size:12px}
.revenue-summary-primary{background:linear-gradient(135deg,#29246f,#4033ae);border-color:#4033ae}
.revenue-summary-primary small,.revenue-summary-primary span{color:#d9ddff}
.revenue-summary-primary strong{color:#fff}
.revenue-table-panel{padding:0;overflow:hidden}
.revenue-table-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:17px 20px;border-bottom:1px solid #e4eaf2}
.revenue-table-heading div{display:flex;flex-direction:column;gap:5px}
.revenue-table-heading strong{color:#111827;font-size:16px}
.revenue-table-heading small,.revenue-table-heading>span{color:#64748b;font-size:12px}
.revenue-table-wrap{width:100%;overflow:auto}
.revenue-table{width:100%;border-collapse:collapse;min-width:720px}
.revenue-table thead th{padding:12px 14px;background:#e5ebf3;color:#111827;text-align:left;font-size:12px;font-weight:700;border-bottom:1px solid #cbd5e1}
.revenue-table tbody td{padding:11px 14px;color:#111827;font-size:13px;border-bottom:1px solid #edf1f6}
.revenue-table tbody tr:hover{background:#f8fafc}
.revenue-table .number-cell{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.revenue-table tfoot th{padding:13px 14px;background:#f1f5f9;color:#111827;text-align:left;font-size:13px;border-top:1px solid #cbd5e1}
.revenue-table tfoot .number-cell{text-align:right;white-space:nowrap}
@media(max-width:1050px){.revenue-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.revenue-intro{align-items:flex-start;flex-direction:column}.revenue-filter{align-items:stretch}.revenue-field,.revenue-period-select{min-width:100%}.revenue-submit{width:100%}.revenue-period-caption{align-items:flex-start;flex-direction:column}.revenue-summary-grid{grid-template-columns:1fr}.revenue-summary-card{padding:16px}.revenue-table-heading{align-items:flex-start;flex-direction:column}}


/* Reworked Excel upload panel: remove the browser-native file control from view. */
.category-import-panel {
    grid-template-columns: minmax(300px, .95fr) minmax(480px, 1.05fr);
    align-items: center;
    gap: 18px 34px;
    padding: 22px 26px;
}
.category-import-copy { min-width: 0; }
.category-import-copy .eyebrow { margin-bottom: 8px; }
.category-import-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 11px;
    min-width: 0;
}
.category-import-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.category-import-format {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}
.category-format-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #16a36a;
    box-shadow: 0 0 0 4px rgba(22,163,106,.12);
}
.category-template-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid #dce4ef;
    border-radius: 9px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: .18s ease;
}
.category-template-link:hover {
    border-color: #4f46e5;
    color: #4338ca;
    background: #f8f7ff;
}
.category-import-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
    align-items: stretch;
    gap: 11px;
    width: 100%;
    margin: 0;
}
.category-file-field {
    position: relative;
    min-width: 0;
}
.category-file-input {
    position: absolute !important;
    z-index: 2;
    top: 50%;
    left: 10px;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden;
    opacity: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}
.category-file-picker {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    min-height: 64px;
    padding: 9px 10px 9px 13px;
    border: 1px dashed #b8c6d9;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: .18s ease;
}
.category-file-picker:hover,
.category-file-input:focus-visible + .category-file-picker {
    border-color: #4f46e5;
    background: #f8f7ff;
    outline: 3px solid rgba(79,70,229,.12);
}
.category-file-icon {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 19px;
}
.category-file-meta {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.category-file-meta strong {
    overflow: hidden;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.category-file-meta small {
    color: #64748b;
    font-size: 11px;
}
.category-file-browse {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #dce4ef;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}
.category-import-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 64px;
    padding: 0 16px;
    white-space: nowrap;
}
.category-import-hint {
    grid-column: 1 / -1;
    margin-top: -1px;
    color: #64748b;
    line-height: 1.5;
}
@media (max-width: 1100px) {
    .category-import-panel {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}
@media (max-width: 620px) {
    .category-import-panel { padding: 17px; }
    .category-import-form { grid-template-columns: 1fr; }
    .category-import-submit { min-height: 46px; width: 100%; }
    .category-file-picker { min-height: 60px; }
    .category-import-topline { align-items: flex-start; }
}

/* Revenue filters: date range and period presets. */
.revenue-range-fields {
    align-items: flex-end;
    gap: 10px;
}
.revenue-range-fields .revenue-field { min-width: 158px; }
.revenue-filter-error {
    margin: 12px 0;
    padding: 12px 15px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fff7f7;
    color: #991b1b;
    font-size: 13px;
}
.revenue-empty-state {
    padding: 34px 16px !important;
    color: #64748b !important;
    text-align: center !important;
}
@media (max-width: 820px) {
    .revenue-filter { align-items: stretch; }
    .revenue-range-fields { flex-wrap: wrap; }
    .revenue-range-fields .revenue-field { flex: 1 1 150px; }
}
@media (max-width: 560px) {
    .revenue-range-fields { width: 100%; flex-direction: column; align-items: stretch; }
    .revenue-range-fields .revenue-field { width: 100%; }
    .revenue-submit { width: 100%; }
}


/* Sales invoice: matching the supplied A5/A4 workbook template */
.invoice-paper-setting {
    display: grid;
    gap: 6px;
    margin: 12px 0 14px;
}
.invoice-paper-setting label {
    color: #5f6d84;
    font-size: 11px;
    font-weight: 750;
}
.invoice-paper-setting select {
    width: 100%;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid #d8e0ec;
    border-radius: 9px;
    background: #fff;
    color: #25324a;
    font: inherit;
    font-size: 12px;
}
.invoice-paper-setting small { color: #8a96a8; font-size: 10px; line-height: 1.4; }

.invoice-preview-dialog { max-width: 1500px; }
.invoice-preview-toolbar { align-items: center; }
.invoice-preview-toolbar>div:first-child { min-width: 0; }
.invoice-preview-toolbar>div:first-child strong { display: block; }
.invoice-preview-toolbar>div:first-child span { display: block; margin-top: 4px; color: #8490a4; font-size: 11px; }
.invoice-preview-actions { align-items: center; flex-wrap: wrap; }
.invoice-paper-control { display: grid; gap: 4px; color: #69768c; font-size: 10px; font-weight: 700; }
.invoice-paper-control select {
    min-width: 72px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #dce4ef;
    border-radius: 8px;
    background: #fff;
    color: #28364d;
    font: inherit;
    font-size: 12px;
}
.invoice-preview-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    min-height: 300px;
    max-height: calc(100vh - 185px);
    overflow: auto;
    padding: 22px;
    background: #e9edf3;
}
.invoice-preview-stage[data-active-paper="A5"] .sales-invoice-sheet[data-paper-size="A4"],
.invoice-preview-stage[data-active-paper="A4"] .sales-invoice-sheet[data-paper-size="A5"] {
    display: none;
}
.sales-invoice-sheet {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 210mm;
    min-height: 297mm;
    padding: 7mm 7mm 6mm;
    background: #fff;
    color: #111;
    box-shadow: 0 5px 22px rgba(20, 30, 50, .16);
    font-family: Calibri, Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.2;
}
.sales-invoice-sheet[data-paper-size="A5"] {
    width: 148mm;
    min-height: 210mm;
    padding: 4.5mm 4.5mm 4mm;
    font-size: 9pt;
}
.invoice-letterhead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
    align-items: start;
    gap: 5mm;
    min-height: 34mm;
}
.invoice-brand {
    min-width: 0;
    font-size: 10pt;
    line-height: 1.28;
}
.invoice-brand>strong {
    display: block;
    margin: 0 0 5px;
    color: #111;
    font-size: 16pt;
    line-height: 1.08;
    text-align: center;
}
.invoice-brand>div { margin: 1px 0; }
.invoice-contact-line { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.invoice-contact-line b { font-size: 7.5pt; white-space: nowrap; }
.invoice-services {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    font-size: 9pt;
    line-height: 1.16;
}
.invoice-services>strong { margin-bottom: 2px; font-size: 10pt; }
.invoice-services>b { margin-top: 2px; }
.invoice-document-title {
    margin: 2.5mm 0 1mm;
    font-size: 16pt;
    font-weight: 700;
    text-align: center;
}
.invoice-sheet-a4 .invoice-document-title {
    margin-top: 1.5mm;
    text-align: left;
}
.invoice-document-date {
    margin: 0 0 3mm;
    font-size: 10pt;
    font-weight: 700;
    text-align: right;
}
.invoice-customer-a4 {
    display: grid;
    gap: 2mm;
    margin: 2mm 0 3mm;
    font-size: 11pt;
}
.invoice-customer-a5 {
    margin: 1.5mm 0 2.5mm;
    font-size: 9pt;
}
.invoice-customer-name,
.invoice-customer-address {
    display: grid;
    grid-template-columns: 34mm minmax(0,1fr);
    gap: 2mm;
    min-height: 6mm;
    align-items: end;
}
.invoice-customer-name { min-height: 7mm; }
.invoice-lines {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    color: #111;
}
.invoice-lines th,
.invoice-lines td {
    border: 1px solid #585858;
    padding: 1.1mm 1mm;
    vertical-align: middle;
    overflow-wrap: anywhere;
}
.invoice-lines th {
    font-weight: 700;
    text-align: center;
}
.invoice-lines-a4 { font-size: 10pt; }
.invoice-lines-a4 th { height: 8mm; font-size: 10.5pt; }
.invoice-lines-a4 tbody td { height: 7.5mm; }
.invoice-lines-a5 { font-size: 8.5pt; }
.invoice-lines-a5 th { height: 6.3mm; padding: .7mm; font-size: 8pt; }
.invoice-lines-a5 tbody td { height: 5.9mm; padding: .6mm .8mm; }
.invoice-lines .invoice-centered { text-align: center; }
.invoice-lines .invoice-number { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.invoice-lines .invoice-item-name { text-align: left; }
.invoice-lines tfoot td { height: 8mm; font-weight: 700; }
.invoice-lines-a5 tfoot td { height: 6.5mm; }
.invoice-total-label { text-align: left; }
.invoice-amount-words {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-height: 9mm;
    padding: 2mm 0;
    font-size: 10pt;
}
.invoice-sheet-a5 .invoice-amount-words { min-height: 7mm; font-size: 8.5pt; }
.invoice-amount-words b { flex: 0 0 auto; }
.invoice-amount-words span { overflow-wrap: anywhere; }
.invoice-signatures {
    display: flex;
    justify-content: space-between;
    gap: 20mm;
    min-height: 31mm;
    padding: 3mm 7mm 0;
    font-size: 10pt;
}
.invoice-sheet-a5 .invoice-signatures { min-height: 27mm; padding: 2mm 6mm 0; font-size: 8.5pt; }
.invoice-customer-sign,
.invoice-owner-sign {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.invoice-customer-sign { min-width: 35%; }
.invoice-owner-sign { min-width: 48%; gap: 2px; }
.invoice-owner-sign>b { margin-bottom: 1mm; }
.invoice-owner-sign>strong { margin-top: 1mm; }
.invoice-owner-sign>span { margin-top: auto; font-weight: 700; }
.sales-print-page {
    min-height: 100vh;
    margin: 0;
    padding: 18px;
    background: #f2f4f8;
    color: #202b40;
    font-family: "Segoe UI", Arial, sans-serif;
}
.sales-print-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    max-width: 1200px;
    margin: 0 auto 12px;
    padding: 12px 15px;
    border: 1px solid #e0e6ef;
    border-radius: 12px;
    background: #fff;
}
.sales-print-toolbar>div:first-child { display: grid; gap: 4px; }
.sales-print-toolbar>div:first-child strong { color: #27354b; font-size: 14px; }
.sales-print-toolbar>div:first-child span { color: #7b8799; font-size: 11px; }
.sales-print-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sales-print-actions>a,
.sales-print-actions>button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid #dce4ef;
    border-radius: 8px;
    background: #fff;
    color: #34435c;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.sales-print-actions>a:first-of-type,
.sales-print-actions>button { border-color: #4f46e5; background: #5145e5; color: #fff; }
.sales-print-saved {
    max-width: 1200px;
    margin: 0 auto 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: #e8f8ef;
    color: #08784f;
    font-size: 11px;
}
.sales-print-saved span { color: #57836e; }

@media screen and (max-width: 850px) {
    .invoice-preview-stage { align-items: flex-start; padding: 14px; }
    .sales-invoice-sheet { transform-origin: top left; }
    .sales-print-toolbar { align-items: flex-start; flex-direction: column; }
    .sales-print-page { padding: 10px; }
}
@media screen and (max-width: 600px) {
    .invoice-preview-actions { justify-content: flex-start; }
    .invoice-preview-stage { padding: 8px; }
    .sales-print-actions { width: 100%; }
}

@media print {
    body.sales-print-page > * { visibility: visible !important; }
    body.sales-print-page {
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        background: #fff !important;
    }
    .sales-print-toolbar,
    .sales-print-saved,
    .invoice-preview-toolbar,
    .preview-saved-file {
        display: none !important;
    }
    .invoice-preview-stage {
        display: block !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        background: #fff !important;
    }
    .sales-invoice-sheet {
        display: none !important;
        width: auto !important;
        min-height: 0 !important;
        margin: 0 auto !important;
        padding: 0 !important;
        box-shadow: none !important;
        break-after: avoid;
    }
    .invoice-preview-stage[data-active-paper="A5"] .sales-invoice-sheet[data-paper-size="A5"],
    .invoice-preview-stage[data-active-paper="A4"] .sales-invoice-sheet[data-paper-size="A4"] {
        display: block !important;
    }
    .print-preview-backdrop {
        position: static !important;
        inset: auto !important;
        display: block !important;
        padding: 0 !important;
        background: #fff !important;
    }
    .print-preview-dialog {
        width: auto !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
}


/* Permission feedback: locked menu items do not navigate; direct URLs get a friendly 403 page. */
.sidebar nav button.nav-denied {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    min-height: 42px;
    margin: 2px 0;
    padding: 11px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #c5c7e4;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.sidebar nav button.nav-denied:hover,
.sidebar nav button.nav-denied:focus-visible {
    background: rgba(255,255,255,.09);
    color: #fff;
    outline: none;
}
.sidebar nav button.nav-denied .nav-icon {
    display: inline-grid;
    place-items: center;
    width: 17px;
    flex: 0 0 17px;
    color: #c7c9ea;
    font-size: 15px;
}
.sidebar nav button.nav-denied .nav-lock {
    margin-left: auto;
    color: #9fa4c5;
    font-size: 11px;
}
.dashboard-denied-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: #5145e5;
    font: inherit;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
}
.dashboard-denied-link:hover { color: #372db4; }
.permission-toast[hidden] { display: none !important; }
.permission-toast {
    position: fixed;
    z-index: 99999;
    top: 86px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: min(560px, calc(100vw - 28px));
    padding: 13px 17px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 12px;
    background: #22204f;
    color: #fff;
    box-shadow: 0 12px 35px rgba(20,18,65,.24);
    font-size: 13px;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%,-8px);
    transition: opacity .18s ease, transform .18s ease;
}
.permission-toast::before {
    content: "🔒";
    flex: 0 0 auto;
    font-size: 16px;
}
.permission-toast.is-visible { opacity: 1; transform: translate(-50%,0); }
.access-denied-page {
    display: grid;
    min-height: 48vh;
    place-items: center;
    padding: 24px;
}
.access-denied-card {
    width: min(100%, 520px);
    padding: 32px;
    border: 1px solid #e2e7f0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 42px rgba(27,37,68,.09);
    text-align: center;
}
.access-denied-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 18px;
    background: #fff0ee;
    color: #c43d32;
    font-size: 26px;
}
.access-denied-code {
    color: #c43d32;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .12em;
}
.access-denied-card h2 { margin: 9px 0 8px; color: #1f2b43; font-size: 22px; }
.access-denied-card p { margin: 0; color: #66748b; font-size: 13px; line-height: 1.6; }
.access-denied-actions { display: flex; justify-content: center; gap: 9px; margin-top: 20px; }
@media(max-width:620px) {
    .sidebar nav button.nav-denied { justify-content: center; padding: 12px 5px; }
    .sidebar nav button.nav-denied span:not(.nav-icon):not(.nav-lock) { display: none !important; }
    .sidebar nav button.nav-denied .nav-lock { display: none; }
    .permission-toast { top: 76px; width: calc(100vw - 26px); }
    .access-denied-card { padding: 24px 18px; }
    .access-denied-card h2 { font-size: 19px; }
    .access-denied-actions { flex-direction: column; }
}


/* Match the supplied workbook's font sizes in A4 and A5 print forms. */
.invoice-sheet-a4 .invoice-brand,
.invoice-sheet-a4 .invoice-services { font-size: 11pt; }
.invoice-sheet-a4 .invoice-services>strong { font-size: 11pt; }
.invoice-sheet-a4 .invoice-document-date { font-size: 14pt; font-weight: 400; }
.invoice-sheet-a4 .invoice-customer-a4 { font-size: 12pt; }
.invoice-lines-a4 { font-size: 14pt; }
.invoice-lines-a4 th { font-size: 14pt; }
.invoice-amount-words { font-size: 14pt; }
.invoice-signatures-a4 { font-size: 14pt; }

.invoice-sheet-a5 .invoice-brand { font-size: 11pt; }
.invoice-sheet-a5 .invoice-services { font-size: 10pt; }
.invoice-sheet-a5 .invoice-services>strong { font-size: 10pt; }
.invoice-sheet-a5 .invoice-document-date { font-size: 11pt; font-weight: 700; }
.invoice-sheet-a5 .invoice-customer-a5 { font-size: 11pt; }
.invoice-lines-a5 { font-size: 11pt; }
.invoice-lines-a5 th { font-size: 10pt; }
.invoice-sheet-a5 .invoice-amount-words { font-size: 11pt; }
.invoice-signatures-a5 { font-size: 11pt; }

/* QR chuyển khoản lấy trực tiếp từ hai sheet A5/A4 trong file mẫu hóa đơn. */
.invoice-letterhead {
    grid-template-columns: minmax(0, 1.3fr) 29.2mm minmax(0, 1fr);
    gap: 2.5mm;
}
.invoice-sheet-a4 .invoice-letterhead {
    grid-template-columns: minmax(0, 1.38fr) 44.3mm minmax(0, 1fr);
    gap: 3mm;
    min-height: 42mm;
}
.invoice-sheet-a5 .invoice-letterhead {
    grid-template-columns: minmax(0, 1.3fr) 29.2mm minmax(0, 1fr);
    gap: 2.5mm;
    min-height: 31mm;
}
.invoice-qr-block {
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}
.invoice-qr-block img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: fill;
    image-rendering: auto;
}
.invoice-sheet-a5 .invoice-qr-block img {
    width: 29.2mm;
    height: 20.5mm;
}
.invoice-sheet-a4 .invoice-qr-block img {
    width: 44.3mm;
    height: 35.1mm;
}



/* Keep browser PDF output on the invoice itself (not the hidden sales form/layout). */
@media print {
    html,
    body {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    body > .app.invoice-preview-active {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        visibility: visible !important;
        background: #fff !important;
    }

    .app.invoice-preview-active,
    .app.invoice-preview-active * {
        visibility: visible !important;
    }

    .app.invoice-preview-active > .sidebar,
    .app.invoice-preview-active > .content > header,
    .app.invoice-preview-active > .content > main > :not(.print-preview-backdrop),
    #permissionToast {
        display: none !important;
    }

    .app.invoice-preview-active > .content {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .app.invoice-preview-active > .content > main {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .app.invoice-preview-active > .content > main > .print-preview-backdrop {
        position: static !important;
        inset: auto !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        backdrop-filter: none !important;
    }

    .app.invoice-preview-active .print-preview-dialog {
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    .app.invoice-preview-active .invoice-preview-toolbar,
    .app.invoice-preview-active .preview-saved-file,
    .sales-print-toolbar,
    .sales-print-saved {
        display: none !important;
    }

    .invoice-preview-stage {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    .sales-invoice-sheet {
        display: none !important;
        box-sizing: border-box !important;
        width: 210mm !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 auto !important;
        padding: 7mm !important;
        overflow: visible !important;
        box-shadow: none !important;
        break-inside: avoid-page !important;
        page-break-inside: avoid !important;
        break-after: avoid-page !important;
        page-break-after: avoid !important;
    }

    .sales-invoice-sheet[data-paper-size="A5"] {
        width: 148mm !important;
        padding: 4.5mm !important;
    }

    .invoice-preview-stage[data-active-paper="A5"] .sales-invoice-sheet[data-paper-size="A5"],
    .invoice-preview-stage[data-active-paper="A4"] .sales-invoice-sheet[data-paper-size="A4"] {
        display: block !important;
    }
}


/* Invoice bank details sit below the QR on both paper sizes. */
.invoice-qr-block {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: .35mm;
    overflow: visible;
}
.invoice-bank-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 7pt;
    line-height: 1.1;
    white-space: nowrap;
}
.invoice-bank-details b { font-weight: 700; }
.invoice-sheet-a5 .invoice-bank-details { font-size: 6pt; }

/* The selected invoice is kept as one print page; JS scales only when needed. */
@media print {
    .sales-invoice-sheet {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        break-after: avoid-page !important;
        page-break-after: avoid !important;
    }
}
