/* Shared styles + the lounge / HQ screens. Same family as the customer pages (public.css): Pretendard, navy #0c3481,
   pill buttons, white rounded panels on light grey. Sizes are in rem so the reader's own text-size setting applies. */
:root {
  --bg: #f8f8f8; --card: #fff; --ink: #1a1a1a; --muted: #666; --line: #e2e4ea;
  --brand: #0c3481; --brand-ink: #fff; --tint: #eef2fb; --danger: #b3261e; --ok-bg: #e3f4ea; --ok-ink: #17603a; --err-bg: #fbe9e7;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 100%/1.6 Pretendard, "Pretendard Variable", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; word-break: keep-all; overflow-wrap: anywhere; }
main { margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 30rem; }
main.wide { max-width: 72rem; }
h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; margin: 0 0 16px; text-wrap: balance; }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; margin: 36px 0 12px; }
a { color: var(--brand); }
.opt { color: var(--muted); font-size: .875rem; font-weight: 400; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.center { text-align: center; }

/* top bar of the lounge / HQ screens: logo, sections, language + log out */
.appbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.appbar .brand img { display: block; height: 2.25rem; width: auto; }
.appbar nav { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.appbar nav a { flex: none; padding: 9px 13px; border-radius: 9999px; color: var(--ink); text-decoration: none; font-size: .9375rem; font-weight: 500; }
.appbar nav a:hover { background: var(--bg); }
.appbar nav a[aria-current] { background: var(--tint); color: var(--brand); font-weight: 700; }
.appbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.appbar form { margin: 0; }
.appbar .right button { white-space: nowrap; }
.appbar .me { padding: 8px 10px; border-radius: 9999px; font-weight: 600; text-decoration: none; max-width: 9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .me[aria-current] { background: var(--tint); }
/* phones: the menu is a grid of buttons under the logo, every section in view at once (no sideways scrolling), the current one filled */
@media (max-width: 47.5em) {
  .appbar nav { order: 3; flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr)); gap: 6px; overflow: visible; padding: 4px 0 6px; }
  .appbar nav a { display: flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 6px 4px; border-radius: 12px;
    background: var(--bg); border: 1px solid var(--line); font-size: .875rem; font-weight: 600; line-height: 1.25; text-align: center; }
  .appbar nav a[aria-current] { background: var(--brand); border-color: var(--brand); color: #fff; }
}

/* tabs inside a page (계정 관리): pills on a wide screen, one segmented bar on a phone */
.subtabs { display: flex; gap: 2px; margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.subtabs a { flex: none; padding: 9px 13px; border-radius: 9999px; color: var(--ink); text-decoration: none; font-size: .9375rem; font-weight: 500; }
.subtabs a[aria-current] { background: var(--tint); color: var(--brand); font-weight: 700; }
.roletabs { display: none; }
table.grid :is(td, thead th:not(:first-child)) { text-align: center; }
table.grid select { display: inline-block; width: auto; margin: 0; padding: 7px 10px; }
td.c-none { padding: 0; }

/* 시스템: status tiles, log lines, helper chat */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 12px; margin-bottom: 8px; }
.tiles .card { margin: 0; }
.tiles h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9375rem; margin: 0 0 6px; }
.big { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.big small { font-size: .875rem; font-weight: 500; color: var(--muted); }
.tiles .opt { margin: 0; }
.pill.s-bad { background: var(--err-bg); color: #7a1a14; }
pre { margin: 0; font: .8125rem/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.out { margin-top: 8px; padding: 12px; background: var(--bg); border-radius: 12px; max-height: 20rem; overflow: auto; }
.loglist { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.loglist > p { margin: 14px 16px; }
.logline { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; align-items: baseline; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.logline:last-child { border-bottom: 0; }
.when { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.l-warning .pill { background: #fff3d6; color: #7a5200; }
.l-error .pill, .l-critical .pill { background: var(--err-bg); color: #7a1a14; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; margin-bottom: 12px; padding: 2px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .when { display: block; margin-bottom: 2px; }
.b-admin { align-self: flex-end; background: var(--tint); border-color: var(--tint); }
.b-error { background: var(--err-bg); border-color: var(--err-bg); }
textarea { resize: vertical; }
@media (max-width: 47.5em) { .logline { grid-template-columns: auto 1fr; } .logline pre { grid-column: 1 / -1; } .bubble { max-width: 94%; } }

/* KR/EN switch (only rendered for visitors outside Korea) */
.lang { display: inline-flex; border: 1px solid var(--brand); border-radius: 9999px; overflow: hidden; font-size: .8125rem; font-weight: 700; line-height: 1; }
.lang a { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.5rem; padding: 0 12px; color: var(--brand); text-decoration: none; }
.lang a[aria-current] { background: var(--brand); color: #fff; }
.topbar { display: flex; justify-content: flex-end; min-height: 12px; padding: 12px 16px 0; }
.login-logo { display: block; height: 3rem; width: auto; margin: 8px 0 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin: 0 0 16px; }
.card h2 { margin-top: 0; }
h2.first { margin-top: 8px; }
/* .facts: read-only lines, label left and value right */
.facts p { display: flex; justify-content: space-between; gap: 16px; margin: 0 0 8px; }
.facts p > span:first-child { color: var(--muted); font-size: .875rem; flex: none; }
.facts p.opt { margin: 12px 0 0; }

label { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; color: inherit; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; padding: 0; accent-color: var(--brand); transform: scale(1.2); }
input[type=file] { padding: 9px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.check { font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 1.5px solid var(--line); border-radius: 12px; margin: 0 0 14px; padding: 12px 12px 0; min-width: 0; }
legend { font-weight: 600; font-size: .9375rem; padding: 0 6px; }
.consent { margin-bottom: 12px; font-size: .875rem; color: var(--muted); }
.consent summary { cursor: pointer; color: var(--brand); padding: 10px 0; }
.consent ul { margin: 8px 0 0; padding-left: 18px; }

button, .button { display: inline-block; min-height: 2.75rem; padding: 10px 20px; font: inherit; font-weight: 600; line-height: 1.5; color: var(--brand-ink); background: var(--brand); border: 0; border-radius: 9999px; cursor: pointer; text-decoration: none; text-align: center; }
form.card > button { width: 100%; padding: 14px; }
button.plain { background: none; color: var(--brand); padding: 8px 10px; }
button.danger { background: var(--danger); }
button.plain.danger { background: none; color: var(--danger); }

.msg { padding: 12px 16px; border-radius: 14px; background: #efeff2; margin: 0 0 16px; }
.msg.ok { background: var(--ok-bg); color: var(--ok-ink); }
.msg.error { background: var(--err-bg); color: #7a1a14; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 9999px; font-size: .8125rem; font-weight: 600; background: #efeff2; color: #444; }
.pill.s-booked { background: var(--tint); color: var(--brand); }
.pill.s-visited { background: var(--ok-bg); color: var(--ok-ink); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.filters input, .filters select { width: auto; max-width: 100%; margin: 0; flex: 0 1 auto; }

/* tables: a white rounded panel that scrolls sideways when it must */
.scroll { overflow-x: auto; margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font-size: .8125rem; font-weight: 600; color: var(--muted); background: #fbfbfc; }
table.num td, table.num thead th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
tr.noshow td { color: var(--muted); }
.actions form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
td form { margin: 0; }
td form.filters { flex-wrap: nowrap; }
table.edit input { margin: 0; padding: 8px 10px; }
table.edit input[type=time], table.edit input[type=number] { display: inline-block; width: auto; }
table.edit input[type=number] { width: 5.5em; }
table.edit input[name^=name_] { min-width: 9em; }
table.edit input[name^=address_] { min-width: 15em; }
table.edit input[name^=phone_] { min-width: 9em; }
table.edit td.maps label { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: .8125rem; font-weight: 400; white-space: nowrap; }
table.edit td.maps input { min-width: 13em; }
.days label { display: inline-block; font-weight: 400; margin: 0 10px 0 0; }

/* map links under a lounge, and the single save button that stays in reach while scrolling a long lounge list */
.maplinks { display: block; font-size: .875rem; }
.maplinks a { display: inline-block; padding: 6px 0; margin-right: 16px; }
.savebar { position: sticky; bottom: 12px; z-index: 2; display: flex; justify-content: flex-end; margin: 4px 0 8px; }
.savebar button { min-width: 11rem; box-shadow: 0 6px 18px rgba(12, 52, 129, .28); }

/* phones: a table.stack becomes one card per row, each cell labelled from its data-label */
@media (max-width: 47.5em) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .scroll:has(> table.stack) { overflow: visible; background: none; border: 0; border-radius: 0; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr { display: block; width: 100%; }
  table.stack tr { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; margin-bottom: 10px; }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 5px 0; border: 0; white-space: normal; text-align: right; }
  table.stack td[data-label]::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .8125rem; text-align: left; }
  table.stack td.actions, table.stack td.wide { display: block; text-align: left; padding-top: 10px; }
  table.stack td.empty { display: block; text-align: left; color: var(--muted); }
  table.stack td.actions :is(button, .button) { flex: 1 1 auto; }
  td form.filters { flex-wrap: wrap; }
  td form.filters input { flex: 1 1 10rem; }

  /* table.stack.cards: the card opens with a head line (name left, status right), then the labelled lines */
  table.stack.cards tr { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 14px 16px; }
  table.stack.cards td { grid-column: 1 / -1; }
  table.stack.cards td.c-name { grid-column: 1; font-size: 1.0625rem; text-align: left; padding-bottom: 8px; }
  table.stack.cards td.c-status { grid-column: 2; grid-row: 1; align-items: center; padding-bottom: 8px; }
  table.stack.cards td.c-none { display: none; }
  table.stack.cards td.wide { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
  table.stack.cards td.wide[data-label]::before { display: block; margin-bottom: 6px; }
  table.stack.cards td.wide form.filters { margin: 0; }
  table.stack.cards td.wide form.filters :is(select, input) { flex: 1 1 8rem; min-width: 0; }
  table.stack.cards td.c-foot { text-align: right; }
  table.stack.cards td.c-foot a { display: inline-block; padding: 6px 4px; font-weight: 600; }

  /* tabs become one bar of equal parts */
  .subtabs, .roletabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: 4px; overflow: visible;
    background: #e4e6ec; border-radius: 14px; }
  .subtabs a, .roletabs label { display: flex; align-items: center; justify-content: center; min-height: 2.75rem; margin: 0; padding: 6px 4px;
    border-radius: 10px; color: var(--ink); font-size: .875rem; font-weight: 600; line-height: 1.25; text-align: center; cursor: pointer; }
  .subtabs a[aria-current], .roletabs input:checked + label { background: #fff; color: var(--brand); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
  .roletabs { margin: 0 0 10px; }
  .roletabs input { position: absolute; opacity: 0; pointer-events: none; }
  .roletabs input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

  /* access rights: one card, one line per screen, showing only the role picked in .roletabs */
  table.grid, table.grid tbody { display: block; }
  table.grid thead, table.grid td { display: none; }
  table.grid tr { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 3.5rem; padding: 0 18px; border-bottom: 1px solid var(--line); }
  table.grid tbody tr:last-child { border-bottom: 0; }
  table.grid :is(th, td) { padding: 0; border: 0; white-space: normal; }
  table.grid th { font-weight: 600; }
  table.grid select { min-width: 9rem; padding: 9px 10px; }
  form:has(#show-digicon:checked) td.r-digicon, form:has(#show-wit:checked) td.r-wit, form:has(#show-hq:checked) td.r-hq,
  form:has(#show-lead:checked) td.r-lead, form:has(#show-staff:checked) td.r-staff { display: block; }
  .savebar button { width: 100%; }
  .card .filters select { flex: 1 1 100%; }
}

/* the lounge editor has too many columns for a tablet: up to about 1100px (at normal text size) each lounge is a card with its fields in a grid */
@media (max-width: 68.75em) {
  .scroll:has(> table.edit.stack) { overflow: visible; background: none; border: 0; border-radius: 0; }
  table.edit.stack thead { display: none; }
  table.edit.stack, table.edit.stack tbody { display: block; width: 100%; }
  table.edit.stack tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: 12px 16px; align-items: end;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 10px; }
  table.edit.stack td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; text-align: left; }
  table.edit.stack td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: .8125rem; }
  table.edit.stack input:not([type=checkbox], [type=time], [type=number]) { width: 100%; min-width: 0; }
  table.edit.stack td > button { width: 100%; }
}
