:root {
  --ink: #22212a;
  --muted: #746f7d;
  --bg: #fff9f7;
  --surface: #ffffff;
  --surface-soft: #fff0ea;
  --line: #ead9d3;
  --coral: #ff6f91;
  --coral-dark: #dd436c;
  --sky: #29b6f6;
  --mint: #8bc34a;
  --gold: #ffb74d;
  --lavender: #8e7dff;
  --shadow: 0 18px 46px rgba(91, 47, 59, 0.12);
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 111, 145, 0.18), transparent 28%),
    linear-gradient(135deg, #fff9f7 0%, #fff1f4 46%, #edf8ff 100%);
  color: var(--ink);
  font-family: var(--font);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  padding: 24px clamp(18px, 4vw, 44px) 34px;
  color: #ffffff;
  background:
    linear-gradient(115deg, rgba(34, 33, 42, 0.92), rgba(128, 70, 108, 0.74)),
    linear-gradient(135deg, var(--coral), var(--gold) 42%, var(--sky));
}

.top-nav,
.hero-content,
.toolbar,
.panel-head,
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--coral-dark);
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.brand h1,
.brand p,
.eyebrow,
.hero-card p,
.panel-head h3 {
  margin: 0;
}

.brand h1 {
  font-size: 1.22rem;
}

.brand p,
.eyebrow {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand p {
  color: rgba(255, 255, 255, 0.75);
}

.nav-actions {
  display: flex;
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.close-btn,
.status-btn {
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 850;
}

.primary-btn,
.ghost-btn {
  padding: 10px 14px;
}

.primary-btn {
  background: var(--ink);
  color: #ffffff;
}

.primary-btn:hover {
  background: var(--coral-dark);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.workspace .ghost-btn,
.case-dialog .ghost-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.hero-content {
  align-items: end;
  max-width: 1180px;
  margin: 50px auto 0;
}

.hero-content h2 {
  max-width: 780px;
  margin: 8px 0 0;
  font-size: clamp(2.1rem, 6vw, 4.8rem);
  line-height: 0.98;
}

.hero-card {
  min-width: 210px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.15);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.hero-card span {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card strong {
  display: block;
  margin: 8px 0;
  font-size: 3rem;
}

.hero-card p {
  color: rgba(255, 255, 255, 0.76);
}

.workspace {
  width: min(1220px, calc(100% - 32px));
  margin: -24px auto 42px;
  display: grid;
  gap: 18px;
}

.toolbar,
.metric-card,
.lane,
.panel,
.case-dialog form,
.drawer-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.toolbar {
  padding: 16px;
}

.search-wrap {
  flex: 1;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

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

textarea {
  resize: vertical;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 16px;
  border-top: 4px solid var(--coral);
}

.metric-card:nth-child(2) {
  border-top-color: var(--gold);
}

.metric-card:nth-child(3) {
  border-top-color: var(--sky);
}

.metric-card:nth-child(4) {
  border-top-color: var(--mint);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
}

.metric-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.lane {
  min-height: 420px;
  padding: 12px;
}

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

.lane h3 {
  margin: 0;
  font-size: 0.95rem;
}

.lane header span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--coral-dark);
  font-weight: 900;
}

.case-list {
  display: grid;
  gap: 10px;
}

.case-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 13px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(91, 47, 59, 0.14);
}

.case-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--sky);
}

.case-card.priority-high::before {
  background: var(--gold);
}

.case-card.priority-urgent::before {
  background: var(--coral);
}

.card-topline,
.card-tags,
.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-topline {
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
}

.card-topline strong {
  color: var(--coral-dark);
}

.case-card h4 {
  margin: 10px 0 6px;
  font-size: 0.95rem;
}

.case-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.card-tags {
  flex-wrap: wrap;
  margin: 12px 0;
}

.card-tags span,
.detail-tags span,
.priority-pill {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--coral-dark);
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 850;
}

.card-footer {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.card-footer span:last-child {
  margin-left: auto;
}

.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--owner-color);
  color: #ffffff;
}

.empty-lane {
  margin: 0;
  color: var(--muted);
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel .eyebrow {
  color: var(--coral-dark);
}

.workload-list {
  display: grid;
  gap: 14px;
}

.workload-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.workload-item strong,
.workload-item span {
  display: block;
}

.workload-item span,
.workload-item em {
  color: var(--muted);
  font-style: normal;
}

.load-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.load-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

#api-output {
  min-height: 300px;
  overflow: auto;
  border-radius: var(--radius);
  background: #22212a;
  color: #fff1f4;
  padding: 14px;
  line-height: 1.55;
}

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(460px, 100%);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 20;
  pointer-events: none;
}

.detail-drawer.open {
  transform: translateX(0);
  pointer-events: auto;
}

.drawer-shell {
  height: 100%;
  overflow: auto;
  border-radius: 0;
  background: #ffffff;
  box-shadow: -24px 0 60px rgba(34, 33, 42, 0.22);
  padding: 22px;
}

.close-btn {
  width: 34px;
  height: 34px;
  background: var(--surface-soft);
  color: var(--ink);
}

.drawer-shell > .close-btn {
  float: right;
}

#case-detail h3 {
  margin: 8px 0 6px;
  font-size: 1.7rem;
}

.detail-customer {
  color: var(--muted);
}

.detail-tags,
.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#case-detail section {
  clear: both;
  margin-top: 22px;
}

#case-detail h4 {
  margin: 0 0 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
}

.status-btn {
  background: var(--ink);
  color: #ffffff;
  padding: 9px 10px;
}

.status-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list article {
  border-left: 3px solid var(--coral);
  background: var(--surface-soft);
  padding: 10px;
}

.activity-list p {
  margin: 0 0 4px;
}

.activity-list span {
  color: var(--muted);
  font-size: 0.78rem;
}

.case-dialog {
  width: min(540px, calc(100vw - 32px));
  border: 0;
  background: transparent;
  padding: 0;
}

.case-dialog::backdrop {
  background: rgba(34, 33, 42, 0.48);
}

.case-dialog form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.case-dialog h3 {
  margin: 4px 0 0;
}

.case-dialog .eyebrow {
  color: var(--coral-dark);
}

.dialog-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  padding: 12px 16px;
  font-weight: 850;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1060px) {
  .board,
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .top-nav,
  .hero-content,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-actions,
  .control-row,
  .metrics,
  .board,
  .lower-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .nav-actions {
    display: grid;
  }

  .hero-content {
    margin-top: 34px;
  }

  .hero-card {
    min-width: 0;
  }

  .workspace {
    width: min(100% - 20px, 1220px);
  }

  .lane {
    min-height: auto;
  }

  .workload-item {
    grid-template-columns: 1fr;
  }
}
