/* KT Ads Manager — giao diện sáng, tối giản, responsive */
:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e5e7eb;
  --primary: #0068ff; --primary-d: #0052cc; --ok: #0f9d58; --warn: #d97706; --danger: #dc2626;
  --a: #93c5fd; --b: #0068ff; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }

.topbar { display: flex; align-items: center; gap: 1rem; background: #fff; border-bottom: 1px solid var(--line); padding: .6rem 1rem; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a, .nav-soon { padding: .35rem .7rem; border-radius: 8px; color: var(--text); }
.nav a.active { background: #e8f0ff; color: var(--primary); font-weight: 600; }
.nav-soon { color: #b0b5bf; cursor: default; }
.nav-soon small { font-size: .7rem; }
.userbox { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.role { background: var(--bg); padding: 0 .4rem; border-radius: 4px; color: var(--muted); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 6px; padding: .2rem .6rem; font-size: 1.1rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.container.narrow { max-width: 440px; padding-top: 10vh; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.danger-card { border-color: var(--danger); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h1 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text); padding: .5rem .9rem; border-radius: 8px; cursor: pointer; font: inherit; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.warn { background: #fff7e6; border-color: var(--warn); color: #92400e; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.full { width: 100%; }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }
form.inline { display: inline; }

.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.success { background: #ecfdf3; border-color: #a7f3d0; color: #065f46; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.banner { padding: .6rem 1rem; text-align: center; font-weight: 600; }
.banner.danger { background: var(--danger); color: #fff; }
.banner.danger a { color: #fff; text-decoration: underline; }
.banner.demo { background: repeating-linear-gradient(45deg, #fff7e6, #fff7e6 12px, #ffedd5 12px, #ffedd5 24px); color: #92400e; border: 1px dashed var(--warn); border-radius: 8px; margin-bottom: 1rem; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; background: var(--bg); color: var(--muted); font-size: .8rem; border: 1px solid var(--line); }
.badge.ok { background: #ecfdf3; color: var(--ok); border-color: #a7f3d0; }
.badge.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }

.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: .35rem .75rem; color: var(--text); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--primary); color: #fff; }
.filters { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; }
.kpi span { color: var(--muted); font-size: .8rem; }
.kpi strong { font-size: 1.6rem; line-height: 1.2; margin: .15rem 0; }
.kpi em { font-style: normal; color: var(--muted); font-size: .75rem; }
.kpi.accent { border-color: var(--primary); background: #f5f9ff; }
.kpi.accent strong { color: var(--primary); }
.muted-kpi strong { color: #b0b5bf; }
.small-kpis .kpi strong { font-size: 1.15rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table.small td { font-size: .85rem; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.dim td { color: #9ca3af; }
.bars-col { width: 30%; min-width: 120px; }
.bar { height: 7px; border-radius: 4px; margin: 3px 0; width: 0; }
.bar.a { background: var(--a); } .bar.b { background: var(--b); }
.legend { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 .25rem 0 .75rem; vertical-align: middle; }
.sw-a { background: var(--a); } .sw-b { background: var(--b); }
.json { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; word-break: break-all; max-width: 420px; }
.json .before { color: #991b1b; } .json .after { color: #065f46; }

label { display: block; margin-bottom: .8rem; font-size: .9rem; font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd7ff; border-color: var(--primary); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 1rem; padding: .75rem 1rem .25rem; }
legend { font-weight: 600; padding: 0 .4rem; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .2rem; }
.actions { display: flex; gap: .5rem; }
.form-narrow { max-width: 420px; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.inline-form input { width: auto; flex: 1 1 140px; margin: 0; }

.login h1 { margin-bottom: 0; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: .4rem 1rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
.steps li { margin-bottom: 1rem; }
.copybox { display: flex; gap: .5rem; align-items: flex-start; margin: .4rem 0; }
.copybox pre { flex: 1; margin: 0; background: #0f172a; color: #e2e8f0; padding: .6rem .8rem; border-radius: 8px; overflow-x: auto; font-size: .8rem; white-space: pre-wrap; word-break: break-all; }

.rec-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.rec-proposed { border-left: 4px solid var(--primary); }
.rec-approved { border-left: 4px solid var(--warn); }
.rec-reconciled { border-left: 4px solid var(--ok); }
.rec-rejected, .rec-expired { opacity: .7; }
.beforeafter { font-size: 1.1rem; }
.beforeafter .before { color: #991b1b; text-decoration: line-through; }
.beforeafter .after { color: #065f46; font-weight: 700; }
.up { color: var(--ok); font-weight: 600; } .down { color: var(--danger); font-weight: 600; }
.ai-text { white-space: normal; line-height: 1.6; }
.inline-check { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
.inline-check input { width: auto; margin: 0; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.media-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.media-item img, .media-item video { width: 100%; height: 200px; object-fit: contain; background: #111; display: block; }
.media-ph { height: 200px; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-weight: 600; }
.media-cap { padding: .4rem .6rem; font-size: .85rem; flex: 1; }
.media-item form { padding: 0 .6rem .6rem; }
.out-approved { border-color: var(--ok); }
.out-rejected { opacity: .6; }
.variant { border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; margin: .6rem 0; }
.variant-approved { border-left: 4px solid var(--ok); }
.variant-rejected { opacity: .6; }
.v-primary { margin: .3rem 0; }
.check { font-size: .82rem; margin-top: .2rem; }
.check-error { color: var(--danger); } .check-warn { color: #92400e; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; }
  .nav.open { display: flex; }
  .userbox { flex-basis: 100%; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { font-weight: 600; margin-top: .4rem; }
  .kpi strong { font-size: 1.3rem; }
  .bars-col { display: none; }
}
