/* vanphong.online — hệ thống giao diện dùng chung */
:root {
  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --surface-2: #f1f3f6;
  --border:    #e2e6ec;
  --border-2:  #cfd6e0;
  --text:      #1a1f2b;
  --text-2:    #5a6478;
  --text-3:    #8b94a6;
  --accent:    #1e5fd8;
  --accent-2:  #dce8fd;
  --accent-ink:#12408f;
  --ok:        #127a52;
  --ok-bg:     #dff3e9;
  --warn:      #8a5a00;
  --warn-bg:   #fdf0d5;
  --radius:    10px;
  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 4px 12px rgba(16,24,40,.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0f1319;
    --surface:   #171c25;
    --surface-2: #1e242f;
    --border:    #2a323f;
    --border-2:  #3a4453;
    --text:      #e7ebf2;
    --text-2:    #a3adbf;
    --text-3:    #6f7b8f;
    --accent:    #6b9bff;
    --accent-2:  #1c2b47;
    --accent-ink:#a8c4ff;
    --ok:        #4fd19a;
    --ok-bg:     #122b22;
    --warn:      #f0c069;
    --warn-bg:   #2e2413;
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg:#0f1319; --surface:#171c25; --surface-2:#1e242f; --border:#2a323f; --border-2:#3a4453;
  --text:#e7ebf2; --text-2:#a3adbf; --text-3:#6f7b8f; --accent:#6b9bff; --accent-2:#1c2b47;
  --accent-ink:#a8c4ff; --ok:#4fd19a; --ok-bg:#122b22; --warn:#f0c069; --warn-bg:#2e2413;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-head {
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.site-head .inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; color: var(--text); font-size: 17px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), #7b4fd8);
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700;
}
.brand .dom { color: var(--text-3); font-weight: 400; }
.site-head nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-head nav a { color: var(--text-2); font-size: 14.5px; padding: 6px 10px; border-radius: 7px; }
.site-head nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.theme-btn {
  background: none; border: 1px solid var(--border); color: var(--text-2);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; padding: 0;
}
.theme-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding: 52px 0 30px; text-align: center; }
.hero h1 { font-size: 34px; line-height: 1.22; margin: 0 0 12px; letter-spacing: -.02em; font-weight: 700; }
.hero p { font-size: 17px; color: var(--text-2); margin: 0 auto; max-width: 580px; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 16px;
  background: var(--ok-bg); color: var(--ok); border-radius: 99px;
  padding: 5px 13px; font-size: 13px; font-weight: 550;
}

/* ---------- Tool grid ---------- */
.cat-title {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); font-weight: 650; margin: 34px 0 12px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: block; color: var(--text); transition: border-color .13s, transform .13s, box-shadow .13s;
}
.card:hover { text-decoration: none; border-color: var(--border-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.card .ico { font-size: 20px; line-height: 1; margin-bottom: 9px; display: block; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 620; letter-spacing: -.005em; }
.card p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }

/* ---------- Tool page ---------- */
.crumb { font-size: 13.5px; color: var(--text-3); padding: 20px 0 0; }
.crumb a { color: var(--text-2); }
.tool-head { padding: 12px 0 22px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tool-head h1 { font-size: 27px; margin: 0 0 7px; letter-spacing: -.018em; font-weight: 700; }
.tool-head p { margin: 0; color: var(--text-2); font-size: 15.5px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.panel + .panel { margin-top: 0; }
.panel h2 { font-size: 15px; margin: 0 0 14px; font-weight: 620; letter-spacing: -.005em; }
.panel h2.sep { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 20px; }

label.f { display: block; margin-bottom: 14px; }
label.f > span.lb { display: block; font-size: 13.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
label.f > span.hint { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

input[type=text], input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 9px 11px; font-size: 15px; font-family: inherit;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
input.mono, textarea.mono { font-family: var(--mono); font-size: 14px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 620px) { .row, .row-3 { grid-template-columns: 1fr; } }

.btn {
  font: inherit; font-size: 14.5px; font-weight: 550; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.out {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; font-family: var(--mono); font-size: 14px;
  white-space: pre-wrap; word-break: break-word; min-height: 22px; line-height: 1.55;
}
.out.big { font-size: 17px; font-family: var(--sans); font-weight: 550; line-height: 1.5; }
.out.empty { color: var(--text-3); font-weight: 400; font-family: var(--sans); font-size: 14.5px; }

table.res { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.res th, table.res td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
table.res th { color: var(--text-2); font-weight: 550; font-size: 13px; }
table.res td.num, table.res th.num { text-align: right; font-family: var(--mono); font-size: 13.5px; }
table.res tr.total td { font-weight: 680; border-bottom: none; border-top: 2px solid var(--border-2); font-size: 15px; }
table.res tr.total td.num { font-size: 15px; }
table.res tbody tr:last-child td { border-bottom: none; }

.note {
  background: var(--warn-bg); color: var(--warn); border-radius: 8px;
  padding: 11px 14px; font-size: 13.5px; line-height: 1.55; margin-top: 14px;
}
.note strong { font-weight: 650; }
.note a { color: inherit; text-decoration: underline; }
.info { background: var(--accent-2); color: var(--accent-ink); }

.copied { color: var(--ok); font-size: 13.5px; font-weight: 550; }
.err { color: #c0392b; font-size: 13.5px; margin-top: 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .err { color: #ff8f7d; } }
:root[data-theme="dark"] .err { color: #ff8f7d; }

.drop {
  border: 2px dashed var(--border-2); border-radius: var(--radius);
  padding: 30px 20px; text-align: center; color: var(--text-2);
  cursor: pointer; transition: border-color .13s, background .13s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-2); }
.drop input[type=file] { display: none; }

.filelist { list-style: none; padding: 0; margin: 14px 0 0; font-size: 14px; }
.filelist li {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  background: var(--surface-2); border-radius: 7px; margin-bottom: 6px;
}
.filelist li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li .sz { color: var(--text-3); font-size: 12.5px; font-family: var(--mono); flex: none; }
.filelist li button { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 17px; padding: 0 3px; line-height: 1; }
.filelist li button:hover { color: var(--text); }

/* ---------- Other tools strip ---------- */
.more { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--border); }
.more h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 0 0 12px; font-weight: 650; }
.more-links { display: flex; flex-wrap: wrap; gap: 7px; }
.more-links a {
  font-size: 13.5px; padding: 6px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 99px; color: var(--text-2);
}
.more-links a:hover { text-decoration: none; border-color: var(--border-2); color: var(--text); }

/* ---------- Footer ---------- */
.site-foot {
  margin-top: 56px; border-top: 1px solid var(--border);
  background: var(--surface); padding: 26px 0; font-size: 13.5px; color: var(--text-3);
}
.site-foot .inner { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.site-foot a { color: var(--text-2); }
.site-foot .sp { margin-left: auto; }

@media (max-width: 560px) {
  .hero { padding: 36px 0 22px; }
  .hero h1 { font-size: 27px; }
  .tool-head h1 { font-size: 23px; }
  .site-head nav a.hide-sm { display: none; }
  .panel { padding: 16px; }
}
