/* Capi Demy dashboard — theo ngôn ngữ thiết kế capidemy.com: Inter, đen/trắng, nhấn vàng #FFB717 */
:root {
  --ink: #1d1d1d;
  --ink-2: #666666;
  --ink-3: #9a9a9a;
  --line: #eaeaea;
  --bg: #f9f9f9;
  --card: #ffffff;
  --black: #000000;
  --yellow: #ffb717;
  --yellow-soft: #fff4d6;
  --blue: #1877f2;
  --blue-soft: #e8f1fe;
  --green: #2bb268;
  --green-soft: #e3f6eb;
  --red: #f24444;
  --red-soft: #fde8e8;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, Arial, sans-serif; color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--blue); }
a.link:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand img { height: 30px; }
.brand-text { font-weight: 700; font-size: 18px; }
.brand-text span { background: var(--yellow); border-radius: 6px; padding: 0 6px; }
.brand-tag { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 6px; margin-top: 14px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; margin-bottom: 2px;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--black); color: #fff; }
.nav .count { margin-left: auto; background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 600; border-radius: 99px; padding: 0 7px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 6px 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }

.stat { padding: 18px 20px; }
.stat .label { color: var(--ink-2); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.stat.accent { background: var(--black); color: #fff; border-color: var(--black); }
.stat.accent .label, .stat.accent .sub { color: #bdbdbd; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer;
  background: var(--black); color: #fff; white-space: nowrap; transition: transform .05s, opacity .15s;
}
.btn:hover { opacity: .86; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-light { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: var(--bg); opacity: 1; }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-green { background: var(--green); }
.btn-danger { background: var(--card); color: var(--red); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red-soft); opacity: 1; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }
form.inline { display: inline; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--green-soft); color: #1d8a4f; }
.badge-warning { background: var(--yellow-soft); color: #9a6a00; }
.badge-danger { background: var(--red-soft); color: #c02626; }
.badge-info { background: var(--blue-soft); color: var(--blue); }
.badge-muted { background: #f0f0f0; color: var(--ink-2); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--yellow); color: var(--ink); }
.tag-outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fcfcfc; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfcfc; }
td .primary { font-weight: 500; }
td .secondary { color: var(--ink-2); font-size: 12.5px; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.right { text-align: right; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.field .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px; min-height: 40px; outline: none; transition: border .15s, background .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); background: #fff; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--black); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters input, .filters select { width: auto; min-width: 150px; min-height: 36px; padding: 6px 10px; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.seg label { padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.seg input { display: none; }
.seg input:checked + span { color: var(--ink); }
.seg label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- alerts ---------- */
.flashes { margin-bottom: 18px; display: grid; gap: 8px; }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: #17713f; }
.alert-danger { background: var(--red-soft); color: #a51d1d; }
.alert-info { background: var(--blue-soft); color: #0f58b8; }
.alert-warning { background: var(--yellow-soft); color: #7a5400; }
.banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- class cards ---------- */
.class-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.class-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.class-card .name { font-size: 17px; font-weight: 600; }
.meta { display: grid; gap: 4px; color: var(--ink-2); font-size: 13px; }
.meta div { display: flex; gap: 8px; align-items: center; }
.meta svg { width: 15px; height: 15px; flex-shrink: 0; }
.progress { height: 6px; background: #f0f0f0; border-radius: 99px; overflow: hidden; display: flex; }
.progress .paid { background: var(--green); }
.progress .pending { background: var(--yellow); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.countdown { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--ink-2); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.timeline li:last-child { border-bottom: 0; }

.copy-box { display: flex; gap: 6px; }
.copy-box input { font-size: 12.5px; min-height: 32px; padding: 5px 9px; }
pre.email-body { white-space: pre-wrap; font-family: inherit; margin: 0; background: var(--bg); border-radius: var(--radius-sm); padding: 16px; border: 1px solid var(--line); }
code.snippet { display: block; background: #111; color: #f0f0f0; padding: 12px; border-radius: var(--radius-sm); font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #fff4d6 0, transparent 40%), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 32px 28px; }

/* ---------- public form ---------- */
.public { background: var(--bg); min-height: 100vh; padding: 0 16px 48px; }
.public.embed { background: transparent; min-height: 0; padding: 0; }
.public-hero { max-width: 640px; margin: 0 auto; padding: 36px 0 22px; }
.public-hero h1 { font-size: 32px; margin: 18px 0 8px; }
.public-card { max-width: 640px; margin: 0 auto; padding: 28px; }
.class-options { display: grid; gap: 8px; }
.class-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: border .15s; }
.class-opt:hover { border-color: #cfcfcf; }
.class-opt:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.field .class-opt { display: flex; margin: 0; font-weight: 400; font-size: 14px; }
.class-opt input { flex-shrink: 0; margin-top: 3px; accent-color: var(--black); width: 16px; height: 16px; }
.class-opt .price { margin-left: auto; font-weight: 600; white-space: nowrap; }
.hp { position: absolute; left: -9999px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 12px 16px; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; }
  .brand-tag, .sidebar-foot .me { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a svg { display: none; }
  .sidebar-foot { margin: 0; border: 0; padding: 0; display: flex; }
  .main { padding: 20px 16px 48px; }
  .grid-3, .grid-2, .form-row { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 22px; }
  h1 { font-size: 22px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .public-card { padding: 20px; }
  .public-hero h1 { font-size: 26px; }
}
