:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --ink: #0f1b33;
  --ink-soft: #52607a;
  --line: #d5dce6;
  --accent: #1f4fff;
  --accent-ink: #ffffff;
  --accent-soft: #e4eaff;
  --good: #0b8a5f;
  --warn: #b26b00;
  --bad: #c2362b;
  --radius: 10px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1424;
    --surface: #131d33;
    --ink: #e8edf7;
    --ink-soft: #94a3bf;
    --line: #26334f;
    --accent: #6f8dff;
    --accent-ink: #0c1424;
    --accent-soft: #1b2850;
    --good: #3ccf98;
    --warn: #e8a63c;
    --bad: #ff7b70;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, label:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.logo span { color: var(--accent); }
.site-head nav { display: flex; gap: 18px; font-size: 14px; }
.site-head nav a { color: var(--ink-soft); text-decoration: none; }
.site-head nav a:hover { color: var(--ink); }
@media (max-width: 640px) { .site-head nav { display: none; } }

/* Home */
.hero { padding: 56px 0 32px; }
.hero h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 800; max-width: 16ch; }
.hero p { margin: 0; color: var(--ink-soft); max-width: 52ch; font-size: 18px; }

.tool-list { list-style: none; margin: 24px 0 0; padding: 0; border-top: 1px solid var(--line); }
.tool-list li { border-bottom: 1px solid var(--line); }
.tool-list a {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 20px 4px;
  text-decoration: none; color: inherit;
}
.tool-list a:hover { background: var(--surface); }
.tool-list strong { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.tool-list span.desc { grid-column: 1; color: var(--ink-soft); font-size: 15px; }
.tool-list span.tag { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 13px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.promise { margin: 40px 0 0; padding: 18px 20px; background: var(--accent-soft); border-radius: var(--radius); font-size: 15px; }
.promise strong { display: block; margin-bottom: 2px; }

/* Tool page */
.tool-head { padding: 36px 0 20px; }
.crumbs { font-size: 14px; color: var(--ink-soft); margin-bottom: 10px; }
.crumbs a { color: var(--ink-soft); }
.tool-head h1 { margin: 0 0 8px; font-size: clamp(28px, 5vw, 40px); letter-spacing: -0.03em; line-height: 1.15; font-weight: 800; }
.tool-head p { margin: 0; color: var(--ink-soft); max-width: 60ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 6px; min-height: 180px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; padding: 24px; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { font-size: 18px; }
.drop small { color: var(--ink-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.row { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.field input[type=number], .field input[type=text], .field select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-width: 130px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 99px; padding: 6px 14px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.btn {
  font: inherit; font-weight: 600; font-size: 16px; border: 0; border-radius: 8px; padding: 11px 22px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; font-size: 14px; }

.status { font-size: 14px; color: var(--ink-soft); min-height: 22px; }
.status.err { color: var(--bad); }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

/* Results */
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.file {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 14px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.file img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.file .ph { width: 64px; height: 64px; border-radius: 6px; background: var(--accent-soft); display: grid; place-items: center; font-weight: 700; color: var(--accent); font-size: 13px; }
.file .name { font-weight: 600; overflow-wrap: anywhere; }
.file .meta { font-size: 14px; color: var(--ink-soft); }
.file .meta b { color: var(--good); }
.file .meta b.warn { color: var(--warn); }
.file .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
  .file { grid-template-columns: 56px 1fr; }
  .file .actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.sizebar { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.sizebar .bar { flex: 1; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; position: relative; }
.sizebar .bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }

.out { width: 100%; font: inherit; font-size: 18px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-height: 90px; resize: vertical; }

/* Prose / SEO block */
.prose { margin: 40px 0 0; max-width: 68ch; }
.prose h2 { font-size: 22px; letter-spacing: -0.02em; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--ink-soft); }
.prose details { border-top: 1px solid var(--line); padding: 12px 0; }
.prose details:last-of-type { border-bottom: 1px solid var(--line); }
.prose summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.prose details p { margin: 8px 0 0; }

.related { margin: 40px 0 0; font-size: 15px; }
.related a { margin: 0 4px; }

.site-foot { margin-top: 64px; border-top: 1px solid var(--line); padding: 24px 0 40px; font-size: 14px; color: var(--ink-soft); }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Lịch */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-bar h2 { margin: 0 auto 0 0; font-size: 22px; letter-spacing: -0.02em; }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal th { font-size: 13px; font-weight: 600; color: var(--ink-soft); padding: 4px 0; }
.cal td { padding: 0; }
.day {
  width: 100%; aspect-ratio: 1 / 0.6; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; padding: 0;
}
.day:hover { border-color: var(--accent); }
.day .s { font-size: 18px; font-weight: 700; line-height: 1.1; }
.day .l { font-size: 11px; color: var(--ink-soft); line-height: 1.2; }
.day .l.first { color: var(--accent); font-weight: 700; }
.day.sun .s { color: var(--bad); }
.day.hol { background: var(--accent-soft); }
.day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day.sel { background: var(--accent); border-color: var(--accent); }
.day.sel .s, .day.sel .l, .day.sel .l.first { color: var(--accent-ink); }
@media (max-width: 640px) { .day { aspect-ratio: 1 / 0.95; min-height: 0; } }
@media (max-width: 480px) { .day .s { font-size: 15px; } .day .l { font-size: 10px; } .cal { border-spacing: 2px; } }
.qr-wrap { display: grid; place-items: center; min-height: 200px; background: var(--bg); border-radius: 8px; padding: 16px; }
.qr-wrap canvas { image-rendering: pixelated; max-width: 100%; height: auto; }
.preview-wrap { background: var(--bg); border-radius: 8px; padding: 12px; overflow: auto; max-height: 520px; text-align: center; }
.preview-wrap canvas { max-width: 100%; height: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.foot-tools { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.foot-tools a { color: var(--ink-soft); }
.logo svg { width: 26px; height: 26px; flex: none; }
.logo b { font-weight: inherit; }
