@import url('/fonts/kanit/500.css');
@import url('/fonts/kanit/600.css');
@import url('/fonts/kanit/700.css');
@import url('/fonts/plex/400.css');
@import url('/fonts/plex/600.css');
@import url('/fonts/plex/700.css');

:root {
  --red: #D7191F; --red-dk: #A3121A; --red-bg: #FDE7E8;
  --ink: #141414; --ink2: #2A2A2A; --ink3: #3A3731;
  --paper: #F4F2EE; --card: #FFFFFF; --line: #DDD7CB; --line2: #CFC8BA; --line3: #EEE9DF;
  --muted: #5E5A52; --muted2: #6B655A;
  --yel: #F2E52B;
  --green: #17693F; --green-dk: #0F4F2E; --green-bg: #E3F1E8; --green-ring: #BFE3CC;
  --blue: #1D4F91; --blue-dk: #163C6E; --blue-bg: #E6EEF9;
  --orange: #D97706; --orange-dk: #9A3412; --orange-bg: #FFF4E5;
  --danger: #B42318; --danger-bg: #FDECEA;
  --disp: 'Kanit', 'IBM Plex Sans Thai', sans-serif;
  --body: 'IBM Plex Sans Thai', 'Kanit', sans-serif;
  --r: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body); color: var(--ink); font-size: 15px; line-height: 1.45;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, #E7E3DD 0 2px, transparent 2px 46px);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.disp { font-family: var(--disp); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 6px; border: 1px solid var(--line2);
  background: #fff; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #F3B5AD; }
.btn.lg { min-height: 54px; font-size: 17px; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 700; text-decoration: underline; }
.linkbtn:disabled { color: var(--muted2); text-decoration: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tag { display: inline-block; padding: 2px 10px; background: var(--ink); color: #fff; font-family: var(--disp); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.red { background: var(--danger); color: #fff; }
.pill.green { background: var(--green-bg); color: var(--green-dk); }
.pill.blue { background: var(--blue-bg); color: var(--blue-dk); }
.pill.orange { background: var(--orange-bg); color: var(--orange-dk); }
.pill.gray { background: #EEE9DF; color: var(--muted); }
.pill.dark { background: var(--ink); color: #fff; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
.input, label.field input, label.field select, label.field textarea {
  min-height: 46px; border-radius: 6px; border: 1px solid var(--line2); padding: 0 12px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 400; width: 100%;
}
label.field textarea { padding: 10px 12px; resize: vertical; }
.input:focus, label.field input:focus, label.field select:focus, label.field textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px #1414141a; }

.stepper { display: flex; align-items: center; height: 44px; border: 1px solid var(--line2); border-radius: 6px; background: #fff; }
.stepper button { width: 44px; height: 42px; border: 0; background: transparent; font-size: 22px; line-height: 1; }
.stepper button:disabled { opacity: .3; }
.stepper output { flex: 1; text-align: center; font-family: var(--disp); font-size: 19px; font-weight: 600; }

.seg { display: flex; background: #EAE5DA; border-radius: 6px; padding: 3px; gap: 3px; }
.seg button, .seg a { flex: 1; min-height: 38px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.seg [aria-pressed="true"], .seg .on { background: #fff; color: var(--ink); font-weight: 700; }

.notice { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 6px; font-size: 14px; line-height: 1.45; }
.notice.info { background: var(--blue-bg); color: var(--blue-dk); }
.notice.warn { background: var(--orange-bg); color: #7C2D12; border: 1px solid #F0C48A; }
.notice.err { background: var(--danger-bg); color: #8A1C12; border: 1px solid #F3B5AD; }
.notice.ok { background: var(--green-bg); color: var(--green-dk); }

/* floor plan */
.floor { position: relative; background: #FBFAF7; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.floor .inner { position: absolute; left: 0; top: 0; width: 800px; height: 660px; transform-origin: 0 0; }
.floor .decor { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: var(--muted); border-radius: 8px; line-height: 1.2; }
.floor .decor.wall { background: var(--line2); border-radius: 2px; }
.floor .decor.label { background: #EEE9DF; }
.floor .decor.area { background: repeating-linear-gradient(135deg, #EEE9DF 0 8px, #F7F4EE 8px 16px); }
.floor .tbl { position: absolute; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.12; padding: 2px; overflow: hidden; border: 1.5px solid #A39C8E; background: #fff; color: var(--ink); }
.floor button.tbl { font: inherit; }
.floor .tbl .n { font-family: var(--disp); font-weight: 700; font-size: 22px; }
.floor .tbl .s1 { font-size: 13px; font-weight: 700; }
.floor .tbl .s2 { font-size: 11px; }
.floor .tbl .s3 { position: absolute; top: 3px; right: 3px; font-size: 10px; font-family: var(--disp); font-weight: 700; line-height: 1; padding: 2px 4px; border-radius: 4px; background: var(--blue); color: #fff; }
.floor .tbl .s1, .floor .tbl .s2 { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-weight: 600; box-shadow: 0 8px 30px #0005; max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }

.modal-back { position: fixed; inset: 0; background: #0009; z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 760px; max-height: 92vh; overflow: auto; border-radius: 14px 14px 0 0; padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 12px; } }
.modal h2 { margin: 0; font-family: var(--disp); font-size: 24px; }
.modal .mhead { display: flex; align-items: center; gap: 10px; }
.modal .x { margin-left: auto; width: 44px; height: 44px; border-radius: 6px; border: 0; background: #F4F1EA; font-size: 22px; }

.spin { width: 22px; height: 22px; border: 3px solid #0002; border-top-color: var(--red); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
