:root {
  --ink: #202124;
  --muted: #667085;
  --line: #d8dee8;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --blue: #295f98;
  --green: #1f7a5a;
  --amber: #b7791f;
  --red: #b42318;
  --teal: #1e6f74;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f6;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #e5e7eb;
  color: #111827;
  font-weight: 800;
  border-radius: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p {
  margin: 2px 0 0;
  color: #cbd5e1;
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 6px;
}

.nav-tab {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dbe4ef;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.nav-tab:hover,
.nav-tab.active {
  background: #253044;
  color: #fff;
}

.nav-icon {
  width: 20px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.import-button input {
  display: none;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

#globalSearch {
  width: min(420px, 42vw);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.primary-button,
.secondary-button,
.icon-button {
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 36px;
}

.primary-button {
  background: var(--blue);
  color: #fff;
  padding: 0 14px;
}

.secondary-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
}

.icon-button {
  width: 34px;
  height: 34px;
  background: #fff;
  border-color: var(--line);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.entry-hero {
  min-height: 148px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-hero h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.entry-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.entry-stats {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.entry-stats span,
.entry-stats strong {
  display: block;
}

.entry-stats span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.entry-stats strong {
  font-size: 20px;
}

.entry-type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.entry-type {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.entry-type.active {
  border-color: var(--blue);
  background: #eef6ff;
}

.entry-type b,
.entry-type span {
  display: block;
}

.entry-type b {
  font-size: 16px;
  margin-bottom: 8px;
}

.entry-type span {
  color: var(--muted);
  line-height: 1.4;
}

.entry-layout {
  align-items: start;
}

.helper-steps {
  display: grid;
  gap: 10px;
}

.helper-steps div {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.helper-steps b {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
}

.helper-steps span {
  line-height: 1.5;
}

.staff-tip {
  margin-top: 14px;
  border-left: 4px solid var(--teal);
  padding: 10px 12px;
  background: #eef8f8;
  border-radius: 8px;
}

.staff-tip p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
}

.kpi-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 14px;
  min-height: 106px;
}

.kpi-card span {
  color: var(--muted);
  font-size: 13px;
}

.kpi-card strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.kpi-card small {
  color: var(--muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 16px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.brief {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 260px;
  overflow: auto;
}

.task-list,
.timeline {
  display: grid;
  gap: 10px;
}

.task-item,
.timeline-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.task-item.high,
.timeline-item.high {
  border-left-color: var(--red);
}

.task-item.medium {
  border-left-color: var(--amber);
}

.task-item h4,
.timeline-item h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.task-item p,
.timeline-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.high {
  background: var(--red);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.workflow-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.workflow-grid b,
.workflow-grid span {
  display: block;
}

.workflow-grid span {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
}

.form-panel .primary-button {
  margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f3f4;
  font-weight: 800;
}

td[contenteditable="true"] {
  background: #fffdf7;
}

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  background: #e8f2ee;
  color: var(--green);
}

.pill.warn {
  background: #fff4df;
  color: var(--amber);
}

.pill.bad {
  background: #fee4e2;
  color: var(--red);
}

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid,
  .entry-type-grid,
  .workflow-grid,
  .two-column {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #globalSearch {
    width: 100%;
  }

  .nav-tabs,
  .kpi-grid,
  .entry-type-grid,
  .workflow-grid,
  .two-column,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .entry-hero {
    align-items: stretch;
    flex-direction: column;
  }
}
