/* lenlich 'web mình' stylesheet (package: web, wave 2).
   Served only from the allowlist in web/views.py as /static/app.css.
   CSP allows style-src 'self' only: no inline styles anywhere in the HTML.
   Status chips: Lên tay / Chờ đẩy / Đã hẹn FB / Đã đăng / Lỗi / Lỡ giờ /
   Đã hủy / Cần xem; red banner for critical alerts; calendar grid.
   System fonts only: no external fonts, no images, no remote references.
   (The favicons are separate allowlisted files linked from the page head.) */

:root {
  --ink: #1d2433;
  --muted: #667085;
  --line: #d9dee7;
  --soft: #f4f6fa;
  --card: #ffffff;
  --brand: #1f5fbf;
  --brand-dark: #174a96;
  --ok-bg: #e6f6ec;
  --ok-ink: #17663a;
  --info-bg: #e8f0fc;
  --info-ink: #1f4f99;
  --warn-bg: #fff5dc;
  --warn-ink: #7a5300;
  --err-bg: #fde8e8;
  --err-ink: #9b1c1c;
  --danger: #c62828;
  --danger-dark: #9b1c1c;
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  line-height: 1.45;
}

a { color: var(--brand); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }

/* ---- header and navigation ---- */
header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--brand);
  color: #fff;
}
header.top .brand { color: #fff; font-weight: 700; font-size: 1.1rem; margin-right: 0.6rem; }
header.top nav { display: flex; flex-wrap: wrap; gap: 0.2rem; flex: 1 1 auto; }
header.top nav a {
  color: #e8efff;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
}
header.top nav a:hover, header.top nav a:focus { background: var(--brand-dark); text-decoration: none; }
header.top nav a.active { background: #fff; color: var(--brand); font-weight: 600; }
header.top form.quick, header.top form.logout { margin: 0; }

main {
  max-width: 1280px;
  margin: 1rem auto 2rem;
  padding: 1rem 1.4rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

footer.foot { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 0 1rem 1.5rem; }

/* ---- banners and notices ---- */
.banner {
  max-width: 1280px;
  margin: 0.8rem auto 0;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}
.banner-critical { background: var(--danger); color: #fff; border: 2px solid var(--danger-dark); }
.banner-critical a { color: #fff; text-decoration: underline; }

.notice {
  padding: 0.6rem 0.9rem;
  margin: 0.6rem 0;
  border-radius: 8px;
  border-left: 5px solid transparent;
}
.notice ul { margin: 0.3rem 0 0; padding-left: 1.3rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); border-left-color: var(--ok-ink); }
.notice-info { background: var(--info-bg); color: var(--info-ink); border-left-color: var(--info-ink); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); border-left-color: #d49b00; }
.notice-error { background: var(--err-bg); color: var(--err-ink); border-left-color: var(--danger); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; color: var(--muted); }
ul.small { margin: 0.2rem 0 0; padding-left: 1.1rem; }
p.links { margin: 0.6rem 0; }
p.legend { font-size: 0.9rem; }
ul.problems { color: var(--err-ink); }

/* ---- status chips ---- */
.chip {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip-external { background: #ede7f6; color: #4527a0; border-color: #b39ddb; }   /* Lên tay */
.chip-queued { background: #eceff1; color: #37474f; border-color: #b0bec5; }     /* Chờ đẩy */
.chip-pushing { background: #e3f2fd; color: #0d47a1; border-color: #90caf9; }    /* Đang đẩy */
.chip-pushed { background: #e0f2f1; color: #00695c; border-color: #80cbc4; }     /* Đã hẹn FB */
.chip-published { background: #e8f5e9; color: #1b5e20; border-color: #81c784; }  /* Đã đăng */
.chip-failed, .chip-blocked { background: #ffebee; color: #b71c1c; border-color: #ef9a9a; } /* Lỗi */
.chip-missed { background: #fff3e0; color: #e65100; border-color: #ffb74d; }     /* Lỡ giờ */
.chip-cancelled { background: #f5f5f5; color: #757575; border-color: #d6d6d6; text-decoration: line-through; } /* Đã hủy */
.chip-skipped, .chip-attention { background: #fff8e1; color: #8d4b00; border-color: #ffca28; } /* Cần xem */
.chip-unknown { background: #fafafa; color: #424242; border-color: #e0e0e0; }
.chip-today { background: var(--brand); color: #fff; }
a.cell-link:hover .chip, a.cell-link:focus .chip { filter: brightness(0.93); }

.level-critical { color: var(--danger); font-weight: 700; }
.level-warning { color: var(--warn-ink); font-weight: 600; }
.level-info { color: var(--info-ink); }

/* ---- tables ---- */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 0.4rem 0 1rem; font-size: 0.93rem; }
th, td { border-bottom: 1px solid var(--line); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
th { background: var(--soft); color: var(--muted); font-weight: 600; white-space: nowrap; }
td.empty { color: var(--muted); font-style: italic; text-align: center; }
table.overview td:first-child { min-width: 12rem; }

/* calendar grid: 6 Pages x days */
table.calendar { table-layout: fixed; min-width: 900px; }
table.calendar th, table.calendar td { border: 1px solid var(--line); text-align: center; padding: 0.3rem; }
table.calendar td:first-child, table.calendar th:first-child { text-align: left; width: 9.5rem; white-space: nowrap; }
table.calendar tbody tr:nth-child(even) td { background: #fbfcfe; }
table.calendar td .chip { margin: 0.1rem 0; }

/* ---- facts (definition lists) ---- */
dl.facts {
  display: grid;
  grid-template-columns: minmax(10rem, max-content) 1fr;
  gap: 0.25rem 1rem;
  margin: 0.5rem 0 1rem;
}
dl.facts dt { color: var(--muted); font-weight: 600; }
dl.facts dd { margin: 0; }

/* ---- cards and thumbnails ---- */
section.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
  background: #fff;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0; }
.thumbs figure { margin: 0; text-align: center; font-size: 0.8rem; color: var(--muted); }
img.thumb {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--soft);
}

/* ---- captions, logs, diffs ---- */
pre, textarea {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.9rem;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.4rem 0 1rem;
}
pre.log { max-height: 36rem; overflow: auto; white-space: pre; }
pre.diff .d-add { color: #1b5e20; background: #e8f5e9; display: inline-block; width: 100%; }
pre.diff .d-del { color: #b71c1c; background: #ffebee; display: inline-block; width: 100%; }
pre.diff .d-ctx { color: var(--ink); }
textarea {
  width: 100%;
  max-width: 60rem;
  padding: 0.5rem;
  border: 1px solid #b8c0cc;
  border-radius: 8px;
  line-height: 1.4;
}
textarea[readonly] { background: var(--soft); }

/* ---- forms and buttons ---- */
form.form { margin: 0.6rem 0 1rem; }
form.inline { display: inline-block; margin: 0.2rem 0.4rem 0.2rem 0; }
div.actions { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0; }
label { margin-right: 0.6rem; }
input[type="text"], input[type="url"], input[type="date"], input[type="time"], input[type="number"],
input[type="password"], select {
  font: inherit;
  padding: 0.3rem 0.45rem;
  border: 1px solid #b8c0cc;
  border-radius: 6px;
  background: #fff;
}
input.num { width: 6rem; }
input.wide { width: 28rem; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8ab4f8; outline-offset: 1px; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 7px;
  border: 1px solid var(--brand-dark);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.btn:hover, .btn:focus { background: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger-dark); }
.btn-danger:hover, .btn-danger:focus { background: var(--danger-dark); }
.btn-small { padding: 0.2rem 0.6rem; font-size: 0.85rem; background: #fff; color: var(--brand); border-color: #fff; }
.btn-small:hover, .btn-small:focus { background: #e8efff; }

.f-block { color: var(--err-ink); font-weight: 600; }
.f-warn { color: var(--warn-ink); }

@media (max-width: 720px) {
  main { margin: 0.5rem; padding: 0.8rem; }
  dl.facts { grid-template-columns: 1fr; }
  input.wide { width: 100%; }
}
