:root {
  --bg-0: #f3f4ef;
  --bg-1: #ffffff;
  --ink-0: #1d2433;
  --ink-1: #3a4354;
  --line: #d7dce6;
  --accent: #004f59;
  --accent-soft: #d7f1ec;
  --warn: #a23b2a;
  --urgent: #b2271d;
  --high: #d05c22;
  --normal: #1f6f58;
  --low: #4662a8;
  --shadow: 0 16px 40px rgba(20, 33, 55, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(244, 204, 97, 0.22), transparent 44%),
    radial-gradient(circle at 88% 22%, rgba(46, 149, 162, 0.2), transparent 40%),
    linear-gradient(165deg, #eef1e6 0%, #f7f8f4 42%, #ecf3f4 100%);
  color: var(--ink-0);
  font-family: "IBM Plex Sans KR", sans-serif;
}

.ambient {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 44% 56% 54% 46%;
  filter: blur(28px);
  opacity: 0.28;
  pointer-events: none;
}

.ambient-left {
  left: -90px;
  bottom: -50px;
  background: #f1b400;
}

.ambient-right {
  right: -90px;
  top: -50px;
  background: #0098a8;
}

.hero {
  max-width: 1180px;
  margin: 40px auto 18px;
  padding: 0 20px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #4d6770;
}

.hero h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.8rem, 2.4vw, 2.7rem);
  letter-spacing: -0.02em;
}

.subhead {
  margin: 10px 0 0;
  max-width: 820px;
  color: var(--ink-1);
}

.layout {
  max-width: 1180px;
  margin: 0 auto 48px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background: var(--bg-1);
  border: 1px solid rgba(90, 104, 128, 0.16);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(0, 111, 130, 0.03) 0%,
    rgba(255, 255, 255, 0) 45%,
    rgba(211, 161, 46, 0.05) 100%
  );
  pointer-events: none;
}

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

h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.08rem;
}

.meta-text {
  color: #5a6474;
  font-size: 0.85rem;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}

.badge.neutral {
  background: #f8fafb;
}

.badge.ok {
  background: var(--accent-soft);
  color: #03424c;
  border-color: #b9e4da;
}

.badge.warn {
  background: #fde8db;
  color: #8b2f17;
  border-color: #f2c6aa;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

label {
  font-size: 0.82rem;
  color: #526077;
  display: grid;
  gap: 6px;
}

.check-label {
  align-content: end;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c5cddd;
  background: #fbfcff;
  color: #1d2433;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #4e7e96;
  box-shadow: 0 0 0 3px rgba(75, 131, 168, 0.2);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  border: 1px solid #9fafc7;
  color: #2e3f59;
  background: linear-gradient(180deg, #fff 0%, #f2f6fb 100%);
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(35, 62, 96, 0.14);
}

.btn-primary {
  border-color: #00626f;
  color: #f4fffc;
  background: linear-gradient(180deg, #038294 0%, #005b67 100%);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  z-index: 1;
}

th,
td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid #e4e8f0;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  color: #5c6678;
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr.ticket-row {
  cursor: pointer;
  transition: background-color 160ms ease;
}

tr.ticket-row:hover {
  background-color: #f6f8fd;
}

tr.ticket-row.active {
  background: #e6f3f8;
}

tr.ticket-row.breached td {
  background: linear-gradient(90deg, rgba(255, 232, 224, 0.8) 0%, rgba(255, 255, 255, 0) 92%);
}

.chip {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.74rem;
  border: 1px solid transparent;
}

.chip.priority-urgent {
  background: #ffebe9;
  color: var(--urgent);
  border-color: #ffd0cb;
}

.chip.priority-high {
  background: #fff2e6;
  color: var(--high);
  border-color: #ffd4b3;
}

.chip.priority-normal {
  background: #eaf7f2;
  color: var(--normal);
  border-color: #c8eadc;
}

.chip.priority-low {
  background: #eaf0ff;
  color: var(--low);
  border-color: #cfdcff;
}

.ticket-summary {
  border: 1px dashed #c7d0e3;
  background: #f8faff;
  border-radius: 12px;
  padding: 10px;
  font-size: 0.88rem;
  color: #3f4d63;
  margin-bottom: 10px;
}

.message-list {
  display: grid;
  gap: 8px;
  max-height: 270px;
  overflow: auto;
  margin-bottom: 12px;
}

.message-item {
  border-radius: 12px;
  padding: 10px;
  border: 1px solid #d9dfeb;
}

.message-item.inbound {
  background: #f7f8ff;
}

.message-item.outbound {
  background: #eef9f7;
}

.message-head {
  font-size: 0.78rem;
  color: #5c6b82;
  margin-bottom: 4px;
}

.draft-label {
  margin-bottom: 6px;
}

.draft-editor {
  min-height: 120px;
  resize: vertical;
  margin-bottom: 10px;
}

.status-row {
  margin-bottom: 10px;
}

.status-controls {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  align-items: center;
}

#draftSelect {
  margin-bottom: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
}

.kpi-card {
  margin: 0;
  border: 1px solid #dce3ef;
  background: linear-gradient(180deg, #fcfdff 0%, #f5f8ff 100%);
  border-radius: 12px;
  padding: 10px;
}

.kpi-card p {
  margin: 0 0 6px;
  font-size: 0.74rem;
  color: #566277;
}

.kpi-card h3 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.14rem;
}

.kpi-card:nth-child(1) {
  border-top: 3px solid #2f6f8f;
}

.kpi-card:nth-child(2) {
  border-top: 3px solid #9f6c29;
}

.kpi-card:nth-child(3) {
  border-top: 3px solid #4f7b43;
}

.kpi-card:nth-child(4) {
  border-top: 3px solid #5f609e;
}

.kpi-card:nth-child(5) {
  border-top: 3px solid #a34538;
}

.kpi-card:nth-child(6) {
  border-top: 3px solid #277366;
}

.kpi-card:nth-child(7) {
  border-top: 3px solid #8a4e2b;
}

.priority-chart {
  margin-top: 12px;
  border-top: 1px solid #e7ebf3;
  padding-top: 12px;
}

.priority-chart h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.priority-bars {
  display: grid;
  gap: 8px;
}

.priority-bar-row {
  display: grid;
  grid-template-columns: 86px 1fr 56px;
  align-items: center;
  gap: 8px;
}

.priority-label {
  font-size: 0.78rem;
  color: #4d5a72;
  text-transform: capitalize;
}

.priority-bar-track {
  height: 9px;
  background: #e4e9f3;
  border-radius: 999px;
  overflow: hidden;
}

.priority-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #136672 0%, #59aeb6 100%);
}

.priority-count {
  text-align: right;
  font-size: 0.8rem;
  color: #4f5f78;
}

.alerts-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.alert-card {
  border: 1px solid #dbe3f1;
  border-radius: 12px;
  background: #fbfcff;
  padding: 10px;
}

.alert-card h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.alert-breached {
  border-color: #efc2bb;
  background: #fff6f4;
}

.alert-risk {
  border-color: #ebdcc0;
  background: #fffaf1;
}

.alert-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.alert-item {
  border: 1px solid #dfdfdf;
  border-radius: 10px;
  padding: 7px 8px;
  background: #fff;
  font-size: 0.78rem;
}

.alert-item .time {
  color: #5a6575;
}

.placeholder {
  text-align: center;
  color: #67748d;
  padding: 22px 10px;
}

.reveal {
  animation: rise 500ms ease both;
}

.reveal:nth-child(2) {
  animation-delay: 60ms;
}

.reveal:nth-child(3) {
  animation-delay: 120ms;
}

.reveal:nth-child(4) {
  animation-delay: 180ms;
}

.reveal:nth-child(5) {
  animation-delay: 240ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .control-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: 1.1fr 0.9fr;
    grid-template-areas:
      "controls controls"
      "alerts alerts"
      "inbox detail"
      "dashboard dashboard";
  }

  .controls {
    grid-area: controls;
  }

  .alerts {
    grid-area: alerts;
  }

  .inbox {
    grid-area: inbox;
  }

  .detail {
    grid-area: detail;
  }

  .dashboard {
    grid-area: dashboard;
  }
}

@media (max-width: 720px) {
  .hero {
    margin-top: 28px;
  }

  .layout {
    padding: 0 12px;
    gap: 12px;
  }

  .panel {
    padding: 12px;
  }

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