/* Shared look for the admin and meeting pages: light, calm, high contrast. System fonts only. */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --surface-3: #e2e7ec;
  --line: #d6dce3;
  --line-strong: #b9c2cc;
  --text: #16202a;
  --text-2: #4a5665;
  --text-3: #5f6b7a;
  --primary: #0b6b61;
  --primary-hover: #08574f;
  --primary-soft: #dff1ed;
  --primary-ring: #17a58f;
  --danger: #c0321d;
  --danger-hover: #a12816;
  --danger-soft: #fdecea;
  --warn: #8a5300;
  --warn-soft: #fff3d6;
  --ok: #1a7038;
  --ok-soft: #e2f3e7;
  --accent: #4a3bbf;
  --accent-soft: #ecebfb;
  --focus: #2563eb;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .07);
  --shadow-lg: 0 10px 36px rgba(16, 24, 40, .18);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, "Noto Sans",
    "Noto Sans Thai", "Leelawadee UI", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg.ic { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-danger-text { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg.ic { width: 20px; height: 20px; }

/* ---- form fields ---- */
.field { display: grid; gap: 6px; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
}
.select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a5665' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; text-overflow: ellipsis; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input::placeholder, .textarea::placeholder { color: #8a94a1; }
.hint { font-size: 13px; color: var(--text-3); }
.error-text { font-size: 13px; color: var(--danger); font-weight: 600; }

/* switch: a styled checkbox that keeps native keyboard behaviour */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 36px; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; margin: 0;
  border-radius: 999px; background: #b6c0ca; position: relative; cursor: pointer; transition: background .15s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch .switch-text { display: grid; line-height: 1.35; }
.switch .switch-text small { color: var(--text-3); font-size: 12.5px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }

/* ---- chips and badges ---- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.chip svg.ic { width: 14px; height: 14px; }
.chip-primary { background: var(--primary-soft); color: var(--primary-hover); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em; user-select: none;
}

/* ---- dialogs ---- */
dialog.dlg {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-lg);
}
dialog.dlg::backdrop { background: rgba(15, 23, 32, .45); }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.dlg-head h2 { font-size: 18px; flex: 1; }
.dlg-body { padding: 8px 20px 4px; display: grid; gap: 14px; overflow: auto; }
.dlg-body p { color: var(--text-2); }
.dlg-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px 20px 20px; }

/* ---- toasts ---- */
.toasts {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 1000;
  display: grid; gap: 8px; justify-items: center; width: min(560px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 100%;
  padding: 10px 10px 10px 16px; border-radius: 12px; background: #1d2733; color: #fff;
  box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .18s ease-out;
}
.toast.no-action { padding-right: 16px; }
.toast .toast-text { flex: 1; min-width: 0; }
.toast .btn { min-height: 32px; padding: 0 12px; font-size: 13px; background: #fff; color: #10302c; border-color: #fff; }
.toast .btn:hover { background: #dff1ed; }
.toast .icon-btn { color: #c9d2dc; width: 30px; height: 30px; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.toast.warn { background: #6d4300; }
.toast.error { background: #9b2414; }
.toast.ok { background: #0d5a51; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- menus (popovers) ---- */
.menu {
  position: fixed; z-index: 900; min-width: 200px; max-width: min(320px, calc(100vw - 16px));
  max-height: min(70dvh, 520px); overflow: auto; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 6px 10px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font-size: 14px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline-offset: -2px; }
.menu-item svg.ic { width: 18px; height: 18px; color: var(--text-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg.ic { color: var(--danger); }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item .menu-check { margin-left: auto; color: var(--primary); }
.menu-item .menu-hint { margin-left: auto; color: var(--text-3); font-size: 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-head { padding: 6px 10px 2px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.menu-row { display: flex; gap: 4px; padding: 4px; flex-wrap: wrap; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
