* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --ink: #1a2433; --muted: #667085; --line: #e6e9ef;
  --brand: #0e7a5f; --brand-dark: #0a5f49; --brand-soft: #e7f5f0;
  --bg: #f4f7f9; --card: #ffffff; --warn: #b45309; --danger: #dc2626;
}
body { font-family: 'Be Vietnam Pro', system-ui, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }

/* ===== Cổng bảo mật ===== */
#gate {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0e7a5f 0%, #0a5f49 100%); padding: 20px;
}
.gate-box {
  background: #fff; border-radius: 18px; padding: 42px 38px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.gate-logo { width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 18px;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 28px; }
.gate-box h1 { font-size: 22px; margin-bottom: 8px; }
.gate-box > p { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.gate-input { display: flex; gap: 8px; }
.gate-input input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 16px; font-size: 16px;
  font-family: inherit; outline: none;
}
.gate-input input:focus { border-color: var(--brand); }
.gate-input button {
  border: none; background: var(--brand); color: #fff; border-radius: 12px; width: 52px; font-size: 17px; cursor: pointer;
}
.gate-input button:hover { background: var(--brand-dark); }
.gate-err { color: var(--danger); font-size: 13px; margin-top: 12px; display: none; }
.gate-safe { color: var(--muted); font-size: 12.5px; margin-top: 20px; }
.gate-safe i { color: var(--brand); }

/* ===== App ===== */
#app { display: none; max-width: 760px; margin: 0 auto; padding: 0 18px 60px; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 22px 4px 18px;
}
.brand { font-size: 18px; font-weight: 700; color: var(--brand-dark); }
.brand i { color: var(--brand); margin-right: 8px; }
.tag { font-size: 12.5px; color: var(--muted); background: #fff; border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 20px; }

.hero { padding: 8px 4px 24px; }
.hero h2 { font-size: 25px; line-height: 1.35; margin-bottom: 10px; }
.hero p { color: var(--muted); font-size: 14.5px; max-width: 620px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.field-label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 10px; }

.microcopy {
  display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); margin-top: 12px; text-align: center;
}
.microcopy i { color: var(--brand); }

.drop {
  border: 2px dashed #cdd6e0; border-radius: 14px; padding: 34px 20px; text-align: center; cursor: pointer;
  transition: all .15s; background: #fafbfc; position: relative;
}
.drop:hover, .drop.drag { border-color: var(--brand); background: var(--brand-soft); }
.drop i { font-size: 32px; color: var(--brand); }
.drop p { margin: 12px 0 4px; font-size: 14.5px; font-weight: 500; }
.drop-hint { font-size: 12.5px; color: var(--muted); }

/* Hai ô Bên A / Bên B */
.two-drop { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .two-drop { grid-template-columns: 1fr; } }
.two-drop .drop { padding: 26px 16px; }
.two-drop .drop p { font-size: 13.5px; }
.side-tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  margin-bottom: 6px; letter-spacing: .2px;
}
.side-a .side-tag { background: #e7f5f0; color: var(--brand-dark); }
.side-b .side-tag { background: #eef2ff; color: #4338ca; }
.side-a.drag, .side-a:hover { border-color: var(--brand); background: var(--brand-soft); }
.side-b.drag, .side-b:hover { border-color: #6366f1; background: #eef2ff; }
.side-b i { color: #6366f1; }

/* Công tắc chế độ thủ công */
.toggle {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; cursor: pointer;
  font-size: 13px; color: var(--muted); line-height: 1.55;
}
.toggle input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.toggle b { color: var(--ink); }
.toggle em { display: block; font-style: normal; font-size: 12px; color: #98a2b3; margin-top: 2px; }
.toggle i { color: var(--brand); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.field label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 12px 14px; font-size: 15px;
  font-family: inherit; outline: none;
}
.field input:focus { border-color: var(--brand); }

.go {
  width: 100%; border: none; background: var(--brand); color: #fff; border-radius: 13px; padding: 16px;
  font-size: 16px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background .15s;
}
.go:hover { background: var(--brand-dark); }
.go:disabled { opacity: .6; cursor: default; }
.status { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 12px; min-height: 20px; }

/* ===== Kết quả ===== */
.result { margin-top: 22px; }
.res-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; margin-bottom: 16px;
}
.res-head h3 { font-size: 17px; margin-bottom: 4px; }
.res-head p { font-size: 13px; color: var(--muted); }
.dl {
  background: var(--brand); color: #fff; text-decoration: none; border-radius: 11px; padding: 12px 20px;
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
}
.dl:hover { background: var(--brand-dark); }

.bar { display: flex; gap: 10px; align-items: center; border-radius: 12px; padding: 13px 16px; font-size: 13.5px; margin-bottom: 16px; }
.bar.ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.bar.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.warns { margin: 0 0 18px 20px; }
.warns li { font-size: 13px; color: #92400e; margin: 4px 0; }

.block { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
.block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 10px; background: #f6f8fa; color: var(--muted); font-weight: 600; border: 1px solid var(--line); }
.tbl td { padding: 8px 10px; border: 1px solid var(--line); color: var(--ink); vertical-align: top; }
.tbl b { color: var(--ink); }

.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 30px; }
