:root {
  color-scheme: light;
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-soft: #eef6f1;
  --ink: #17211b;
  --muted: #647168;
  --line: #d9e5dc;
  --line-strong: #b8c9bd;
  --green: #13795f;
  --green-dark: #0b5745;
  --mint: #dff6ed;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #c2410c;
  --shadow: 0 18px 45px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  background:
    linear-gradient(180deg, #eaf4ee 0, var(--bg) 300px),
    var(--bg);
  color: var(--ink);
}

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

.shell {
  width: min(1560px, calc(100vw - 24px));
  margin: 12px auto 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 2px solid var(--green);
  border-radius: 14px;
  background: var(--mint);
}

.mark::before {
  content: "";
  position: absolute;
  inset: 9px 10px 11px;
  border: 2px solid var(--green);
  border-top: 0;
  border-radius: 0 0 7px 7px;
}

.mark::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-left: 2px solid var(--green);
  border-top: 2px solid var(--green);
  transform: rotate(45deg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(25px, 2.2vw, 34px);
  line-height: 1;
  letter-spacing: 0;
}

.brand p,
.muted {
  color: var(--muted);
}

.status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbf9;
  padding: 8px 10px;
  color: #334139;
  font-weight: 700;
}

.status span:first-child {
  border-color: #a6d9c7;
  background: var(--mint);
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr) minmax(0, 0.95fr);
  gap: 12px;
  margin-top: 12px;
}

.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-bottom: 14px;
  font-size: 19px;
}

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

.panel-head h2 {
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: #24332b;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fbfdfb;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(19, 121, 95, 0.14);
}

button {
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #f8fbf9;
  color: var(--ink);
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  overflow-wrap: anywhere;
}

button:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.primary,
#import-btn,
#copy-bundle {
  width: 100%;
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.primary:hover,
#import-btn:hover,
#copy-bundle:hover {
  background: var(--green-dark);
  color: #ffffff;
}

.preview,
.packet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.preview {
  min-height: 130px;
  padding: 13px;
  margin: 10px 0 14px;
}

.preview p {
  margin: 8px 0;
  color: #405047;
  line-height: 1.45;
}

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

.packet {
  min-height: 150px;
  padding: 14px;
  border-left: 5px solid var(--blue);
  background: #ffffff;
}

.packet[data-priority="Critical"] {
  border-left-color: var(--red);
}

.packet[data-priority="High"] {
  border-left-color: var(--amber);
}

.packet h3 {
  margin: 10px 0 7px;
  font-size: 19px;
}

.packet p {
  color: #405047;
  line-height: 1.42;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #a6d9c7;
  border-radius: 5px;
  background: var(--mint);
  color: var(--green-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.priority {
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.Critical {
  border: 1px solid #f3b9a8;
  background: #fff1ed;
  color: var(--red);
}

.High {
  border: 1px solid #f0c38d;
  background: #fff7ed;
  color: var(--amber);
}

.Medium {
  border: 1px solid #d6c35f;
  background: #fffbea;
  color: #836b00;
}

.Low {
  border: 1px solid #b7c9f8;
  background: #eff5ff;
  color: var(--blue);
}

.timeline-title {
  margin-top: 18px;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.timeline li {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.timeline span:first-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.side {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.export-actions {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

#bundle-preview {
  max-width: 100%;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: #334139;
  background: #f8fbf9;
}

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

  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1400px) and (min-width: 1041px) {
  .grid {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }

  .side {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 16px, 520px);
    margin-top: 8px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    justify-content: flex-start;
  }

  .status span {
    padding: 7px 9px;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
