@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Myanmar:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light;
    --ink: #17243b;
    --muted: #758198;
    --line: #e8edf4;
    --paper: #ffffff;
    --canvas: #f4f7fb;
    --blue: #3978e8;
    --shadow: 0 12px 34px rgba(29, 48, 78, .07);
    font-family: Inter, "Noto Sans Myanmar", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; line-height: 1.65; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.app-shell { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 34px; }
.topbar { min-height: 58px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand img { width: 45px; height: 45px; object-fit: contain; border-radius: 13px; background: #fff; }
.brand span { display: grid; line-height: 1.25; }
.brand strong { font-size: 17px; letter-spacing: .06em; }
.brand small { font-size: 10px; letter-spacing: .13em; color: var(--muted); }
.topbar-note { color: #63718a; font-size: 13px; }
.topbar-note i { color: #25a875; margin-right: 6px; }
.welcome-panel { display: flex; justify-content: space-between; align-items: center; min-height: 180px; padding: 32px 38px; border-radius: 23px; color: #fff; background: linear-gradient(120deg, #1d3f7b, #367de5 72%, #66a6f7); box-shadow: 0 18px 38px rgba(39, 98, 185, .18); overflow: hidden; }
.welcome-panel .eyebrow { color: #cfe1ff; }
.welcome-panel h1 { margin: 4px 0 8px; font-size: clamp(27px, 4vw, 38px); line-height: 1.35; }
.welcome-panel .muted { color: #dfebff; margin: 0; }
.welcome-icon { width: 112px; height: 112px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.23); border-radius: 28px; background: rgba(255,255,255,.13); transform: rotate(5deg); }
.welcome-icon i { font-size: 46px; }
.section-block { margin-top: 34px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 16px; }
.section-heading h2, .section-heading h3 { margin: 0; line-height: 1.4; }
.section-heading h2 { font-size: 21px; }
.section-heading h3 { font-size: 17px; }
.heading-tools { display: flex; align-items: center; gap: 10px; }
.eyebrow { margin: 0 0 4px; color: #8290a7; font-weight: 700; font-size: 10px; letter-spacing: .16em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card, .chart-card, .action-card, .panel, .stock-card { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); }
.stat-card { display: flex; align-items: center; gap: 13px; min-height: 100px; padding: 17px; }
.stat-card > div { min-width: 0; display: grid; }
.stat-card span:not(.stat-icon) { font-size: 12px; color: var(--muted); }
.stat-card strong { margin-top: 4px; font-size: clamp(17px, 2vw, 22px); white-space: nowrap; }
.stat-icon, .action-icon { display: grid; flex: 0 0 auto; place-items: center; border-radius: 14px; }
.stat-icon { width: 47px; height: 47px; font-size: 18px; }
.blue { color: #3978e8; background: #eaf1ff; }
.green { color: #1e9b70; background: #e5f7ef; }
.orange { color: #dc8a22; background: #fff3df; }
.purple { color: #8059d4; background: #f0eaff; }
.rose { color: #d95869; background: #ffeaed; }
.chart-card { padding: 20px 23px; margin-top: 15px; }
.mini-chart { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 10px; align-items: end; min-height: 142px; padding-top: 14px; }
.chart-day { display: grid; grid-template-rows: 1fr auto auto; align-items: end; height: 120px; text-align: center; color: var(--muted); font-size: 11px; }
.chart-value { margin-bottom: 5px; color: var(--ink); font-weight: 700; }
.chart-bar-wrap { height: 78px; display: flex; align-items: end; justify-content: center; }
.chart-bar { width: min(32px, 72%); min-height: 4px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #72a8ff, #3d79e8); }
.action-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.action-card { position: relative; min-height: 158px; padding: 20px 17px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.action-card:hover, .action-card:focus-visible { transform: translateY(-3px); border-color: #c9d8f3; box-shadow: 0 16px 34px rgba(29, 48, 78, .12); outline: none; }
.action-icon { width: 45px; height: 45px; font-size: 18px; }
.action-card > span:nth-child(2) { display: grid; gap: 2px; }
.action-card strong { font-size: 14px; }
.action-card small { color: var(--muted); font-size: 11px; }
.action-arrow { position: absolute; right: 16px; bottom: 16px; color: #a8b2c1; font-size: 12px; }
.app-footer { padding-top: 30px; text-align: center; color: #a1aabd; font-size: 11px; }

.page-shell { width: min(1050px, calc(100% - 36px)); margin: 0 auto; padding: 22px 0 46px; }
.page-top { display: flex; align-items: center; gap: 13px; margin: 0 0 24px; }
.back-button { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: #5d6b83; }
.page-title { margin: 0; font-size: 23px; line-height: 1.4; }
.page-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel { padding: 22px; margin-bottom: 18px; }
.panel h2, .panel h3 { margin: 0 0 15px; font-size: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.field { display: grid; gap: 6px; color: #5e6c83; font-size: 12px; font-weight: 600; }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .search-input { width: 100%; min-height: 45px; border: 1px solid #dce3ed; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: #fff; outline: none; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: #80aaf2; box-shadow: 0 0 0 3px rgba(57,120,232,.12); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.primary-button, .secondary-button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 17px; font-weight: 700; }
.primary-button { color: #fff; background: var(--blue); box-shadow: 0 7px 15px rgba(57,120,232,.17); }
.secondary-button { color: #43536c; background: #eef2f8; }
.status-message { min-height: 24px; margin: 12px 0 0; color: #64728a; font-size: 13px; }
.status-message.error { color: #c13d4d; }
.status-message.success { color: #18825e; }
.error { color: #c13d4d; }
.toolbar { display: grid; grid-template-columns: minmax(210px,1fr) repeat(3,minmax(145px,auto)); gap: 10px; margin-bottom: 15px; }
.history-modes { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin-bottom: 18px; }
.history-mode { min-height: 46px; display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; color: #5f6d84; background: #fff; font-size: 12px; font-weight: 700; }
.history-mode.is-active { border-color: #3978e8; color: #2f6ed8; background: #edf4ff; box-shadow: 0 0 0 2px rgba(57,120,232,.08); }
.history-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.history-tools[hidden] { display: none; }
.history-refresh-row { display: flex; justify-content: flex-end; align-items: center; gap: 9px; min-height: 34px; margin: 0 0 9px; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid #dce3ed; border-radius: 11px; color: #3978e8; background: #fff; }
.icon-button:hover { border-color: #9bbbf2; background: #f4f8ff; }
.icon-button:disabled { cursor: wait; opacity: .6; }
.order-list { display: grid; gap: 12px; }
.order-card { padding: 17px 19px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.order-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.order-card h3 { margin: 0; font-size: 15px; }
.order-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.order-meta { display: flex; flex-wrap: wrap; gap: 9px 20px; margin-top: 12px; color: #596780; font-size: 12px; }
.badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 20px; padding: 4px 9px; background: #edf2fa; color: #63718a; font-size: 11px; }
.badge.good { background: #e5f7ef; color: #18825e; }
.badge.warning { background: #fff3df; color: #b06b14; }
.empty-state { padding: 32px 15px; border: 1px dashed #ced7e4; border-radius: 13px; text-align: center; color: var(--muted); }
.search-row { display: flex; gap: 10px; }
.search-row .search-input { flex: 1; }
.search-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.edit-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.edit-field { display: grid; gap: 5px; font-size: 11px; color: var(--muted); }
.edit-field input, .edit-field select { min-height: 41px; width: 100%; border: 1px solid #dce3ed; border-radius: 9px; padding: 8px 10px; color: var(--ink); background: #fff; }
.result-list { display: grid; gap: 9px; margin-top: 13px; }
.result-choice { padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; }
.result-choice:hover { border-color: #9bbbf2; }
.receipt { max-width: 740px; margin: 18px auto; border: 1px solid #dce3ed; border-radius: 16px; padding: 30px; background: #fff; box-shadow: var(--shadow); }
.receipt-head { display: grid; grid-template-columns: minmax(0, 1fr) 78px; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px dashed #ccd5e2; }
.receipt-heading { text-align: center; }
.receipt-logo { display: block; width: 78px; height: 78px; object-fit: contain; }
.receipt-head h2 { margin: 8px 0 0; font-size: 21px; }
.receipt-head strong { display: block; margin-top: 8px; color: #3978e8; }
.receipt-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 20px; padding: 12px 0; }
.receipt-line { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid #f0f2f6; font-size: 12px; }
.receipt-line span { color: var(--muted); }
.receipt-line strong { text-align: right; overflow-wrap: anywhere; }
.receipt-total { display: flex; justify-content: space-between; margin-top: 15px; padding-top: 15px; border-top: 1px dashed #ccd5e2; font-size: 17px; font-weight: 800; }
.stock-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.stock-card { padding: 18px; }
.stock-card h3 { margin: 0 0 14px; font-size: 15px; }
.stock-numbers { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.stock-number { display: grid; gap: 3px; }
.stock-number span { color: var(--muted); font-size: 10px; }
.stock-number strong { font-size: 16px; }
.stock-entries { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); color: #67748a; font-size: 11px; }
.stock-entries p { display: flex; justify-content: space-between; gap: 10px; margin: 5px 0; }

@media (max-width: 850px) {
    .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .toolbar { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
    .app-shell { width: min(100% - 28px, 430px); padding-top: 15px; }
    .topbar { margin-bottom: 17px; }
    .topbar-note { font-size: 11px; }
    .welcome-panel { min-height: 160px; padding: 24px 20px; border-radius: 18px; }
    .welcome-panel .muted { font-size: 12px; max-width: 265px; }
    .welcome-icon { width: 58px; height: 58px; border-radius: 17px; }
    .welcome-icon i { font-size: 24px; }
    .section-block { margin-top: 27px; }
    .section-heading h2 { font-size: 18px; }
    .heading-tools { gap: 6px; }
    .stats-grid { gap: 9px; }
    .stat-card { min-height: 83px; gap: 9px; padding: 11px; border-radius: 13px; }
    .stat-icon { width: 37px; height: 37px; border-radius: 11px; font-size: 15px; }
    .stat-card span:not(.stat-icon) { font-size: 10px; }
    .stat-card strong { font-size: 15px; }
    .chart-card { padding: 16px 12px; }
    .mini-chart { gap: 3px; }
    .action-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
    .action-card { min-height: 143px; padding: 14px 10px; border-radius: 13px; }
    .action-icon { width: 39px; height: 39px; border-radius: 12px; font-size: 16px; }
    .action-card strong { font-size: 11px; line-height: 1.55; }
    .action-card small { font-size: 9px; }
    .page-shell { width: calc(100% - 26px); padding-top: 13px; }
    .page-title { font-size: 19px; }
    .page-subtitle { font-size: 11px; }
    .panel { padding: 16px; border-radius: 14px; }
    .form-grid, .edit-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .toolbar { grid-template-columns: 1fr 1fr; }
    .toolbar .field:first-child { grid-column: 1 / -1; }
    .history-modes { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .history-mode { font-size: 11px; }
    .history-tools { grid-template-columns: 1fr; }
    .order-card { padding: 14px; }
    .order-card-top { flex-direction: column; }
    .stock-grid { grid-template-columns: 1fr; }
    .receipt { padding: 20px 16px; }
    .receipt-head { grid-template-columns: minmax(0, 1fr) 58px; gap: 8px; }
    .receipt-logo { width: 58px; height: 58px; }
    .receipt-grid { grid-template-columns: 1fr; }
}
@media print {
    body { background: #fff; }
    body * { visibility: hidden !important; }
    #receipt, #receipt *, #created-receipt, #created-receipt * { visibility: visible !important; }
    #receipt, #created-receipt { position: absolute; inset: 0; max-width: none; margin: 0; border: 0; box-shadow: none; }
    .no-print { display: none !important; }
}