/* นัดประชุม HR — calm, light tones; one primary action per screen. */
:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --text: #1f2a2e;
  --muted: #66727a;
  --line: #e2e8e6;
  --accent: #2f8f7d;
  --accent-soft: #e3f3ef;
  --accent-text: #ffffff;
  --danger: #b4443c;
  --danger-soft: #fbeceb;
  --warn: #8a5a00;
  --warn-soft: #fdf4e3;
  --ok-soft: #e6f4ea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 35, .05), 0 4px 16px rgba(20, 40, 35, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a1a; --surface: #1d2423; --text: #e6ecea; --muted: #9aa8a5; --line: #2c3735;
    --accent: #5cc0aa; --accent-soft: #1f3a34; --accent-text: #0e1a17;
    --danger: #ef8a80; --danger-soft: #3a2422; --warn: #f0c068; --warn-soft: #3a3020; --ok-soft: #1e3427;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 "Noto Sans Thai", "Leelawadee UI", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; line-height: 1.35; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 0; line-height: 1.4; }
code { background: var(--accent-soft); padding: .1em .4em; border-radius: 6px; font-size: .92em; word-break: break-all; }

/* ---- Header ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 760px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 600; white-space: nowrap; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (max-width: 480px) { .brand span { display: none; } }

/* ---- ⋯ menu (details/summary, no JavaScript needed) ---- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  font-size: 1.3rem; color: var(--muted); user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--accent-soft); color: var(--accent); }
.menu-pop { position: absolute; right: 0; top: 42px; min-width: 210px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text);
  text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-pop .danger { color: var(--danger); }
.menu-pop form { margin: 0; }
.menu-who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-weight: 600; }
.menu-who small { display: block; color: var(--muted); font-weight: 400; }
.menu.small > summary { width: 34px; height: 34px; }

/* ---- Layout ---- */
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card.empty { text-align: center; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px 16px 28px; }
.banner { text-align: center; padding: 6px 16px; font-size: .9rem; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.list-head h1 { margin: 0; }

/* ---- Forms ---- */
.form { display: grid; gap: 14px; }
.form.compact { gap: 10px; margin-top: 10px; }
.form label { display: grid; gap: 5px; font-weight: 600; font-size: .95rem; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .row { grid-template-columns: 1fr; } }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; margin: 0; }
.hint.center, .center { text-align: center; }
.field-err { color: var(--danger); font-size: .88rem; font-weight: 400; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
details.more[open] { display: grid; gap: 14px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
form.inline { display: inline; }

/* ---- Notices ---- */
.notice { padding: 10px 14px; border-radius: 10px; background: var(--bg); margin: 0 0 12px; }
.notice.ok { background: var(--ok-soft); }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.warn-text { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* ---- Meeting result ---- */
.done { display: flex; gap: 12px; align-items: center; background: var(--ok-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.done-mark { width: 36px; height: 36px; border-radius: 999px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; flex: none; }
.done span { display: block; color: var(--muted); font-size: .92rem; }
.when { margin: 0 0 14px; }
.link-box { display: grid; gap: 8px; background: var(--accent-soft); border-radius: 12px; padding: 14px; }
.link-box label { font-weight: 600; font-size: .92rem; }
.link-box input { font-size: .85rem; }
.link-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 18px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
@media (max-width: 420px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }

/* ---- Meeting list ---- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg a { padding: 4px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.day { font-size: .95rem; color: var(--muted); margin: 18px 4px 8px; font-weight: 600; }
.pill { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 8px; font-size: .8rem; margin-left: 6px; }
.meeting { display: grid; grid-template-columns: 100px 1fr auto; gap: 12px; align-items: start; padding: 14px 16px; }
.meeting .m-time { font-weight: 700; font-size: .95rem; }
.meeting h3 a { color: var(--text); text-decoration: none; }
.meeting h3 a:hover { color: var(--accent); }
.meeting p { margin: 2px 0 0; }
.m-actions { display: flex; gap: 6px; align-items: center; }
.faded { opacity: .6; }
@media (max-width: 520px) {
  .meeting { grid-template-columns: 1fr auto; }
  .meeting .m-time { grid-column: 1 / -1; }
}

/* ---- Users / tables ---- */
.user { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.u-main { display: grid; }
details.edit { flex-basis: auto; }
details.edit[open] { flex-basis: 100%; }
details.edit > summary { list-style: none; }
details.edit > summary::-webkit-details-marker { display: none; }
.temp-pass { border-color: var(--accent); }
.temp-pass p { margin: 6px 0 10px; color: var(--muted); font-size: .92rem; }
.kv { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.kv span { color: var(--muted); min-width: 120px; }
.kv code { font-size: 1.05rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.perm td:not(:first-child), table.perm th:not(:first-child) { text-align: center; }
tr.bad td { color: var(--danger); }
.nowrap { white-space: nowrap; }

/* ---- Help ---- */
.help ol, .help ul { padding-left: 1.3rem; }
.help li { margin: 4px 0; }

/* ---- Toast for "copied" ---- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: .92rem; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
