:root { --ocean: #1d4c8c; --ocean-soft: #e7eef8; --ink: #1f2430; --muted: #6b7280; --line: #e5e7eb; --bg: #f6f5f2; --ok: #2f7a4f; --warn: #b45309; --bad: #b42318; --airbnb: #e0565b; --bdc: #3b82f6; --direct: #1d4c8c; --manual: #7a5af8; --block: #9ca3af; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
h1 { font-size: 1.5rem; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 24px 0 10px; font-weight: 600; }
a { color: var(--ocean); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.btn { font: 500 13px Inter, sans-serif; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: #c7ccd4; }
.btn.primary { background: var(--ocean); color: #fff; border-color: var(--ocean); }
.btn.danger { color: var(--bad); border-color: #f2c4bf; }
.btn.link { border: 0; background: none; color: var(--ocean); padding: 4px 0; }
.btn:disabled { opacity: 0.5; cursor: default; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
textarea { min-height: 70px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.stat b { display: block; font-size: 1.6rem; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }
.alert { padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.alert.error { background: #fdecea; color: var(--bad); }
.alert.ok { background: #e8f5ee; color: var(--ok); }
.alert.warn { background: #fff4e5; color: var(--warn); }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px; background: var(--ocean-soft); color: var(--ocean); font-weight: 500; }
.pill.airbnb { background: #fde8e8; color: var(--airbnb); }
.pill.booking { background: #e5edfb; color: var(--bdc); }
.pill.kohlist { background: #f6efe2; color: #8a6a2f; }
.pill.direct { background: var(--ocean-soft); color: var(--direct); }
.pill.manual { background: #efebff; color: var(--manual); }
.pill.ok { background: #e3f3e9; color: var(--ok); }
.pill.warn { background: #fff1dc; color: var(--warn); }
.pill.bad { background: #fde7e5; color: var(--bad); }
.pill.grey { background: #eef0f3; color: var(--muted); }
#msg-count, #mail-count { background: var(--bad); color: #fff; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 100%; max-width: 360px; text-align: center; }
.login label { text-align: left; }
.login .btn.primary { width: 100%; padding: 10px; }

#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0d2341; color: #c9d4e5; display: flex; flex-direction: column; padding: 18px 0; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; font-weight: 600; color: #fff; letter-spacing: 0.1em; text-transform: uppercase; }
.side-brand img { filter: brightness(0) invert(1); }
.side nav a { display: block; padding: 9px 18px; color: #c9d4e5; text-decoration: none; }
.side nav a.active, .side nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side-foot { margin-top: auto; padding: 18px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.side-foot .btn.link, .side-foot a { color: #9fb3d1; text-align: left; }
#view { padding: 24px clamp(14px, 3vw, 32px); min-width: 0; }
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px; align-items: center; }
  .side-brand { padding: 6px 10px; }
  .side nav { display: flex; flex-wrap: wrap; width: 100%; }
  .side nav a { padding: 6px 10px; font-size: 13px; }
  .side-foot { flex-direction: row; margin: 0; padding: 6px 10px; flex-wrap: wrap; }
}

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; background: #fafafa; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8fafc; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; }
.tabs-inline { display: flex; gap: 4px; }
.tabs-inline button { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.tabs-inline button.on { background: var(--ocean); color: #fff; border-color: var(--ocean); }

/* calendar */
.acal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: #fff; }
.acal .h { padding: 6px; font-size: 11px; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafafa; }
.acal .c { min-height: 92px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; position: relative; cursor: pointer; user-select: none; }
.acal .c.out { background: #fafafa; color: #c0c4cc; }
.acal .c.past { background: #fbfbfb; }
.acal .c.sel { background: var(--ocean-soft); }
.acal .c .n { font-size: 12px; font-weight: 600; }
.acal .c .p { position: absolute; top: 4px; right: 6px; font-size: 11px; color: var(--muted); }
.acal .c .p.ov { color: var(--ocean); font-weight: 600; }
.acal .ev { display: block; text-decoration: none; font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-top: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.direct { background: var(--direct); } .ev.manual { background: var(--manual); } .ev.airbnb { background: var(--airbnb); } .ev.booking { background: var(--bdc); } .ev.other { background: #475467; }
.ev.block, .ev.kblock { background: var(--block); } .ev.pending { background: #f59e0b; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 10px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.drawer { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35); z-index: 50; display: flex; justify-content: flex-end; }
.drawer-body { width: min(620px, 100%); background: #fff; height: 100%; overflow-y: auto; padding: 22px; box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 10px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 80; max-width: 90vw; }
.toast.err { background: var(--bad); }
.copy { display: flex; gap: 6px; }
.copy input { font-family: ui-monospace, monospace; font-size: 12px; }
.log { font-size: 12px; color: var(--muted); max-height: 220px; overflow: auto; }
.nowrap { white-space: nowrap; }
.paidby { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 14px; }
.radio { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.radio input { width: auto; margin: 0; }
html[lang="th"] body { font-family: Inter, "Noto Sans Thai", system-ui, sans-serif; }
html[lang="my"] body { font-family: Inter, "Noto Sans Myanmar", system-ui, sans-serif; line-height: 1.7; }
#admin-lang { width: 100%; margin-bottom: 10px; background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 6px 8px; }
#admin-lang option { color: #111; }
.side-brand { text-decoration: none; cursor: pointer; }
