/* Clip Cadence - design tokens first, components after. Dark mode follows the OS. */
:root {
  color-scheme: light dark;
  --fg: #1c1c22; --muted: #5a5a66; --line: #dcdce4; --bg: #fff; --surface: #f6f6fa;
  --accent: #2a4bd7; --on-accent: #fff; --accent-hover: #2140b8; --focus: #2a4bd7;
  --radius: 10px; --radius-sm: 8px; --measure: 68ch; --page: 880px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ececf1; --muted: #a8a8b4; --line: #34343e; --bg: #15151a; --surface: #1c1c23;
    --accent: #8aa2ff; --on-accent: #0b0f24; --accent-hover: #a6b8ff; --focus: #a6b8ff;
  }
}
@media (prefers-contrast: more) {
  :root { --line: currentColor; --muted: var(--fg); }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--fg); background: var(--bg); line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
section[id], h2[id] { scroll-margin-top: 16px; }

.skip { position: absolute; left: 12px; top: -64px; z-index: 10; padding: 10px 14px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }

/* header + footer */
.top { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; align-items: center; max-width: var(--page); margin: 0 auto; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.top nav { display: flex; flex-wrap: wrap; gap: 0 4px; margin-left: -10px; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; text-decoration: none; }
.top nav a:hover, .top nav a[aria-current="page"] { text-decoration: underline; }
.top nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; text-decoration: none; color: var(--fg); }
.brand img { border-radius: 8px; }
footer { max-width: var(--page); margin: 24px auto 0; padding: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; text-align: center; }
footer a { display: inline-block; padding: 10px 6px; }
footer p { margin: 8px 0 0; }

/* layout + type */
main { max-width: var(--page); margin: 0 auto; padding: 8px 16px 32px; }
.hero { padding: 32px 0 8px; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem); line-height: 1.15; margin: 0 0 12px; text-wrap: balance; }
h2 { margin: 40px 0 12px; line-height: 1.25; text-wrap: balance; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: var(--measure); }
.note { color: var(--muted); font-size: .9rem; }
.steps li { margin-bottom: 10px; max-width: var(--measure); }
.doc { max-width: var(--page); }
.doc p, .doc li { max-width: var(--measure); }
.doc h2 { font-size: 1.15rem; margin-top: 32px; }
.updated { color: var(--muted); }
code { font-size: .9em; padding: 1px 5px; border-radius: 5px; background: var(--surface); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.ghost:hover { background: var(--surface); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 8px; }

/* feature cards + table */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.feature { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 14px; background: var(--surface); }
.feature h3 { margin: 12px 0 4px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.perm { width: 100%; border-collapse: collapse; min-width: 420px; }
.perm th, .perm td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.perm tr:last-child td { border-bottom: 0; }
.perm th { background: var(--surface); font-size: .9rem; }

/* illustration of the posting screen (decorative, aria-hidden) */
.panel-demo { margin: 24px 0 8px; }
.mock { max-width: 520px; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); box-shadow: 0 6px 24px rgba(0,0,0,.10); user-select: none; pointer-events: none; }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.mock-bar b { margin-left: 8px; font-size: .95rem; }
.mock-body { padding: 14px; }
.mock-row { margin-bottom: 12px; }
.mock-row label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.mock .chip, .mock .field, .mock .drop { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.mock .drop { padding: 22px 10px; text-align: center; border-style: dashed; }
.opt-line { font-size: .9rem; margin: 2px 0; }
.dot, .box { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--muted); vertical-align: -1px; margin-right: 4px; }
.dot { border-radius: 50%; } .box { border-radius: 3px; }
.dot.on { background: var(--accent); border-color: var(--accent); }
.mock-btn { text-align: center; padding: 9px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); font-size: .95rem; opacity: .8; }
.panel-demo > .note { text-align: center; }

@media (max-width: 600px) {
  /* bảng quyền -> mỗi hàng một khối, không phải cuộn ngang */
  .perm { min-width: 0; }
  .perm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .perm, .perm tbody, .perm tr, .perm td { display: block; width: 100%; }
  .perm tr { padding: 12px; border-bottom: 1px solid var(--line); }
  .perm tr:last-child { border-bottom: 0; }
  .perm td { padding: 0; border: 0; }
  .perm td:first-child { margin-bottom: 4px; }
}
@media (max-width: 480px) {
  .hero { padding-top: 20px; }
  .actions .btn { flex: 1 1 100%; }
  .mock-body { padding: 12px; }
}
@media print { .top nav, .skip, .actions, .mock { display: none; } }
