:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --border: #e1e6ee;
  --text: #17202e;
  --muted: #667085;
  --accent: #0068ff;
  --accent-hover: #0057d6;
  --accent-soft: #e6f0ff;
  --green: #12805c;
  --green-soft: #e3f6ee;
  --red: #c8322b;
  --red-soft: #fdecea;
  --orange: #b35c00;
  --orange-soft: #fff1de;
  --violet: #6b3fd1;
  --violet-soft: #f0eaff;
  --blue: #1d5fd1;
  --blue-soft: #e7efff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 50px rgba(15, 20, 28, .25);
  --radius: 12px;
  --sidebar: 240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --surface: #171e29;
    --surface-2: #1f2834;
    --border: #2b3544;
    --text: #e6ebf2;
    --muted: #93a0b4;
    --accent: #3d8bff;
    --accent-hover: #5b9dff;
    --accent-soft: #1b2b45;
    --green: #4cc79a;
    --green-soft: #173329;
    --red: #ff7b72;
    --red-soft: #3a1d1d;
    --orange: #f0b45a;
    --orange-soft: #3a2c14;
    --violet: #b59bff;
    --violet-soft: #2a2145;
    --blue: #8eb4ff;
    --blue-soft: #1f2a47;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.modal-open { overflow: hidden; }
h1 { font-size: 24px; margin: 0 0 2px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 16px; margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.ok-text { color: var(--green); }
.err-text { color: var(--red); }
.center { text-align: center; }
.pad { padding: 16px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.icon { flex: none; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Bố cục ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 8px 18px; }
.brand.big { font-size: 22px; justify-content: center; padding-bottom: 6px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; flex: none;
}
.logo.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 14px; }
.brand.big .logo { width: 40px; height: 40px; border-radius: 11px; font-size: 20px; }
.sidebar nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; flex: 1; min-width: 0; color: var(--text); }
.user-chip:hover, .user-chip.active { background: var(--surface-2); text-decoration: none; }
.user-meta { display: grid; min-width: 0; line-height: 1.25; }
.user-meta b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 12px; }
.main { flex: 1; min-width: 0; }
.mobile-bar { display: none; }
.content { max-width: 1120px; margin: 0 auto; padding: 28px 32px 64px; }
.scrim { display: none; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .layout.menu-open .sidebar { transform: none; }
  .layout.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px; position: sticky; top: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand { padding: 0; font-size: 16px; }
  .content { padding: 20px 16px 48px; }
}

/* ---------- Thành phần chung ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; border-radius: 9px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.block { width: 100%; padding: 10px; }
.icon-btn {
  border: 0; background: none; color: var(--muted); cursor: pointer; padding: 7px; border-radius: 8px;
  display: inline-grid; place-items: center;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: 10px; padding: 11px 16px; margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: var(--orange-soft); color: var(--orange); }
.banner.info { background: var(--blue-soft); color: var(--blue); }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.badge.small { font-size: 11px; padding: 1px 7px; margin-left: 6px; }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }

.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.avatar.fallback { display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.empty { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-icon { font-size: 40px; margin-bottom: 8px; }
.empty h3 { margin-bottom: 4px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto; }
.empty-actions { margin-top: 16px; }

.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); animation: rise .2s ease-out; }
.toast.err { background: var(--red); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Biểu mẫu ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field.inline { display: inline-grid; }
.field-label { font-weight: 600; font-size: 14px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; width: 100%; min-width: 0;
}
select { cursor: pointer; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input:disabled, select:disabled { opacity: .6; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.form-error { background: var(--red-soft); color: var(--red); border-radius: 9px; padding: 10px 12px; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input:not(.grow), .row > select { width: auto !important; }
.row > .grow { flex: 1; }
.num-input { max-width: 90px; }
.emoji-input { width: 56px !important; text-align: center; font-size: 18px; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 6px 12px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.sub-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 12px; margin-top: 8px; }
.quick, .chips, .vars { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px;
  padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip span { opacity: .7; margin-left: 2px; }
.chip.static { cursor: default; background: var(--surface-2); border-color: transparent; color: var(--text); }
.chip.strike { text-decoration: line-through; color: var(--muted); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day {
  width: 46px; height: 38px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.day.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select { width: auto; }

/* ---------- Đăng nhập ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 50%), var(--bg); }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 32px 28px; display: grid; gap: 16px;
}
.login-card > .muted { text-align: center; margin-top: -8px; }

/* ---------- Tổng quan ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 2px; color: var(--text); box-shadow: var(--shadow); }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat b { font-size: 26px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col.narrow { max-width: 860px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.onboarding { margin-bottom: 20px; }
.onboarding h2 { margin-bottom: 12px; }
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.steps-list li { display: flex; gap: 12px; align-items: flex-start; }
.steps-list li.done { opacity: .6; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.steps-list li.done .step-num { background: var(--green-soft); color: var(--green); }
.timeline, .recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.timeline li { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child, .recent li:last-child { border-bottom: 0; }
.tl-time { display: grid; min-width: 72px; line-height: 1.3; }
.tl-time b { font-size: 17px; }
.tl-body { min-width: 0; }
.tl-body .badge { transform: scale(.92); transform-origin: left; }
.recent li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.recent-body { min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.dot.ok { background: var(--green); }
.dot.err { background: var(--red); }

/* ---------- Tài khoản ---------- */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.account { display: grid; gap: 14px; align-content: start; }
.account-top { display: flex; gap: 14px; align-items: center; }
.account-name { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.account-name b { font-size: 16px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.qr-box { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 8px 0; }
.qr-frame {
  width: 260px; height: 260px; border: 1px solid var(--border); border-radius: 14px; background: #fff;
  display: grid; place-items: center; overflow: hidden;
}
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.qr-scanned { display: grid; gap: 10px; justify-items: center; color: #17202e; }
.qr-placeholder { font-size: 48px; }
.qr-text { font-weight: 500; max-width: 340px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bảng ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tr.dim { opacity: .55; }
.cell-group { display: flex; align-items: center; gap: 10px; }
.note-cell { min-width: 180px; }
.note-btn { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; text-align: left; }
.note-btn:hover { background: var(--surface-2); }
.note-btn.muted { color: var(--muted); font-size: 13px; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell .btn + .btn { margin-left: 6px; }

/* ---------- Tin nhắn ---------- */
.message-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.message-card { display: grid; gap: 8px; align-content: start; }
.message-top { display: flex; justify-content: space-between; gap: 8px; }
.message-summary {
  white-space: pre-line; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; min-height: 21px;
}
.message-card .actions { margin-top: 4px; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.editor-form { display: grid; gap: 18px; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }
.type-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 520px) { .type-tiles { grid-template-columns: repeat(2, 1fr); } }
.type-tile {
  border: 1.5px solid var(--border); border-radius: 11px; padding: 10px 6px; display: grid; justify-items: center; gap: 2px;
  cursor: pointer; text-align: center; font-size: 13px; background: var(--surface);
}
.type-tile input { position: absolute; opacity: 0; pointer-events: none; }
.type-tile .tile-icon { font-size: 22px; }
.type-tile:hover { background: var(--surface-2); }
.type-tile.on.blue { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.type-tile.on.orange { border-color: var(--orange); background: var(--orange-soft); color: var(--orange); }
.type-tile.on.violet { border-color: var(--violet); background: var(--violet-soft); color: var(--violet); }
.type-tile.on.green { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.type-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.option-row { flex-wrap: nowrap; margin-bottom: 6px; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 22px; display: grid; justify-items: center; gap: 4px;
  color: var(--muted); cursor: pointer; text-align: center; position: relative;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 9px; padding: 6px 6px 6px 12px; font-size: 14px; }
.file-list .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Xem trước kiểu khung chat Zalo */
.preview { position: sticky; top: 0; display: grid; gap: 8px; }
.preview-label { font-weight: 600; font-size: 14px; }
.chat { background: #e2e9f1; border-radius: 14px; padding: 16px 12px; display: grid; gap: 8px; justify-items: end; min-height: 180px; align-content: end; }
@media (prefers-color-scheme: dark) { .chat { background: #0b1118; } }
.bubble {
  background: #e5efff; color: #081b3a; border-radius: 12px; padding: 8px 12px; max-width: 92%; font-size: 14px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06); white-space: pre-wrap; word-break: break-word;
}
.bubble.urgent { border: 1.5px solid #f27806; }
.urgency-tag { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: #f27806; padding: 0 6px; border-radius: 4px; margin-bottom: 4px; }
.urgency-tag.u2 { background: #db342e; }
.bubble.file { display: flex; gap: 10px; align-items: center; background: #fff; white-space: normal; }
.bubble.file .icon { color: #0068ff; }
.bubble.file b { word-break: break-all; font-size: 13px; }
.z-card { background: #fff; color: #17202e; border-radius: 12px; padding: 12px; width: 92%; display: grid; gap: 6px; font-size: 14px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.z-card .muted { color: #667085; }
.z-card-head { font-size: 12px; font-weight: 700; color: #0068ff; text-transform: uppercase; letter-spacing: .03em; }
.z-reminder { display: flex; gap: 10px; align-items: flex-start; }
.z-emoji { font-size: 26px; line-height: 1; }
.z-question { font-size: 15px; }
.z-option { border: 1px solid #e1e6ee; border-radius: 8px; padding: 7px 10px; display: flex; gap: 8px; align-items: center; }
.z-option.add { color: #0068ff; border-style: dashed; }
.z-check { width: 15px; height: 15px; border: 1.5px solid #98a2b3; border-radius: 50%; flex: none; }
.z-check.square { border-radius: 4px; }

/* ---------- Lịch gửi ---------- */
.schedule-list { display: grid; gap: 12px; }
.schedule { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; padding: 16px 18px; }
.schedule.off .schedule-main { opacity: .6; }
.schedule-main { display: grid; gap: 6px; }
.schedule-when { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.schedule-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.group-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.group-chips .chip { font-size: 12px; padding: 2px 9px; }
.schedule-side { display: grid; gap: 8px; justify-items: end; text-align: right; }
.next { display: grid; line-height: 1.35; justify-items: end; }
.next b { font-size: 15px; }
@media (max-width: 760px) {
  .schedule { grid-template-columns: auto minmax(0, 1fr); }
  .schedule-side { grid-column: 1 / -1; justify-items: start; text-align: left; }
  .next { justify-items: start; }
}
.schedule-form { display: grid; gap: 18px; }
.form-section { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; }
.form-section h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.selected-message { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 9px; padding: 8px 12px; white-space: pre-line; }
.selected-message span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.picker { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.picker-head { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.picker-list { max-height: 260px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--surface-2); }
.picker-item.on { background: var(--accent-soft); }
.picker-item input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-foot { padding: 6px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* Công tắc bật/tắt */
.switch { position: relative; width: 42px; height: 24px; margin-top: 2px; cursor: pointer; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Hộp thoại ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 28, .5); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
}
.modal.wide { width: min(940px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 14px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px 22px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 16px; }
}
