:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --text: #1f1f1f;
  --muted: #5f6368;
  --border: #dadce0;
  --primary: #1a73e8;
  --primary-soft: #e8f0fe;
  --danger: #d93025;
  --ok: #188038;
  --drive: #1a73e8;
  --sheet: #188038;
  --doc: #4285f4;
  --form: #7248b9;
  --form-soft: #f0ebf8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 64, 67, .15), 0 1px 3px 1px rgba(60, 64, 67, .08);
  --shadow-lg: 0 4px 12px rgba(60, 64, 67, .2);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1e1f22;
    --surface-2: #2a2b2f;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --border: #3c4043;
    --primary: #8ab4f8;
    --primary-soft: #263449;
    --danger: #f28b82;
    --ok: #81c995;
    --form: #b39ddb;
    --form-soft: #2d2640;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: currentColor; flex-shrink: 0; }

/* ---------- Thanh trên ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 17px; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--danger); }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-btn img { width: 34px; height: 34px; border-radius: 50%; display: block; background: var(--surface-2); }
.menu {
  position: absolute; right: 12px; top: 54px; min-width: 220px; z-index: 30;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; border: 1px solid var(--border);
}
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; cursor: pointer; border-radius: 8px; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }

.app { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- Đăng nhập ---------- */
.login {
  min-height: calc(100vh - 32px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px;
}
.login img { width: 84px; height: 84px; }
.login h1 { margin: 0; font-size: 26px; }
.login p { margin: 0; color: var(--muted); max-width: 380px; }
.gbtn {
  display: inline-flex; align-items: center; gap: 12px; padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow);
}
.gbtn:hover { box-shadow: var(--shadow-lg); }
.gbtn svg { width: 22px; height: 22px; }
.alert { padding: 10px 14px; border-radius: 10px; background: #fce8e6; color: #a50e0e; max-width: 420px; }
@media (prefers-color-scheme: dark) { .alert { background: #3c1f1e; color: #f6aea9; } }

/* ---------- Trang chủ ---------- */
.hello { margin: 4px 0 18px; }
.hello h2 { margin: 0; font-size: 22px; }
.hello p { margin: 2px 0 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  border: 1px solid transparent; transition: transform .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tile .ic { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; }
.tile .ic svg { width: 28px; height: 28px; }
.tile strong { font-size: 16px; }
.tile small { color: var(--muted); margin-top: -10px; }
.ic.drive { background: var(--drive); }
.ic.sheet { background: #188038; }
.ic.doc { background: #4285f4; }
.ic.form { background: #7248b9; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.section-title h3 { margin: 0; font-size: 16px; }

/* ---------- Thẻ / form chung ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; border: 1px solid transparent; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); outline: none; min-height: 44px;
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.hint { font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--primary);
  white-space: nowrap;
}
.btn:hover { background: var(--primary-soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b1d3a; } }
.btn.primary:hover { filter: brightness(1.08); }
.btn.form { background: var(--form); border-color: var(--form); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 22px; background: var(--border); position: relative; transition: .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { left: 19px; }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--surface-2); font-size: 14px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.chip button:hover { background: var(--border); }
.chip select { border: 0; background: transparent; font-size: 13px; color: var(--muted); }

.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); display: flex; justify-content: center; gap: 10px;
}
.sticky-actions > .inner { width: 100%; max-width: 928px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Drive ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; white-space: nowrap; font-size: 14px; }
.tab.active { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); font-weight: 600; }
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 999px; padding: 4px 6px 4px 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.searchbar input { flex: 1; border: 0; outline: none; background: transparent; min-height: 40px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 0 0 8px; font-size: 14px; }
.crumbs a { padding: 4px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.crumbs a:last-child { color: var(--text); font-weight: 600; }
.crumbs a:hover { background: var(--surface-2); }
.files { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.file:last-child { border-bottom: 0; }
.file:hover { background: var(--surface-2); }
.file img.ficon { width: 22px; height: 22px; }
.file .meta { flex: 1; min-width: 0; }
.file .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .sub { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.fab {
  position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 16;
  display: inline-flex; align-items: center; gap: 8px; padding: 0 20px; height: 56px; border-radius: 18px; border: 0;
  background: var(--surface); color: var(--primary); box-shadow: var(--shadow-lg); font-weight: 600; cursor: pointer;
}
.fab svg { width: 26px; height: 26px; }
.popup-menu { position: fixed; z-index: 40; min-width: 210px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; border: 1px solid var(--border); }
.popup-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; cursor: pointer; border-radius: 8px; text-align: left; }
.popup-menu button:hover { background: var(--surface-2); }
.popup-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.popup-menu .danger { color: var(--danger); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal-back { align-items: center; } .modal { border-radius: 20px; } }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.perm { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.perm:last-child { border-bottom: 0; }
.perm .who { flex: 1; min-width: 0; }
.perm .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perm small { color: var(--muted); }
.perm .pic { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.perm .pic img { width: 100%; height: 100%; }
.perm select { max-width: 130px; }

/* ---------- Kết quả tạo ---------- */
.done { text-align: center; }
.done .big-ic { width: 64px; height: 64px; border-radius: 50%; background: #e6f4ea; color: var(--ok); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) { .done .big-ic { background: #1e3a28; } }
.done .big-ic svg { width: 36px; height: 36px; }
.done h2 { margin: 4px 0 4px; }
.linkbox { text-align: left; border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 12px; }
.linkbox .label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.linkbox .url { display: flex; gap: 8px; align-items: center; }
.linkbox .url input { flex: 1; min-width: 0; font-size: 14px; }
.linkbox .btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.qr { display: flex; justify-content: center; margin: 14px 0 4px; }
.qr canvas, .qr img { background: #fff; padding: 10px; border-radius: 12px; width: 180px; height: 180px; }
.share-report { text-align: left; font-size: 14px; margin-top: 12px; }
.share-report li.err { color: var(--danger); }

/* ---------- Trình tạo biểu mẫu ---------- */
.fb-switch { display: flex; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 14px; }
.fb-switch button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.fb-switch button.active { background: var(--form-soft); color: var(--form); }
.fcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; border-left: 6px solid transparent; position: relative; }
.fcard.head { border-top: 10px solid var(--form); border-left: 0; }
.fcard.focus { border-left-color: var(--primary); }
.fcard.section { border-top: 4px solid var(--form); }
.fcard .title-input { font-size: 24px; font-weight: 600; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 6px 0; min-height: 0; background: transparent; }
.fcard .q-title { font-size: 16px; background: var(--surface-2); border: 0; border-bottom: 2px solid var(--border); border-radius: 8px 8px 0 0; }
.fcard .q-title:focus { border-bottom-color: var(--form); box-shadow: none; }
.fcard .plain { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 6px 0; min-height: 36px; background: transparent; }
.fcard .plain:focus { border-bottom: 2px solid var(--form); box-shadow: none; }
.q-top { display: flex; gap: 10px; flex-wrap: wrap; }
.q-top .q-title { flex: 1 1 260px; }
.q-top .select { flex: 0 1 220px; }
.opt { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.opt .mark { width: 18px; height: 18px; border: 2px solid var(--muted); flex-shrink: 0; }
.opt .mark.radio { border-radius: 50%; }
.opt .mark.checkbox { border-radius: 3px; }
.opt .mark.num { border: 0; width: 22px; text-align: right; color: var(--muted); height: auto; }
.opt input { flex: 1; }
.opt .correct { border: 0; background: none; cursor: pointer; color: var(--border); padding: 4px; border-radius: 50%; display: inline-flex; }
.opt .correct.on { color: var(--ok); }
.addopt { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin-top: 6px; flex-wrap: wrap; }
.addopt button { border: 0; background: none; cursor: pointer; color: var(--primary); padding: 6px 4px; font-weight: 600; }
.q-foot { display: flex; align-items: center; justify-content: flex-end; gap: 2px; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 8px; flex-wrap: wrap; }
.q-foot .sep { width: 1px; height: 26px; background: var(--border); margin: 0 8px; }
.q-foot .pts { display: flex; align-items: center; gap: 6px; margin-right: auto; font-size: 14px; color: var(--muted); }
.q-foot .pts input { width: 64px; min-height: 34px; padding: 4px 8px; }
.scale-row { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; max-width: 420px; }
.fb-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.templates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.templates::-webkit-scrollbar { display: none; }
.templates button { flex-shrink: 0; }

/* Xem trước */
.pv-q { margin-bottom: 12px; }
.pv-q .t { font-size: 16px; margin-bottom: 4px; }
.pv-q .t .req { color: var(--danger); }
.pv-q .d { color: var(--muted); font-size: 14px; margin-bottom: 10px; white-space: pre-wrap; }
.pv-opt { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.pv-line { border-bottom: 1px dotted var(--muted); color: var(--muted); padding: 6px 0; width: 60%; font-size: 14px; }
.pv-scale { display: flex; align-items: flex-end; gap: 14px; overflow-x: auto; padding: 6px 0; }
.pv-scale div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; }
.pv-scale .lbl { color: var(--muted); align-self: center; }

/* ---------- Kết quả biểu mẫu ---------- */
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat b { font-size: 34px; color: var(--form); }
.bar-row { margin: 8px 0; }
.bar-row .lab { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.bar-row .lab span:first-child { overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--form); border-radius: 6px; }
.answers-list { max-height: 260px; overflow: auto; }
.answers-list div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.table-wrap { overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; }
table.data { border-collapse: collapse; font-size: 14px; min-width: 100%; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; max-width: 280px; }
table.data th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Quản trị ---------- */
.ic.admin { background: #5f6368; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--text); margin-bottom: 16px; white-space: pre-wrap; }
.notice svg { color: var(--primary); }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 20px; height: 20px; color: var(--muted); }
.admin-tabs .tab { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); }
.admin-tabs .tab svg { width: 18px; height: 18px; }
.admin-tabs .tab.active { color: var(--primary); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 880px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.stat-card b { font-size: 28px; color: var(--primary); }
.stat-card span { font-size: 13px; color: var(--muted); }
.stat-card.warn b { color: var(--danger); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.badge.purple { background: var(--form-soft); color: var(--form); }
.badge.red { background: #fce8e6; color: #c5221f; }
.badge.green { background: #e6f4ea; color: #137333; }
.badge.orange { background: #fef7e0; color: #b06000; }
@media (prefers-color-scheme: dark) {
  .badge.red { background: #3c1f1e; color: #f28b82; }
  .badge.green { background: #1e3a28; color: #81c995; }
  .badge.orange { background: #3d3018; color: #fdd663; }
}
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px 12px 14px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-row .meta { flex: 1; min-width: 0; }
.user-row .name { font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.user-row .sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.user-pic { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); flex-shrink: 0; }
.act-row { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.act-row:last-child { border-bottom: 0; }
.act-time { color: var(--muted); font-size: 12px; width: 120px; flex-shrink: 0; padding-top: 2px; }
.act-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.act-detail { color: var(--muted); font-size: 13px; margin-top: 2px; }
@media (max-width: 520px) { .act-row { flex-direction: column; gap: 2px; } .act-time { width: auto; } }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); }
.radio-card b { display: inline-flex; align-items: center; gap: 6px; }
.radio-card b svg { width: 18px; height: 18px; }
.card.dim { opacity: .55; }
.email-list { border: 1px solid var(--border); border-radius: 12px; max-height: 360px; overflow: auto; }
.email-item { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--border); }
.email-item:last-child { border-bottom: 0; }
.email-item .em { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.email-item .note { flex: 1 1 140px; min-width: 0; font-size: 13px; }
@media (max-width: 520px) { .email-item { flex-wrap: wrap; } .email-item .note { order: 3; flex-basis: 100%; } }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-of-type { border-bottom: 0; }
.setting-row .hint { margin-top: 2px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.btn.pulse { box-shadow: 0 0 0 4px var(--primary-soft); }
.spacer { flex: 1; }

/* ---------- Trang tính kết quả ---------- */
.linkbox.main { border-color: var(--primary); }
.more-links { margin-top: 14px; text-align: left; }
.more-links summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 6px 0; }
.sheet-box { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; padding: 12px; border-radius: 12px; background: #e6f4ea; }
.sheet-box > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.sheet-box svg { color: #188038; vertical-align: middle; }
.sheet-box.bad { background: #fef7e0; }
@media (prefers-color-scheme: dark) { .sheet-box { background: #1e3a28; } .sheet-box.bad { background: #3d3018; } .sheet-box svg { color: #81c995; } }
.sheet-hint { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #188038; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0 4px; }
.sheet-hint svg { width: 18px; height: 18px; }
.sheet-hint.off { color: var(--muted); }
@media (prefers-color-scheme: dark) { .sheet-hint { color: #81c995; } }

.linker-status { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 12px; font-size: 14px; }
.linker-status svg { width: 20px; height: 20px; color: var(--muted); }
.linker-status.ok { background: #e6f4ea; }
.linker-status.ok svg { color: #188038; }
@media (prefers-color-scheme: dark) { .linker-status.ok { background: #1e3a28; } .linker-status.ok svg { color: #81c995; } }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 10px; line-height: 1.55; }
.code-wrap { position: relative; margin-top: 8px; }
.code-wrap .btn { position: absolute; top: 8px; right: 8px; }
pre.code { background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: 12px; max-height: 260px; overflow: auto; white-space: pre; margin: 0; }

/* ---------- Khác ---------- */
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #323232; color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b3261e; }
.busy { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.35); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; gap: 6px; }
.busy .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; margin: 0; }
.muted { color: var(--muted); }
.mt0 { margin-top: 0; }
