:root {
  color-scheme: light;
  --paper: #fff8ed;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #6f675d;
  --line: #eadcc6;
  --orange: #ffa500;
  --orange-dark: #c66d00;
  --red: #bc2d20;
  --red-soft: #fff0e9;
  --amber: #a75f00;
  --amber-soft: #fff3d4;
  --green: #24733f;
  --green-soft: #edf8ee;
  --blue: #1f5f9c;
  --blue-soft: #eef5ff;
  --shadow: 0 14px 34px rgba(64, 40, 8, .09);
  font-family: "Segoe UI", Aptos, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button, select, input { border-radius: 10px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(255, 165, 0, .34); outline-offset: 2px; }

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 20px clamp(16px, 4vw, 48px) 24px;
  background: var(--ink);
  color: #fff;
  border-bottom: 5px solid var(--orange);
}
.brand {
  color: #fff;
  font-size: 25px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0;
}
.topbar-copy { min-width: 0; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--orange); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: 0; }
h2 { margin: 0; font-size: clamp(22px, 3vw, 32px); line-height: 1.05; }
h2 span { color: var(--muted); font-size: .72em; font-weight: 800; }
.topbar p:last-child { margin: 9px 0 0; color: #efe4d1; }
.refresh-card {
  display: grid;
  gap: 9px;
  justify-items: end;
  min-width: 210px;
  color: #efe4d1;
  font-size: 12px;
}
.topbar button, .controls button {
  border: 0;
  background: var(--orange);
  color: var(--ink);
  padding: 11px 16px;
  font-weight: 900;
  cursor: pointer;
}
.topbar button:disabled { opacity: .6; cursor: progress; }

main { padding: 22px clamp(12px, 3vw, 40px) 36px; }
.intro {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(280px, 1.2fr);
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}
.intro p:last-child {
  margin: 0;
  max-width: 850px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 13px 16px;
  border: 1px solid #f4cb83;
  border-radius: 14px;
  background: #fff5df;
  color: #56360b;
}
.notice span { color: #355174; }
.notice.error { background: var(--red-soft); border-color: #f0b6b0; color: #8d2119; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.summary {
  min-height: 96px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--orange);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.summary span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.summary strong { display: block; margin-top: 10px; font-size: 36px; line-height: 1; }
.summary.danger { border-left-color: var(--red); }
.summary.today, .summary.soon { border-left-color: var(--amber); }
.summary.attention { border-left-color: var(--blue); }
.summary.done { border-left-color: var(--green); }

.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; background: var(--orange); }
.dot.danger { background: var(--red); }
.dot.soon { background: var(--amber); }
.dot.muted { background: #8b8177; }
.dot.done { background: var(--green); }
.controls {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fffaf0;
}
.controls label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.controls label:first-child { grid-column: span 2; }
.controls input, .controls select {
  min-height: 39px;
  width: 100%;
  min-width: 0;
  border: 1px solid #e2d0b5;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 750;
}
.controls select {
  appearance: auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.controls .toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 39px;
  justify-content: flex-start;
  white-space: normal;
  line-height: 1.2;
}
.controls .toggle input {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: auto;
  accent-color: var(--orange);
  cursor: pointer;
}
.controls button { min-height: 39px; white-space: nowrap; background: var(--ink); color: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1120px; border-collapse: collapse; }
th {
  position: sticky;
  top: 0;
  background: #111111;
  color: #fff;
  padding: 11px 12px;
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid #30261a;
  white-space: nowrap;
}
td {
  padding: 12px;
  border-bottom: 1px solid #edf1f6;
  vertical-align: top;
  font-size: 13px;
}
.delivery-title { min-width: 330px; }
.delivery-title a { color: var(--orange-dark); font-weight: 900; text-decoration: none; }
.delivery-title .work-item-link {
  display: block;
  border-radius: 6px;
}
.delivery-title .work-item-link:hover strong,
.delivery-title .work-item-link:focus-visible strong {
  text-decoration: underline;
}
.delivery-title strong { display: block; margin-top: 4px; color: var(--ink); line-height: 1.35; }
.delivery-title span, td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-weight: 850;
  white-space: nowrap;
}
.pill.danger { color: var(--red); background: var(--red-soft); }
.pill.today, .pill.soon { color: var(--amber); background: var(--amber-soft); }
.pill.info, .pill.neutral { color: #315a93; background: #edf5ff; }
.pill.muted { color: #5b6472; background: #f0f2f5; }
.pill.done { color: var(--green); background: var(--green-soft); }
.missing { color: var(--amber); font-weight: 850; }
.tags { min-width: 160px; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }
.tag-list span {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  padding: 4px 7px;
  background: #eef2f8;
  border: 1px solid #d8e1ee;
  border-radius: 999px;
  font-size: 11px;
  color: #344256;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty { padding: 28px; text-align: center; color: var(--muted); }
footer { padding: 14px clamp(12px, 3vw, 40px); color: var(--muted); font-size: 12px; }

body.embed .topbar { padding: 14px 18px 16px; grid-template-columns: minmax(0, 1fr) auto; }
body.embed .brand, body.embed .intro, body.embed footer { display: none; }
body.embed main { padding: 14px; }
body.embed h1 { font-size: 30px; }
body.embed .summary { min-height: 82px; }
body.embed .summary strong { font-size: 30px; }
body.embed .controls { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(140px, 1fr)) auto; }

body.embed .topbar {
  min-height: 70px;
  align-items: center;
  padding: 10px 18px;
  border-bottom-width: 4px;
}
body.embed .eyebrow { display: none; }
body.embed h1 { font-size: 24px; }
body.embed .topbar p:last-child { margin-top: 4px; font-size: 14px; }
body.embed .refresh-card { gap: 6px; font-size: 11px; }
body.embed .topbar button {
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 10px;
}
body.embed .summary-grid {
  gap: 8px;
  margin-bottom: 10px;
}
body.embed .summary {
  min-height: 56px;
  padding: 10px 14px;
  border-left-width: 5px;
  border-radius: 12px;
}
body.embed .summary span { font-size: 11px; }
body.embed .summary strong {
  margin-top: 4px;
  font-size: 26px;
}
body.embed .workspace { border-radius: 12px; }
body.embed .panel-heading {
  align-items: center;
  padding: 10px 18px 8px;
}
body.embed .panel-heading .section-kicker { display: none; }
body.embed .panel-heading h2 { font-size: 22px; }
body.embed .legend { font-size: 11px; gap: 8px; }
body.embed .dot { width: 8px; height: 8px; }
body.embed { overflow-x: hidden; }
body.embed .controls {
  grid-template-columns: minmax(280px, 2fr) repeat(6, minmax(118px, 1fr)) auto auto;
  gap: 8px;
  padding: 8px 18px 10px;
}
body.embed .controls label:first-child { grid-column: auto; }
body.embed .controls label { gap: 3px; font-size: 10px; }
body.embed .controls input,
body.embed .controls select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 9px;
}
body.embed .controls .toggle {
  min-height: 34px;
  font-size: 10px;
  white-space: nowrap;
}
body.embed .controls button {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 9px;
}
body.embed .table-wrap { overflow-x: hidden; }
body.embed table { min-width: 0; table-layout: fixed; }
body.embed th:nth-child(1), body.embed td:nth-child(1) { width: 32%; }
body.embed th:nth-child(2), body.embed td:nth-child(2) { width: 12%; }
body.embed th:nth-child(3), body.embed td:nth-child(3) { width: 11%; }
body.embed th:nth-child(4), body.embed td:nth-child(4) { width: 13%; }
body.embed th:nth-child(5), body.embed td:nth-child(5) { width: 7%; }
body.embed th:nth-child(6), body.embed td:nth-child(6) { width: 6%; }
body.embed th:nth-child(7), body.embed td:nth-child(7) { width: 6%; }
body.embed th:nth-child(8), body.embed td:nth-child(8) { width: 13%; }
body.embed .delivery-title { min-width: 0; }
body.embed .tags {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
body.embed .tag-list {
  flex-wrap: wrap;
  overflow: visible;
}
body.embed .tag-list span {
  flex: 0 1 auto;
  max-width: 120px;
  padding: 3px 7px;
}
body.embed th,
body.embed td {
  overflow: hidden;
  text-overflow: ellipsis;
}
body.embed th:nth-child(8),
body.embed td:nth-child(8) {
  overflow: visible;
}
body.embed th { padding: 8px 12px; }
body.embed td { padding: 9px 12px; }
body.embed .pill {
  min-height: 24px;
  padding: 4px 8px;
}

@media (max-width: 1200px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .controls, body.embed .controls { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .controls label:first-child { grid-column: span 2; }
  body.embed .summary-grid { grid-template-columns: repeat(6, minmax(110px, 1fr)); }
  body.embed .controls {
    grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
  }
}
@media (max-width: 700px) {
  .topbar { display: block; }
  .brand { display: inline-block; margin-bottom: 14px; }
  .topbar button { width: 100%; }
  .refresh-card { margin-top: 16px; justify-items: stretch; }
  .intro { grid-template-columns: 1fr; }
  .summary-grid, .controls { grid-template-columns: 1fr; }
  .controls label:first-child { grid-column: auto; }
  .panel-heading { display: block; }
  .legend { justify-content: flex-start; margin-top: 12px; }
}
