:root { --deep: #0E1A2B; --blue: #1F5FBF; --gold: #FFC857; --ink: #172538; --muted: #5B6B82; --line: #D5DFEE; }
* { box-sizing: border-box; margin: 0; }
body { font-family: "Segoe UI", system-ui, sans-serif; color: var(--ink); background: #F4F7FC; line-height: 1.45; }
[hidden] { display: none !important; }
.bar { background: linear-gradient(160deg, #13294A, var(--deep)); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 19px; }
.brand img { width: 32px; height: 32px; border-radius: 22%; }
.brand span { color: var(--gold); font-weight: 600; }
.who { display: flex; gap: 14px; align-items: center; color: #C9D7EE; font-size: 14px; }
.bar .plain { color: #fff; border-color: rgba(255, 255, 255, .45); background: transparent; }
.bar .plain:hover:not(:disabled) { background: rgba(255, 255, 255, .14); border-color: #fff; color: #fff; }
main { max-width: 1360px; margin: 28px auto; padding: 0 20px; display: grid; gap: 20px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.panel.center { text-align: center; padding: 48px 22px; display: grid; gap: 14px; justify-items: center; }
h1 { font-size: 28px; } h2 { font-size: 20px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
button, a.primary, a.plain { font: inherit; cursor: pointer; }
button, a.primary, a.plain, .tab { border-radius: 10px; transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease; }
a.primary, a.plain { text-decoration: none; }
.primary { background: var(--blue); color: #fff; border: 0; padding: 10px 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 1px 2px rgba(14, 26, 43, .16); }
.primary:hover:not(:disabled) { background: #184E9C; box-shadow: 0 8px 18px rgba(31, 95, 191, .32); transform: translateY(-1px); }
.primary:active:not(:disabled) { transform: translateY(0); box-shadow: 0 1px 2px rgba(14, 26, 43, .16); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
.spin.dark { border-color: rgba(31, 95, 191, .28); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }
.checkline { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.plain { background: #fff; border: 1px solid #C5D4EA; padding: 8px 14px; font-size: 14px; font-weight: 700; color: var(--blue); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.plain:hover:not(:disabled) { background: #EAF1FD; border-color: var(--blue); color: #174E9C; }
.plain.warn { color: #B4543A; border-color: #E7C4BA; }
.plain.warn:hover:not(:disabled) { background: #FDECEA; border-color: #B4543A; color: #8E3E28; }
.primary:focus-visible, .plain:focus-visible, .tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button:disabled, .primary:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; background: #EEF3FB; padding: 3px 7px; border-radius: 6px; word-break: break-all; }
.copyline { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.copyline span { min-width: 70px; color: var(--muted); font-size: 13px; }
.inline { display: flex; gap: 8px; }
.inline input, .invoice select, .invoice input { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; }
.inline input { width: 260px; }
.tabs { display: flex; gap: 8px; }
.tab { background: #fff; border: 1px solid var(--line); color: var(--muted); padding: 8px 16px; font-weight: 700; }
.tab:hover:not(.on) { background: #F4F7FC; border-color: #C5D4EA; color: var(--ink); }
.tab.on { color: var(--deep); box-shadow: inset 0 -2px 0 var(--blue); }
#venueTab, #invoiceTab { display: grid; gap: 20px; }
.invoice { display: grid; gap: 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.invoice > .primary { justify-self: start; }
.invoice h3 { font-size: 15px; margin-top: 4px; }
.invoice label:not(.checkline) { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.invoice select, .invoice input { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.invoice select { min-width: 220px; max-width: 420px; }
.bill { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px; }
.items { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; }
.items .checkline { margin: 0 0 10px; }
.totals { max-width: 360px; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; gap: 16px; }
.totals .grand { font-size: 18px; border-top: 2px solid var(--line); padding-top: 6px; }
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .who { flex-wrap: wrap; gap: 8px; }
  main { margin: 16px auto; padding: 0 12px; }
  .panel { padding: 16px; }
  .inline { flex-direction: column; align-items: stretch; }
  .inline input { width: 100%; }
  .tabs { flex-wrap: wrap; }
  .copyline, .actions, .keybox, .row-between { flex-wrap: wrap; }
  .customer { min-width: 0; }
  .bill { grid-template-columns: 1fr; }
  .sheet { padding: 12px 8px 32px; }
  .sheet-bar { flex-wrap: wrap; }
}
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.customer { min-width: 220px; }
.customer select { font: inherit; width: 100%; min-width: 200px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.customer .muted { margin-top: 4px; }
.statusline { margin: 8px 0; }
.products { margin: 4px 0 0; padding-left: 18px; list-style: disc; }
.products li { display: list-item; margin: 2px 0; }
.pill { display: inline-flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; font-weight: 600; line-height: 1.25; border-radius: 99px; padding: 3px 10px; }
.pill.on { background: #E3F6EC; color: #1E6B45; } .pill.off { background: #F1F3F7; color: var(--muted); }
.pill.stop { background: #FDECEA; color: #B3261E; }
.statusline .pill { margin: 0 6px 4px 0; }
.keybox { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.actions { display: flex; gap: 6px; margin-top: 6px; }
.notice { margin-top: 14px; background: #FFF8E6; border: 1px solid #F3D58A; border-radius: 12px; padding: 14px; }
.error { color: #B3261E; background: #FDECEA; border: 1px solid #F5C2BD; border-radius: 12px; padding: 12px 16px; }
@media (max-width: 760px) { thead { display: none; } td { display: block; border: 0; padding: 6px 0; } tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 0; } }
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(14, 26, 43, .45); overflow: auto; padding: 28px 16px 48px; }
.sheet-card { width: min(760px, 100%); margin: 0 auto; background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(14, 26, 43, .28); overflow: hidden; }
.sheet-bar { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 16px 16px 0 0; }
.sheet-bar .plain { background: #F4F7FC; color: var(--ink); border: 1px solid #C5D2E4; padding: 8px 16px; font-weight: 700; }
.sheet-bar .plain:hover:not(:disabled) { background: #EAF1FD; border-color: var(--blue); color: #174E9C; }
.sheet-bar .primary { padding: 8px 16px; }
.sheet-note { margin: 0; padding: 0 40px 18px; color: var(--muted); background: #fff; }
#invoiceFrame { display: block; width: 100%; height: min(720px, 70vh); border: 0; background: #fff; }
.sheet-note:empty { display: none; }
body.confirm-open { overflow: hidden; }
.confirm-sheet { position: fixed; inset: 0; z-index: 60; background: rgba(14, 26, 43, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.confirm-card { width: min(440px, 100%); max-height: 100%; overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(14, 26, 43, .28); padding: 22px 24px 18px; }
.confirm-card h2 { margin: 0 0 10px; font-size: 19px; overflow-wrap: anywhere; }
.confirm-body p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.confirm-actions .plain { background: #F4F7FC; color: var(--ink); border: 1px solid #C5D2E4; padding: 9px 18px; font-weight: 700; }
.confirm-actions .plain:hover:not(:disabled) { background: #EAF1FD; border-color: var(--blue); color: #174E9C; }
.confirm-actions .confirm-danger { background: #B3261E; }
.confirm-actions .confirm-danger:hover:not(:disabled) { background: #8C1D17; box-shadow: 0 8px 18px rgba(179, 38, 30, .3); }
.paper { margin: 0; background: #fff; border-radius: 0 0 16px 16px; padding: 28px 40px 20px; }
.paper-head { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.lockup { display: flex; align-items: center; gap: 12px; }
.lockup img { width: 64px; height: 64px; border-radius: 14px; }
.lockup .rule { width: 3px; height: 52px; background: var(--gold); }
.lockup-name b { display: block; color: var(--blue); letter-spacing: .06em; font-size: 13px; }
.lockup-name span { display: block; color: var(--muted); font-size: 13px; }
.paper-meta { text-align: right; }
.paper-meta h2 { font-size: 22px; color: var(--deep); }
.paper-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; }
.paper-k { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.payable { margin-top: 14px; }
.paper table { margin-top: 28px; }
.paper td.num { text-align: right; white-space: nowrap; }
.paper tr.grand td { border-top: 2px solid var(--line); font-size: 18px; font-weight: 700; }
.paper-foot { margin-top: 28px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .paper { padding: 24px 18px; }
  .paper-head, .paper-grid { display: grid; }
  .paper-meta { text-align: left; }
  .paper thead { display: table-header-group; }
  .paper tr { display: table-row; border: 0; padding: 0; }
  .paper td { display: table-cell; border-bottom: 1px solid var(--line); padding: 10px 0; }
}
@media print {
  body { background: #fff; }
  .bar, main, #error, .sheet-bar, .sheet-note { display: none !important; }
  .sheet { position: static; background: #fff; padding: 0; overflow: visible; }
  .sheet-card { width: auto; box-shadow: none; border-radius: 0; }
  .paper { max-width: none; border-radius: 0; padding-top: 0; }
}
