:root {
  color-scheme: light;
  --bg: #f3efe6;
  --paper: #fffdf8;
  --ink: #1f1a17;
  --muted: #6f645c;
  --line: #e3d9cc;
  --accent: #8f4b16;
  --accent-dark: #6d370d;
  --header: #241912;
  --danger: #9f2d2d;
  --ok-bg: #e7f3ea;
  --ok-ink: #1d5c34;
  --err-bg: #fdecec;
  --err-ink: #8d2424;
  --shadow: 0 16px 40px rgba(48, 28, 12, 0.08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(143, 75, 22, 0.08), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { cursor: wait; opacity: 0.7; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.notice {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px));
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-ink);
  box-shadow: var(--shadow);
}

.notice.is-error {
  background: var(--err-bg);
  color: var(--err-ink);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(440px, 100%);
  padding: 32px 28px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 0 12px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--header);
  color: #f6e2c8;
  font-weight: 700;
}

h1, h2, h3 { line-height: 1.25; }

h1 { margin: 0 0 8px; font-size: 28px; }

h2 { margin: 0; font-size: 20px; }

h3 { margin: 0; font-size: 16px; }

.lede, .hint, .empty, .brand-sub { color: var(--muted); }

.lede { margin: 0 0 20px; }

label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 14px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fffdf8;
}

button:hover { background: var(--accent-dark); }

button.secondary, .account-button, .room-card button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover, .account-button:hover {
  background: #faf6f0;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #efcfcf;
}

button.danger:hover { background: var(--err-bg); }

.form-error { color: var(--danger); margin: 0 0 12px; }

.topbar {
  background: var(--header);
  color: #f6e7d6;
}

.topbar-inner, .layout {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
}

.brand { margin: 0; font-weight: 700; letter-spacing: 0.04em; }

.brand-sub { margin: 0; color: #cbb8a4; font-size: 13px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar button.secondary {
  color: #f6e7d6;
  border-color: rgba(246, 231, 214, 0.35);
}

.topbar button.secondary:hover {
  background: rgba(246, 231, 214, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 0 40px;
  align-items: start;
}

.panel { padding: 18px; }

.section-head, .detail-head, .row-actions, .inline-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-head { margin-bottom: 14px; }

.stack-form, .detail-block {
  padding-top: 4px;
}

.stack-form {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.hint { margin: 0 0 12px; font-size: 13px; }

.account-list { display: grid; gap: 8px; margin-top: 16px; }

.account-button {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
}

.account-button.is-selected {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  background: #fbf6ef;
}

.account-name { font-weight: 650; }

.account-meta, .meta { color: var(--muted); font-size: 13px; }

.detail-head { align-items: flex-start; margin-bottom: 16px; }

.detail-block { margin-top: 18px; }

.detail-block h3 { margin-bottom: 10px; }

.room-list, .pairings { display: grid; gap: 10px; }

.room-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.room-card.is-selected { border-color: var(--accent); }

.room-title { margin: 0; font-weight: 650; }

.row-actions { flex-wrap: wrap; margin-top: 10px; }

.row-actions button, .inline-actions button { padding: 7px 10px; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
  word-break: break-word;
}

th { color: var(--muted); font-weight: 600; }

.empty { margin: 0; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .topbar-inner { align-items: flex-start; }
  .login-card { padding: 24px 18px; }
}
