/* ============ Hanabi Ordering System ============ */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
:root {
  --bg: #0e1523;
  --panel: #161d2b;
  --panel2: #1c2434;
  --btn: #232d40;
  --btn-hi: #2e3a52;
  --line: #33405a;
  --text: #e8ecf4;
  --dim: #9aa7bd;
  --accent: #d8893b;
  --occupied: #a94444;
  --vacant: #c99f9f;
  --repair: #6b7280;
  --danger: #8c2f2f;
  --ok: #2f5d38;
}
html, body { height: 100%; }
body {
  background: linear-gradient(135deg, #0a1020 0%, #10203a 60%, #0a1626 100%);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  overflow: hidden;
}
.screen { display: none; height: 100vh; flex-direction: column; }
.screen.active { display: flex; }
.hidden { display: none !important; }
.r { text-align: right; }
.accent { color: var(--accent); }

button { font-family: inherit; color: var(--text); background: var(--btn); border: none; cursor: pointer; }
button:active { transform: translateY(1px); }

.flat-btn {
  background: var(--btn); border: 1px solid var(--line); border-radius: 4px;
  padding: 10px 12px; font-size: 13px;
}
.flat-btn:hover { background: var(--btn-hi); }
.flat-btn.sm { padding: 7px 8px; font-size: 12px; }
.flat-btn.toggle.on { background: var(--accent); color: #14100a; font-weight: 600; }
.accent-btn { background: var(--accent); color: #14100a; font-weight: 700; }
.accent-btn:hover { background: #e59a4e; }

.picker-btn {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 10px; text-align: left; font-size: 13px; min-height: 36px;
}
.picker-btn.sm { padding: 7px 8px; min-height: 32px; font-size: 12px; }

.big-btn {
  background: var(--btn); border: 1px solid var(--line); border-radius: 4px;
  padding: 14px; font-size: 15px;
}
.big-btn:hover { background: var(--btn-hi); }

.hdr-box {
  background: var(--btn); border-radius: 4px; padding: 10px 18px; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* ============ LOGIN ============ */
#screen-login { align-items: center; justify-content: center; }
.login-box {
  width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 28px 34px 40px; box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.login-box h1 { font-size: 20px; font-weight: 500; margin-bottom: 26px; }
.login-form { display: grid; grid-template-columns: 90px 1fr; gap: 14px 12px; align-items: center; }
.login-form label { text-align: right; font-size: 13px; color: var(--dim); }
.login-form input {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 9px 10px; font-size: 14px; width: 100%;
}
.login-hint { font-size: 12px; color: var(--dim); }
.pw-wrap { position: relative; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 36px !important; }
.pw-wrap .eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: transparent; font-size: 15px; padding: 4px 6px; opacity: .7;
}
.pw-wrap .eye:hover { opacity: 1; }
.login-hint a { color: var(--text); }

/* ============ DASHBOARD ============ */
.dash-header {
  display: flex; gap: 10px; align-items: stretch; padding: 10px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.dash-title { font-size: 17px; letter-spacing: 2px; background: var(--btn); border-radius: 4px; padding: 10px 40px; display: flex; align-items: center; }
.dash-tabs { margin-left: auto; display: flex; gap: 6px; }
.tab-btn { background: var(--btn); border: 1px solid var(--line); border-radius: 4px; padding: 10px 16px; font-size: 13px; }
.tab-btn.active { background: #fff; color: #111; font-weight: 600; }
.dash-body { flex: 1; display: flex; gap: 12px; padding: 12px 14px; overflow: hidden; }
.dash-left { flex: 1.6; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.room-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  overflow-y: auto; align-content: start; flex: 1;
}
.room-tile {
  border-radius: 4px; min-height: 92px; padding: 8px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; gap: 3px; cursor: pointer;
  color: #fff;
}
.room-tile .no { font-size: 11px; opacity: .85; }
.room-tile .nm { font-size: 14px; font-weight: 600; }
.room-tile .st { font-size: 10px; text-transform: uppercase; opacity: .9; }
.room-tile.vacant { background: var(--vacant); color: #3a2626; }
.room-tile.occupied { background: var(--occupied); }
.room-tile.billed { background: #7c5f2e; }
.room-tile.repair { background: var(--repair); cursor: not-allowed; opacity: .8; }
.room-tile.billreq { box-shadow: 0 0 0 3px #f5c542 inset; animation: billreq-blink 1.2s infinite; }
.room-tile .st.req { color: #ffe27a; font-weight: 700; }
@keyframes billreq-blink { 50% { box-shadow: 0 0 0 3px transparent inset; } }
.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; height: 190px; }
.chart-title { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.chart .bar { flex: 1; background: #b04a4a; border-radius: 2px 2px 0 0; position: relative; min-width: 6px; }
.chart .bar span {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 8px; color: var(--dim); white-space: nowrap;
}
.dash-right { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow-y: auto; }
.sales-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sales-table th { text-align: left; color: var(--dim); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.sales-table th.r, .sales-table td.r { text-align: right; }
.sales-table td { padding: 7px 8px; border-bottom: 1px solid #202a3d; cursor: pointer; }
.sales-table tr:hover td { background: var(--panel2); }

/* ============ POS ============ */
.pos-header {
  display: flex; gap: 10px; align-items: stretch; padding: 8px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.pos-title { font-size: 16px; background: var(--btn); border-radius: 4px; padding: 8px 60px; display: flex; align-items: center; }
.pos-balance { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.balance-box { background: #fff; color: #111; border-radius: 3px; padding: 8px 16px; font-size: 16px; font-weight: 600; min-width: 140px; text-align: right; }
.pos-back { background: transparent; font-size: 18px; padding: 0 10px; }
.pos-body { flex: 1; display: grid; grid-template-columns: 1.25fr 0.95fr 1fr; gap: 10px; padding: 10px 14px; overflow: hidden; }
.pos-left, .pos-middle, .pos-right { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }

.pos-selects { display: grid; grid-template-columns: 58px 1fr 44px 1fr 1fr; gap: 6px; align-items: center; }
.pos-selects label { font-size: 12px; color: var(--dim); }
.pos-selects label.c { text-align: center; }
.pos-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pos-actions .flat-btn { padding: 10px 4px; font-size: 11.5px; }

.order-title { font-size: 12px; color: var(--dim); }
.order-wrap { flex: 1; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.order-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.order-table th { position: sticky; top: 0; background: var(--panel2); color: var(--dim); font-weight: 500; padding: 6px; z-index: 1; }
.order-table td { padding: 6px; border-bottom: 1px solid #202a3d; background: #f4f4f6; color: #16181d; }
.order-table tr:nth-child(even) td { background: #e2e3e8; }
.order-table .qbtn { background: #d3d5db; color: #111; border-radius: 3px; width: 22px; height: 22px; font-size: 12px; }
.order-table .delbtn { background: var(--danger); color: #fff; border-radius: 3px; width: 22px; height: 22px; font-size: 11px; }
.order-table .tval { background: #c8e0c9; color: #14401c; border-radius: 3px; padding: 2px 6px; font-size: 11.5px; }

.sec-title { font-size: 12px; color: var(--dim); }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 132px; overflow-y: auto; }
.cat-grid button { background: var(--btn); border: 1px solid var(--line); border-radius: 4px; padding: 10px 4px; font-size: 12.5px; }
.cat-grid button.active { background: var(--panel2); border-color: var(--accent); color: var(--accent); }
.item-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow-y: auto; align-content: start; }
.item-grid button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 4px;
  min-height: 72px; padding: 6px; font-size: 12.5px; line-height: 1.3;
}
.item-grid button:hover { background: var(--btn-hi); }
.item-grid .price { display: block; margin-top: 4px; font-size: 11px; color: var(--dim); }

.totals { display: grid; grid-template-columns: 82px 1fr; gap: 6px; align-items: center; }
.totals label { font-size: 12.5px; color: var(--dim); text-align: right; }
.tot-box { background: var(--panel2); border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px; text-align: right; font-size: 14px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pay-methods .pay-m { min-height: 52px; font-size: 12px; }
.pay-methods .pay-m.active { background: var(--accent); color: #14100a; font-weight: 600; }

.pay-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 8px; margin-top: 6px; }
.pay-inputs label { font-size: 12px; color: var(--dim); display: block; margin: 4px 0; }
.pay-box { background: #fff; color: #111; border-radius: 3px; padding: 8px 10px; text-align: right; font-size: 15px; font-weight: 600; }
.numpad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.numpad button { background: var(--btn); border: 1px solid var(--line); border-radius: 4px; font-size: 15px; min-height: 38px; }
.numpad .np-c { grid-row: span 2; }
.numpad .np-00 { grid-row: span 3; }
.numpad .np-0 { grid-column: span 2; }

.pay-list { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.pay-row { display: flex; align-items: center; gap: 8px; font-size: 12px; background: var(--panel2); border-radius: 3px; padding: 4px 8px; }
.pay-row .amt { margin-left: auto; }
.pay-row .delbtn { background: var(--danger); color: #fff; border-radius: 3px; width: 18px; height: 18px; font-size: 10px; }
.pay-row.total { background: transparent; font-weight: 600; color: var(--accent); padding: 1px 8px; }
.pay-row.staged { border: 1px dashed var(--accent); background: transparent; }

/* Settle Day dialog */
.settle-box { min-width: 480px; max-width: 560px; display: flex; flex-direction: column; gap: 6px; }
.settle-sum { display: flex; flex-direction: column; gap: 3px; }
.settle-h { font-size: 12px; color: var(--accent); margin-top: 10px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.settle-add { display: grid; grid-template-columns: 60px 110px 1fr 90px 70px; gap: 5px; margin-top: 6px; }
.settle-add select, .settle-add input {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 3px; padding: 6px; font-size: 12px; width: 100%;
}
.denom-grid { display: grid; grid-template-columns: 80px 90px 1fr 80px 90px 1fr; gap: 5px 8px; align-items: center; }
.denom-grid label { font-size: 12px; color: var(--dim); text-align: right; }
.denom-grid input {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 3px; padding: 6px; font-size: 13px; width: 100%;
}
.denom-grid .amt { font-size: 12px; text-align: right; }

.bill-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bill-btns .flat-btn { min-height: 54px; font-size: 12px; padding: 6px 4px; }

/* ============ ADMIN ============ */
.admin-header {
  display: flex; gap: 8px; padding: 10px 14px; background: var(--panel);
  border-bottom: 1px solid var(--line); justify-content: center; align-items: center;
}
.admin-nav { background: var(--btn); border: 1px solid var(--line); border-radius: 4px; padding: 12px 22px; font-size: 14px; }
.admin-nav.active { background: #fff; color: #111; font-weight: 600; }
.admin-header .pos-back { margin-left: auto; }
.admin-subnav { display: flex; gap: 4px; padding: 8px 14px 0; flex-wrap: wrap; }
.admin-subnav button { background: transparent; border: none; border-bottom: 2px solid transparent; padding: 8px 14px; font-size: 13px; color: var(--dim); }
.admin-subnav button.active { color: var(--text); border-bottom-color: #fff; }
.admin-body { flex: 1; display: flex; gap: 12px; padding: 12px 14px; overflow: hidden; }
.crud-table-wrap { flex: 1.4; overflow: auto; background: #fff; border-radius: 4px; }
.crud-table { width: 100%; border-collapse: collapse; font-size: 13px; color: #16181d; }
.crud-table th { position: sticky; top: 0; background: var(--panel2); color: var(--text); font-weight: 500; padding: 8px; text-align: left; z-index: 1; }
.crud-table td { padding: 8px; border-bottom: 1px solid #d8dae0; cursor: pointer; }
.crud-table tr.sel td { background: #b9bdc7; }
.crud-form { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; }
.crud-form h2 { font-size: 15px; font-weight: 600; background: #fff; color: #111; border-radius: 3px; text-align: center; padding: 9px; margin-bottom: 14px; }
.crud-fields { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; }
.crud-fields label { font-size: 12.5px; color: var(--dim); }
.crud-fields input, .crud-fields select {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 3px; padding: 8px; font-size: 13px; width: 100%;
}
.crud-fields input[type=checkbox] { width: 18px; height: 18px; }
.crud-fields textarea {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 3px; padding: 8px; font-size: 12px; width: 100%;
  font-family: Consolas, monospace; resize: vertical;
}
.rcpt-preview { background: #fff; color: #000; padding: 12px; border-radius: 4px; max-height: 64vh; overflow-y: auto; }
.rcpt-preview .receipt { margin: 0 auto; line-height: 1.35; }
.rcpt-preview .c { text-align: center; }
.rcpt-preview .al-l { text-align: left; }
.rcpt-preview .al-r { text-align: right; }
.rcpt-preview .row { display: flex; justify-content: space-between; gap: 8px; }
.rcpt-preview hr { border: none; border-top: 1px dashed #000; margin: 4px 0; }
.rcpt-preview .big { font-weight: 700; font-size: 1.15em; }
.crud-btns { display: flex; gap: 10px; margin-top: auto; padding-top: 16px; justify-content: flex-end; }
.crud-btns .add { background: var(--ok); }
.crud-btns .del { background: var(--danger); }
.crud-btns .save { background: var(--accent); color: #14100a; font-weight: 600; }
.crud-btns button { border-radius: 3px; padding: 10px 26px; font-size: 13px; }
.admin-note { margin: auto; text-align: center; color: var(--dim); font-size: 15px; line-height: 2; }

/* Daily Cash Report (copied from owner's Excel sheet) */
.dcr { font-family: Calibri, "Segoe UI", Arial, sans-serif; font-size: 13px; color: #000; max-width: 900px; }
.dcr-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 10px; }
.dcr-date { border: 1px solid #999; border-top: none; border-left: none; padding: 2px 10px; min-width: 110px; }
.dcr-co { color: #2e74b5; font-weight: 700; letter-spacing: 1px; }
.dcr-tc { margin-left: auto; text-align: right; }
.dcr-cols { display: flex; gap: 30px; }
.dcr-left { flex: 1.4; border-right: 1px dashed #999; padding-right: 22px; }
.dcr-right { flex: 1; }
.dcr-r, .dcr-r3 { display: flex; gap: 8px; padding: 1px 0; }
.dcr-r .n { margin-left: auto; text-align: right; min-width: 110px; }
.dcr-r3 span:first-child { min-width: 110px; }
.dcr-r3 .n { margin-left: auto; text-align: right; min-width: 100px; white-space: nowrap; }
.dcr-sub .n { border-top: 1px solid #000; padding-top: 2px; }
.dcr-final .n { border-bottom: 3px double #000; }
.dcr-neg { color: #c00000; }
.dcr-mark { color: #2e74b5; }
.dcr-denom { border-collapse: collapse; margin-top: 14px; width: 100%; }
.dcr-denom th, .dcr-denom td { border: 1px solid #666; padding: 2px 8px; font-size: 12px; }
.dcr-denom th { background: #eee; }
.dcr-denom .r { text-align: right; }
.report-out .dcr { background: #fff; }

/* report area */
.report-wrap { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.report-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-controls input[type=date] { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 7px; }
.report-out { flex: 1; overflow: auto; background: #fff; color: #16181d; border-radius: 4px; padding: 18px 22px; }
.report-out h2 { text-align: center; font-size: 18px; }
.report-out .sub { text-align: center; font-size: 12px; margin-bottom: 12px; }
.report-out table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-out th { border: 1px solid #333; background: #e8e8ec; text-align: left; padding: 5px 6px; }
.report-out td { padding: 4px 6px; border: 1px solid #555; }
.report-out .tot td { border-top: 2px solid #111; font-weight: 700; background: #f0f0f3; }
.report-out .grp td { font-weight: 700; background: #f5f5f7; }
.report-controls select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 8px; font-size: 13px; }

/* ============ POPUPS ============ */
#popup-layer {
  position: fixed; inset: 0; background: rgba(5, 9, 18, .62);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.popup {
  background: #141a28; border: 1px solid var(--line); border-radius: 6px;
  min-width: 380px; max-width: 640px; max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.popup-title {
  display: flex; align-items: center; background: #fff; color: #111;
  border-radius: 6px 6px 0 0; padding: 7px 12px; font-size: 13px;
}
.popup-title .x { margin-left: auto; background: transparent; color: #111; font-size: 15px; padding: 0 4px; }
.popup-body { padding: 16px; overflow-y: auto; }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick-grid button { background: var(--btn); border: 1px solid var(--line); border-radius: 4px; padding: 13px 6px; font-size: 13px; }
.pick-grid button:hover { background: var(--btn-hi); }
.pick-search { margin-top: 12px; display: flex; gap: 8px; }
.pick-search input {
  flex: 1; background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 9px; font-size: 14px;
}
.auth-form { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center; }
.auth-form label { text-align: right; font-size: 13px; color: var(--dim); }
.auth-form select, .auth-form input {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 9px; font-size: 14px; width: 100%;
}
.auth-sub { grid-column: 1 / -1; text-align: center; font-size: 13px; color: var(--dim); }
.popup .big-btn { grid-column: 2; }
.popup-msg { font-size: 14px; line-height: 1.6; padding: 6px 4px 2px; }
.popup-btnrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ============ PRINT ============ */
#print-area { display: none; }
@media print {
  body > .screen, #popup-layer { display: none !important; }
  body { background: #fff; overflow: visible; }
  #print-area { display: block !important; color: #000; }
  .receipt { width: 80mm; margin: 0 auto; font-family: "Courier New", monospace; font-size: 11px; line-height: 1.35; }
  .receipt .c { text-align: center; }
  .receipt .al-l { text-align: left; }
  .receipt .al-r { text-align: right; }
  .receipt .row { display: flex; justify-content: space-between; }
  .receipt .row .amt { text-align: right; }
  .receipt hr { border: none; border-top: 1px dashed #000; margin: 4px 0; }
  .receipt .big { font-size: 14px; font-weight: 700; }
  .rpt { font-family: "Segoe UI", Arial, sans-serif; font-size: 12px; color: #000; }
  .rpt h2 { text-align: center; } .rpt .sub { text-align: center; }
  .rpt table { width: 100%; border-collapse: collapse; }
  .rpt th { border: 1px solid #000; text-align: left; padding: 4px; background: #eee; }
  .rpt td { padding: 3px 4px; border: 1px solid #000; }
  .rpt .tot td { font-weight: 700; } .rpt .grp td { font-weight: 700; }
  .rpt .r { text-align: right; }
}
