/* Entity Hub — light, plain design. Blue accent #1D4ED8, orange #B45309 for warnings. */
:root {
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --ink: #111827;
  --muted: #5B6472;
  --line: #E3E6EB;
  --accent: #1D4ED8;
  --accent-soft: #E8EEFC;
  --warn: #B45309;
  --warn-soft: #FDF3E7;
  --ok: #15803D;
  --ok-soft: #E8F5EC;
  --bad: #B91C1C;
  --bad-soft: #FCEBEB;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; font-weight: 600; }
code { background: #EEF0F3; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex: 0 0 240px; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 600; font-size: 1.1rem; padding: 4px 12px 16px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: .75rem; min-width: 22px; padding: 1px 7px; text-align: center; }
.me { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.me-name { font-weight: 600; }
.me-role { color: var(--muted); font-size: .85rem; margin-bottom: 4px; }
.me a, .me .link { font-size: .9rem; min-height: 32px; display: inline-flex; align-items: center; }
.main { flex: 1; min-width: 0; padding: 24px 32px 48px; max-width: 1180px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.demo-flag { background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 2px 10px; font-size: .8rem; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; width: auto; flex: none; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .brand { padding: 8px 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar nav a { padding: 0 10px; gap: 6px; }
  .me { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0 0; }
  .me-role { margin: 0; }
  .main { padding: 16px; }
}

/* Cards and blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; }
.card.empty { color: var(--muted); text-align: center; padding: 40px 20px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.toolbar p { margin: 0; flex: 1; min-width: 240px; }
.push-right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.error-text { color: var(--bad); }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; padding-top: 0; }
.note { background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 12px; margin: 8px 0; border-radius: 4px; }
.scroll-x { overflow-x: auto; }
.thumb { max-width: 220px; max-height: 160px; border-radius: 6px; border: 1px solid var(--line); display: block; margin: 8px 0; }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: .92rem; }
input, select, textarea {
  font: inherit; color: inherit; border: 1px solid #C9CED6; border-radius: 6px; padding: 9px 11px; background: #fff; min-height: 44px; width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
input[type=color] { padding: 4px; width: 64px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; min-height: 44px; }
.check.disabled { opacity: .55; }
.checks { display: flex; flex-wrap: wrap; gap: 0 18px; }
.row label { flex: 1; min-width: 140px; }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline select { width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { min-width: 150px; flex: 1; }
.counter { font-size: .8rem; color: var(--muted); text-align: right; font-weight: 400; }
.counter.near { color: var(--warn); font-weight: 600; }
.version { margin-top: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 6px; border: 1px solid #C9CED6; background: #fff; color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1E40AF; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.subtle { border-color: transparent; color: var(--muted); background: transparent; }
.btn.subtle:hover { color: var(--ink); background: var(--bg); }
.btn.big { min-height: 50px; font-size: 1rem; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-align: left; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary:not(.btn) { color: var(--accent); font-weight: 500; min-height: 44px; display: flex; align-items: center; }
details[open] > summary.btn { background: var(--accent-soft); border-color: var(--accent); }
.pop { margin-top: 8px; }

/* Chips, pills, tags */
.chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: #EEF0F3; color: var(--muted); }
.pill-done, .pill-published { background: var(--ok-soft); color: var(--ok); }
.pill-pending_approval, .pill-scheduled, .pill-publishing { background: var(--accent-soft); color: var(--accent); }
.pill-failed { background: var(--bad-soft); color: var(--bad); }
.pill-sent_back { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; font-size: .75rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; color: var(--muted); }
.tag.warn { border-color: var(--warn); color: var(--warn); }

/* Flash messages */
.flash { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.flash ul { margin: 0; padding-left: 18px; }
.flash.success { background: var(--ok-soft); border-color: #B7DFC3; color: #14532D; }
.flash.error { background: var(--bad-soft); border-color: #F2C0C0; color: #7F1D1D; }
.flash.warning { background: var(--warn-soft); border-color: #F0CFA5; color: var(--warn); }
.flash.secret { background: #FFFBEA; border-color: var(--warn); color: var(--ink); font-weight: 500; }

/* Amplify queue */
.feed-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.feed-body { white-space: normal; margin: 8px 0 12px; overflow-wrap: anywhere; }
.respond { border-top: 1px solid var(--line); padding-top: 10px; }
.respond-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.respond-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 8px 16px; padding: 10px 0; border-top: 1px dashed var(--line); }
.respond-row:first-of-type { border-top: 0; }
.respond-who { padding-top: 10px; }
.respond-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.act { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.act-label { font-weight: 500; min-height: 44px; display: flex; align-items: center; color: var(--muted); }
.act-status { font-size: .85rem; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .respond-actions { grid-template-columns: 1fr; } .respond-row { grid-template-columns: 1fr; } .respond-who { padding-top: 0; } }

/* Schedule */
table { border-collapse: collapse; width: 100%; }
.table th, .table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.table thead th { border-top: 0; font-size: .8rem; color: var(--muted); font-weight: 500; }
.table tr.inactive td { opacity: .6; }
.week th, .week td { padding: 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.week thead th { border-top: 0; font-weight: 500; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.week thead th.today { color: var(--accent); }
.week td { min-width: 92px; }
.cap-count { font-size: .85rem; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: #EEF0F3; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--accent); }
.week td.full .bar span { background: var(--warn); }
.week td.full .cap-count { color: var(--warn); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline .item { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.timeline .when { font-weight: 500; font-variant-numeric: tabular-nums; }
.timeline .what p { margin: 6px 0; }
@media (max-width: 600px) { .timeline .item { grid-template-columns: 1fr; gap: 2px; } }

/* Activity and misc */
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.log li:first-child { border-top: 0; }
.platforms { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.platforms li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; min-height: 44px; }

/* Sign-in and installer */
body.bare { display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.bare-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 460px; }
.bare-card h1 { margin-bottom: 12px; }
.sending { opacity: .6; cursor: progress; }
