/* Portal CS — 共通の見た目（白・紺・青を基調にした、落ち着いた業務向けのデザイン） */
:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #18212f; --muted: #5a6575; --line: #e1e6ed; --line2: #cfd6e0;
  --accent: #1f5fae; --accent-dark: #174a88; --accent-soft: #e8f0fb;
  --navy: #14213a; --ok: #1b7a4b; --ok-soft: #e4f4ec; --warn: #9a5b00; --warn-soft: #fff4dc; --danger: #b42318; --danger-soft: #fdecea;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, system-ui, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
a { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.35; }

/* 上部（運営・宿の画面） */
.bar { background: var(--navy); color: #fff; padding: 0 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; min-height: 56px; }
.brand { font-weight: 700; letter-spacing: .02em; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #4c8ee6, #1f5fae); display: inline-block; }
.brand small { font-weight: 500; color: #aab6c9; font-size: .78rem; margin-left: 4px; }
.topnav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.topnav a { color: #c9d3e3; text-decoration: none; padding: 16px 12px; font-size: .92rem; border-bottom: 3px solid transparent; }
.topnav a:hover { color: #fff; }
.topnav a.on { color: #fff; border-bottom-color: #5b9cf0; font-weight: 600; }
.nb { background: #e5484d; color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 7px; margin-left: 4px; font-weight: 700; vertical-align: 1px; }
.userbox { display: flex; gap: 12px; align-items: center; font-size: .82rem; color: #c9d3e3; margin-left: auto; flex-wrap: wrap; }
.userbox a { color: #c9d3e3; }
.userbox button { background: none; border: 1px solid #56637a; color: #fff; border-radius: 6px; padding: 4px 10px; font: inherit; cursor: pointer; }

main.page { max-width: 1120px; margin: 24px auto 60px; padding: 0 16px; }
main.narrow { max-width: 460px; margin: 48px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .feat > .card + .card, .scope > .card + .card { margin-top: 0; }
.card h2 { font-size: 1.08rem; margin: 0 0 12px; }
.lead { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.k2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.kpi .n { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi.alert .n { color: var(--danger); }

/* フォーム */
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .9rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 3px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ef; outline-offset: 0; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; }
.btn, button { padding: 8px 14px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.btn:hover:not(:disabled), button:hover:not(:disabled) { background: #f2f5f9; }
a.btn { text-decoration: none; display: inline-block; }
.btn.primary, button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover:not(:disabled), button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.danger { color: var(--danger); border-color: #efb8b2; }
button.block { width: 100%; padding: 12px; margin-top: 18px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg { margin-top: 10px; font-weight: 600; min-height: 1.4em; }
.msg.err { color: var(--danger); } .msg.ok { color: var(--ok); }

/* 表 */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }

/* ラベル */
.tag { display: inline-block; border-radius: 99px; font-size: .74rem; padding: 1px 9px; font-weight: 600; white-space: nowrap; background: #eef1f5; color: var(--muted); }
.tag.unread, .tag.high, .tag.open-esc { background: var(--danger-soft); color: var(--danger); }
.tag.waiting, .tag.normal { background: var(--warn-soft); color: var(--warn); }
.tag.replied, .tag.ack, .tag.low { background: var(--accent-soft); color: var(--accent); }
.tag.closed, .tag.resolved, .tag.accepted { background: var(--ok-soft); color: var(--ok); }
.note { background: var(--accent-soft); color: #1d3f6e; border-radius: 8px; padding: 10px 14px; font-size: .88rem; }
.note.warn { background: var(--warn-soft); color: #6b4300; }
.note.danger { background: var(--danger-soft); color: #7a1a12; }

/* 会話の吹き出し */
.log { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.bubble small { display: block; color: var(--muted); margin-top: 6px; font-size: .78rem; border-top: 1px dashed var(--line2); padding-top: 4px; }
.bubble.guest { background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.bubble.staff { background: var(--accent-soft); border: 1px solid #cfe0f6; align-self: flex-end; }
.meta { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.event { align-self: center; font-size: .78rem; color: var(--muted); background: #eef1f5; border-radius: 99px; padding: 2px 12px; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; max-width: 640px; width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(16,24,40,.2); }
dialog::backdrop { background: rgba(20,33,58,.45); }
dialog .dhead { padding: 14px 20px; border-bottom: 1px solid var(--line); font-weight: 700; }
dialog .dbody { padding: 6px 20px 16px; max-height: 70vh; overflow-y: auto; }
dialog .dfoot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
