:root {
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1c1e21;
  --muted: #65676b;
  --border: #dadde1;
  --accent: #1877f2;
  --accent-text: #fff;
  --warn-bg: #fff4e5;
  --warn-border: #f0a020;
  --ok: #2e7d32;
  --bad: #c62828;
  --pending: #8a6d00;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191a;
    --card: #242526;
    --text: #e4e6eb;
    --muted: #b0b3b8;
    --border: #3e4042;
    --warn-bg: #3a2a10;
    --ok: #66bb6a;
    --bad: #ef5350;
    --pending: #e0c040;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
header h1 { font-size: 1.1rem; margin: 0; }
nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
nav button { background: none; border: none; padding: .45rem .8rem; border-radius: 6px; color: var(--muted); font-weight: 600; }
nav button.active { background: var(--bg); color: var(--accent); }
main { padding: 1rem; max-width: 1400px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.card h2 { font-size: 1rem; margin: 0 0 .6rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.grid2 .card { margin-bottom: 0; }
.grid2 { margin-bottom: 1rem; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
small { color: var(--muted); font-weight: normal; }
button { font: inherit; padding: .4rem .8rem; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 6px; cursor: pointer; }
button:hover { filter: brightness(.96); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
button.small { padding: .15rem .5rem; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); }
textarea { width: 100%; resize: vertical; }
label { display: flex; flex-direction: column; gap: .2rem; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: .4rem; font-weight: normal; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; align-items: end; }
.form-grid .span2 { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.bulk { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
td a { color: var(--accent); text-decoration: none; }
.tag { display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0 .45rem; font-size: 12px; margin: 0 .2rem .2rem 0; }
.status { font-weight: 600; font-size: 12px; text-transform: uppercase; }
.status.done, .status.posted, .status.detected, .status.user_done, .status.yes { color: var(--ok); }
.status.failed, .status.no { color: var(--bad); }
.status.awaiting_user, .status.prepared, .status.pending, .status.running { color: var(--pending); }
.pill { font-size: 12px; padding: .2rem .6rem; border-radius: 12px; border: 1px solid var(--border); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
.warning { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 8px; padding: .6rem .8rem; margin-top: .5rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: .4rem; }
.list { list-style: none; padding: 0; margin: .6rem 0 0; }
.list li { padding: .5rem; border-radius: 6px; cursor: pointer; }
.list li:hover, .list li.active { background: var(--bg); }
.variant { border: 1px solid var(--border); border-radius: 8px; padding: .6rem; margin-bottom: .6rem; }
.variant .row-between input { flex: 1; }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.thumbs button { position: absolute; top: 4px; right: 4px; }
.checklist { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: .4rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .1rem .8rem; }
.days { display: flex; gap: .6rem; flex-wrap: wrap; }
.job { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.job:last-child { border-bottom: none; }
dialog { border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); width: min(560px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.4); }
#modal-body { display: flex; flex-direction: column; gap: .7rem; }
#toast { position: fixed; bottom: 1rem; right: 1rem; max-width: 420px; display: flex; flex-direction: column; gap: .4rem; z-index: 20; }
#toast div { background: var(--text); color: var(--bg); padding: .6rem .9rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
#toast div.err { background: var(--bad); color: #fff; }
pre.body { white-space: pre-wrap; font: inherit; margin: .3rem 0; max-height: 6em; overflow: hidden; color: var(--muted); }
a.button-link { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 6px; color: var(--text); text-decoration: none; }
#tenant-bar { display: flex; align-items: center; gap: .4rem; }
.tenant-select { flex-direction: row; align-items: center; gap: .4rem; font-weight: 600; }
#tenant-select { font-weight: 700; }
#tenant-banner { flex-basis: calc(100% + 2rem); margin: 0 -1rem -.6rem; background: var(--accent); color: var(--accent-text); padding: .45rem 1rem; font-size: 15px; }
#tenant-banner #tenant-posting-as { opacity: .9; }
.profile-row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.profile-row:last-child { border-bottom: none; }
[hidden] { display: none !important; }
#tenant-banner.attention { background: var(--bad); }
.attention-box { border-color: var(--bad); }
.attention-box > div + div { margin-top: .5rem; }
#user-menu { display: flex; align-items: center; gap: .4rem; font-size: 13px; }
