/* Design tokens: docs/design.md (direction D, white and blue) */
:root {
  --page: #F4F7FC;
  --surface: #FFFFFF;
  --sidebar: #EAF0FA;
  --line: #D5E0F0;
  --ink: #1A2740;
  --muted: #5A6B86;
  --accent: #1F4BA5;
  --accent-dark: #15367A;
  --accent-soft: #E6EEFB;
  --warning: #C8641A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Sarabun", sans-serif;
  font-size: 15px;
}

h1, .brand, .card-figure { font-family: "Prompt", sans-serif; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 16px; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
.muted { color: var(--muted); font-weight: 400; }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }

.sidebar {
  flex: 0 0 230px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { font-weight: 600; font-size: 22px; color: var(--accent-dark); padding: 0 10px 14px; }
.nav-link {
  display: block;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #2B3A57;
}
a.nav-link:hover { background: var(--surface); color: var(--accent-dark); }
.nav-soon { color: #8A97AE; cursor: default; }

.content { flex: 1 1 560px; min-width: 0; padding: 24px 28px; }

.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.card {
  flex: 1 1 220px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--ink);
}
.card:hover { border-color: var(--accent); }
.card-title { font-weight: 600; font-size: 17px; }
.card-figure { font-size: 30px; font-weight: 500; color: var(--accent); }
.card-figure span { font-size: 14px; color: var(--muted); font-family: "Sarabun", sans-serif; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
}
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #EDF2FA; }
.table th { background: #EDF2FA; font-size: 13px; color: #2B3A57; white-space: nowrap; }
.table td { white-space: nowrap; }
.table td.muted { white-space: normal; min-width: 180px; }
.table .num { text-align: right; }

@media (max-width: 720px) {
  .sidebar { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .brand { width: 100%; padding-bottom: 4px; }
  .content { padding: 16px; }
}

/* Sign-in, forms, notices */
h2 { font-family: "Prompt", sans-serif; font-size: 18px; font-weight: 500; margin: 24px 0 10px; }
.auth-box { max-width: 380px; margin: 8vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.auth-box h1 { margin-bottom: 12px; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 500; margin-top: 8px; font-size: 14px; }
.form input, .form select, .row-form select {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.form input:focus, .form select:focus, .row-form select:focus, .btn:focus-visible, .nav-button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent-soft);
}
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.form-inline > div { display: flex; flex-direction: column; min-width: 180px; }
.btn {
  display: inline-block; min-height: 44px; padding: 10px 18px; margin-top: 12px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.form-inline .btn { margin-top: 0; }
.btn-small { min-height: 44px; padding: 8px 12px; margin-top: 0; font-size: 14px; }
.btn-quiet { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--line); }
.btn-quiet:hover { background: var(--line); color: var(--accent-dark); }
.notice { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; border: 1px solid var(--line); background: var(--accent-soft); }
.notice-warning { background: #FDEBDD; color: #7A3A0A; border-color: #F0C9A4; }
.notice-ok { background: var(--accent-soft); color: var(--accent-dark); }
.notice-secret code { font-size: 16px; font-weight: 600; margin-left: 6px; user-select: all; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; }
.chip-ok { background: var(--accent-soft); color: var(--accent-dark); }
.chip-off { background: #E9EDF3; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.row-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.row-form form { margin: 0; }
.account { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.account-name { font-weight: 600; padding: 0 10px; }
.account .muted { padding: 0 10px 6px; }
.nav-button { width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer; }
.nav-button:hover { background: var(--surface); color: var(--accent-dark); }

/* Dashboard 1: room status. Colour never stands alone: every status also shows its word. */
:root {
  --st-vacant-bg: #E8F5EC; --st-vacant-fg: #1B5E37; --st-vacant-bd: #9FD2B1;
  --st-reserved-bg: #FFF4D6; --st-reserved-fg: #6B4A00; --st-reserved-bd: #E6C766;
  --st-occupied-bg: #E6EEFB; --st-occupied-fg: #15367A; --st-occupied-bd: #A9BFE6;
  --st-notice-bg: #FDEBDD; --st-notice-fg: #7A3A0A; --st-notice-bd: #F0C9A4;
}
.status-vacant { background: var(--st-vacant-bg); color: var(--st-vacant-fg); border-color: var(--st-vacant-bd); }
.status-reserved { background: var(--st-reserved-bg); color: var(--st-reserved-fg); border-color: var(--st-reserved-bd); }
.status-occupied { background: var(--st-occupied-bg); color: var(--st-occupied-fg); border-color: var(--st-occupied-bd); }
.status-notice { background: var(--st-notice-bg); color: var(--st-notice-fg); border-color: var(--st-notice-bd); }

.building-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
}
.tab:hover { border-color: var(--accent); color: var(--accent-dark); }
.tab-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.tab-active:hover { background: var(--accent-dark); color: #fff; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 14px; }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.counter-figure { font-family: "Prompt", sans-serif; font-size: 30px; font-weight: 500; color: var(--accent); line-height: 1.2; }
.counter .chip { border: 1px solid transparent; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid transparent; display: inline-block; }

.floor h2 { margin-top: 20px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.room { border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; min-height: 88px; }
.room-number { font-family: "Prompt", sans-serif; font-size: 20px; font-weight: 600; line-height: 1.2; }
.room-type { font-size: 13px; }
.room-status { font-size: 14px; font-weight: 500; margin-top: 4px; }
.room-payment { font-size: 13px; margin-top: 2px; text-decoration: underline dotted; }
.payment-overdue { font-weight: 600; }

@media (max-width: 720px) {
  .room-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .counters { grid-template-columns: repeat(2, 1fr); }
}

/* Meter entry (mobile first): one large input per Room, status always with a word. */
.meter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.meter-list { list-style: none; margin: 0 0 90px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.meter-row { background: var(--surface); border: 1px solid var(--line); border-left-width: 6px; border-radius: 10px; padding: 10px 12px; }
.meter-done { border-left-color: var(--accent); }
.meter-missing { border-left-color: var(--warning); }
.meter-problem { border-color: #F0C9A4; border-left-color: var(--warning); background: #FFF8F2; }
.meter-none { border-left-color: #B9C4D6; background: #F7F9FC; }
.meter-room { display: flex; align-items: baseline; gap: 10px; }
.meter-body { display: grid; grid-template-columns: 1fr minmax(120px, 1.2fr) 1fr; gap: 10px; align-items: center; margin-top: 6px; }
.meter-input {
  width: 100%; min-height: 52px; font-size: 24px; font-family: "Prompt", sans-serif; text-align: right;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.meter-input:focus { outline: 2px solid var(--accent); background: var(--accent-soft); }
.meter-usage { text-align: right; }
.meter-note { margin-top: 8px; color: #7A3A0A; }
.meter-confirm { display: flex; gap: 8px; align-items: center; min-height: 44px; font-weight: 500; }
.meter-confirm input { width: 22px; height: 22px; }
.meter-admin { margin-top: 8px; }
.meter-admin summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent-dark); }
.meter-admin select, .meter-admin input { min-height: 44px; margin: 4px 8px 4px 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.chip-warn { background: #FDEBDD; color: #7A3A0A; border: 1px solid #F0C9A4; }
.text-warning { color: #7A3A0A; }
.meter-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--sidebar); border-top: 1px solid var(--line);
}
.meter-footer .btn { margin-top: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Review and approve (ticket 08) */
.steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 12px; }
.step { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 14px; }
.step-done { background: var(--accent-soft); color: var(--accent-dark); }
.step-current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.summary-cards .card { cursor: default; }
.actions { margin-bottom: 12px; }
.action-box { max-width: 560px; margin-bottom: 14px; }
.form textarea { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent-soft); }
.comments, .attachments { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.comments li, .attachments li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
@media (min-width: 721px) { .meter-footer { left: 230px; } }
@media (max-width: 720px) {
  .content { padding: 16px 12px; }
  .meter-body { grid-template-columns: 1fr 1.4fr; }
  .meter-usage { grid-column: 1 / -1; text-align: left; }
}
