/* POS visual layer. Transaction data remains in MySQL. */
:root {
  color-scheme: light;
  --bg: #f4f7f5; --surface: #ffffff; --text: #1a302c; --muted: #5d736d;
  --line: #dce8e1; --green: #166d55; --orange: #9c5819; --red: #a33d35;
  --nav: #ffffff; --primary: #14775f; --field: #ffffff; --hero: #e2f2e9;
  --hover: #eef6f1; --soft-text: #225143; --rowline: #e8efeb;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131f1c; --surface: #1c2c27; --text: #eef7f1; --muted: #c0d2c8;
  --line: #3b5147; --green: #8cdbb7; --orange: #f0bb86; --red: #f2a9a1;
  --nav: #192a24; --primary: #176f58; --field: #16241e; --hero: #254c3d;
  --hover: #2a4036; --soft-text: #d1ede0; --rowline: #3b5147;
}
body { font-size: 15px; line-height: 1.55; }
.shell { grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--nav); color: var(--text); border-right: 1px solid var(--line); padding: 28px 16px 20px; gap: 26px; }
.brand { padding: 0 10px; gap: 12px; font-size: 19px; }
.brand strong { color: var(--text); }
.brandmark { background: #187b60; color: #fff; border-radius: 12px; width: 42px; height: 42px; box-shadow: 0 4px 10px #13775d24; }
.brand small { color: var(--muted); letter-spacing: .09em; font-size: 10px; margin-top: 1px; }
.nav { gap: 2px; }
.nav-section { color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.nav button { color: var(--text); min-height: 43px; border-radius: 9px; font-size: 14px; font-weight: 550; }
.nav button:hover { background: var(--hover); color: var(--text); }
.nav button.active { background: var(--hero); color: var(--soft-text); box-shadow: none; font-weight: 750; }
.ni { color: var(--muted); } .nav button.active .ni { color: var(--primary); }
.sidefoot { border-color: var(--line); color: var(--muted); padding: 15px 10px 0; font-size: 12px; line-height: 1.5; }
.connection-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #38a476; margin-right: 7px; }
.theme-switch { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; padding: 9px 0 0; min-height: 38px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 600; text-align: left; }
.theme-switch:hover { color: var(--text); } .theme-switch span { font-size: 17px; }
.main { max-width: 1500px; padding: 28px 42px 64px; }
.topline { color: var(--muted); font-size: 11px; letter-spacing: .1em; margin-bottom: 24px; }
.topline b { color: #9aafa5; }
.top { margin-bottom: 24px; }
.top h1 { font-size: 31px; color: var(--text); letter-spacing: -.035em; }
.sub { margin-top: 7px; color: var(--muted); font-size: 15px; }
.eyebrow, .overline { color: #367963; font-size: 11px; letter-spacing: .11em; }
button, .btn { border-color: #cddfd5; border-radius: 9px; min-height: 44px; padding: 10px 16px; }
.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.primary:hover { background: #0e654f; border-color: #0e654f; }
.ghost:hover, .attention-row:hover { background: var(--hover); }
.small { min-height: 40px; font-size: 13px; }
.welcome { background: var(--hero); color: var(--soft-text); border: 1px solid var(--line); border-radius: 14px; padding: 28px 30px; gap: 30px; }
.welcome-copy { min-width: 0; }
.welcome-label { color: #347762; font-size: 11px; letter-spacing: .12em; }
.welcome h2 { color: var(--soft-text); font-size: 26px; line-height: 1.25; }
.welcome p:not(.welcome-label) { color: var(--muted); margin-top: 9px; }
.welcome-actions { margin-top: 20px; gap: 12px; }
.welcome-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.welcome-primary:hover { background: #0e654f; }
.welcome-primary span { margin-left: 12px; }
.welcome-link { background: transparent; border-color: transparent; color: var(--soft-text); padding: 9px 10px; }
.welcome-link:hover { background: var(--hover); }
.welcome-aside { border-color: #a8cdb8; padding-left: 26px; width: 196px; }
.welcome-badge { color: #397b65; } .welcome-aside strong { color: var(--soft-text); } .welcome-aside small { color: var(--muted); }
.section-heading { margin: 28px 0 14px; } .section-heading h2 { font-size: 19px; }
.grid { gap: 14px; }
.card, .panel { border-color: var(--line); border-radius: 12px; box-shadow: 0 2px 8px #183e2a08; }
.card { padding: 20px; }
.card .label { font-size: 13px; color: var(--muted); }
.card .value { font-size: 24px; line-height: 1.3; color: var(--text); }
.card .hint { font-size: 12px; color: var(--muted); }
.metric-icon { margin-bottom: 16px; }
.panel { padding: 22px; }
.panelhead h2, .sectiontitle { font-size: 18px; }
.panelhead p:not(.overline) { font-size: 13px; }
.tablewrap { border-radius: 6px; }
th, td, .listrow, .attention-row, .reportrow { border-color: var(--rowline); }
th { font-size: 12px; color: var(--muted); } td { font-size: 14px; }
.tiny { font-size: 13px; }
.empty { background: var(--hover); border: 1px dashed var(--line); border-radius: 10px; padding: 32px 16px; }
.empty strong { font-size: 15px; }
.attention-row { border-radius: 0; }
.reportrow.total { color: var(--green); }
.notice { background: #fff8ea; color: #735323; border-color: #ddad61; font-size: 14px; border-radius: 7px; }
.toolbar input { max-width: 350px; }
input, select, textarea { min-height: 47px; background: var(--field); color: var(--text); border: 1px solid #cbded2; border-radius: 9px; padding: 11px 12px; }
input::placeholder, textarea::placeholder { color: #72877c; opacity: 1; }
input[readonly] { background: var(--hover); }
.field { gap: 7px; } .field label { font-size: 14px; font-weight: 700; }
.formgrid { gap: 18px; }
.modalback { background: #10251fb0; padding: 20px; }
.modal { background: var(--surface); width: min(690px, 100%); border-radius: 14px; box-shadow: 0 24px 60px #0c201b45; }
.modalhead { background: var(--surface); border-color: var(--line); padding: 21px 26px; }
.modalhead h2 { font-size: 21px; letter-spacing: -.02em; }
.modalbody { padding: 24px 26px; }
.modalfoot { margin-top: 24px; gap: 10px; }
.close { color: var(--muted); border-radius: 8px; } .close:hover { background: var(--hover); color: var(--text); }
.line-item { background: var(--bg); border-color: var(--line); }
.err { color: #93382f; background: #fff0ee; border: 1px solid #f0c7c2; padding: 12px; border-radius: 8px; line-height: 1.5; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; background: #155b47; color: #fff; border-radius: 10px; padding: 13px 18px; box-shadow: 0 8px 24px #10282036; max-width: calc(100vw - 32px); }
.connection-error { max-width: 650px; } .connection-error h2 { margin: 0 0 8px; }
.connection-error p { color: var(--muted); }
html[data-theme="dark"] .eyebrow, html[data-theme="dark"] .overline,
html[data-theme="dark"] .welcome-label, html[data-theme="dark"] .welcome-badge { color: #a9d9c2; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { border-color: #617c6e; }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #a6bdb0; }
html[data-theme="dark"] .notice { background: #3a3425; color: #f3dcb5; border-color: #bd8b44; }
html[data-theme="dark"] .err { background: #492c2a; border-color: #945e59; color: #ffe0dc; }
html[data-theme="dark"] .nav button.active .ni { color: #a9d9c2; }
html[data-theme="dark"] .blue { background: #e4effd; color: #3157a3; }
html[data-theme="dark"] .tag.neutral { background: #dce8df; color: #3d5b4b; }
html[data-theme="dark"] .welcome-aside { border-color: #628a77; }
html[data-theme="dark"] .menu-backdrop { background: #000b; }
@media (max-width: 1050px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: fixed; width: min(290px, 86vw); height: 100dvh; border-right: 0; }
  .sidebar-close { color: var(--text); }
  .main { padding: 20px 18px 46px; }
  .mobile-bar { margin: -20px -18px 22px; padding: 12px 18px; background: var(--surface); }
  .mobile-bar span { font-size: 10px; letter-spacing: .06em; }
  .top { gap: 15px; margin-bottom: 22px; }
  .top h1 { font-size: 27px; } .sub { font-size: 15px; }
  .topactions, .topactions .primary { width: 100%; }
  .welcome { padding: 23px; gap: 20px; }
  .welcome h2 { font-size: 23px; }
  .welcome-aside { border-top: 1px solid #a8cdb8; padding: 16px 0 0; width: auto; }
  .welcome-actions { align-items: stretch; flex-direction: column; gap: 6px; }
  .welcome-actions button { text-align: left; }
  .card { padding: 16px; } .card .value { font-size: 20px; }
  .panel { padding: 18px; } .section-heading .tiny { display: none; }
  .modalback { padding: 12px; } .modal { max-height: 92dvh; }
  .modalhead { padding: 16px 18px; } .modalbody { padding: 19px 18px; }
  .formgrid { grid-template-columns: 1fr; } .full { grid-column: auto; }
  .table-hint { font-size: 12px; }
  .toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}
@media (max-width: 390px) { .grid { gap: 10px; } .card .value { font-size: 19px; } .toolbar select { width: 100%; } }

/* Tabel menjadi kartu berlabel pada layar kecil. */
@media (max-width: 760px) {
  .table-hint { display: none; }
  .tablewrap { overflow: visible; }
  .tablewrap table, .tablewrap tbody { display: block; width: 100%; min-width: 0; }
  .tablewrap thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .tablewrap tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 5px 12px; }
  .tablewrap td, .tablewrap td.num { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rowline); text-align: right; min-width: 0; }
  .tablewrap td:last-child { border-bottom: 0; }
  .tablewrap td::before { content: attr(data-label); font-size: 12px; color: var(--muted); font-weight: 650; text-align: left; flex: 0 0 38%; }
  .tablewrap td .cell-value { min-width: 0; overflow-wrap: anywhere; text-align: right; }
  .tablewrap td[data-label=""] { justify-content: flex-start; }
  .tablewrap td[data-label=""]::before { display: none; }
  .tablewrap td[data-label=""] .cell-value { display: flex; flex-wrap: wrap; gap: 6px; text-align: left; }
}

/* Form transaksi lebih lega di desktop dan ponsel. */
.modal { width: min(820px, 100%); }
.modal input, .modal select, .modal textarea { min-height: 52px; font-size: 16px; }
.line-item { padding: 18px; }
.linegrid { grid-template-columns: minmax(0, 2fr) minmax(100px, 1fr) minmax(150px, 1fr) auto; gap: 14px; }
.invoice-line .linegrid { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.invoice-line .productfield { grid-column: 1 / -1; }
@media (max-width:760px) {
  .modal { width: 100%; }
  .linegrid, .invoice-line .linegrid { grid-template-columns: 1fr 1fr; }
  .linegrid .productfield, .invoice-line .productfield { grid-column: 1 / -1; }
  .invoice-line .linegrid .field:nth-child(4) { grid-column: 1 / -1; }
  .tablewrap td .cell-value { max-width: 62%; }
  .tablewrap td.row-actions, .tablewrap td:last-child { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .tablewrap td.row-actions .cell-value, .tablewrap td:last-child .cell-value { max-width: 100%; width: 100%; justify-content: flex-start; }
  .tablewrap td button { min-height: 38px; padding: 8px 10px; }
}

.account-box { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 14px; color:var(--text); font-size:13px; overflow-wrap:anywhere; }
.account-box[hidden] { display:none; }
.logout-button { min-height:40px; padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text); font-weight:700; cursor:pointer; }
.logout-button:hover { background:var(--hover); }
