:root {
  color-scheme: light;
  --ink: #101828;
  --text: #263446;
  --muted: #66758a;
  --paper: #edf2f6;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --line: #d5dfe9;
  --line-strong: #b7c5d4;
  --nav: #101828;
  --blue: #2563a9;
  --blue-soft: #e6effc;
  --green: #24714f;
  --green-soft: #ddf4e7;
  --gold: #a66708;
  --gold-soft: #fff1d0;
  --red: #b83e38;
  --red-soft: #ffe5e2;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
label {
  font: inherit;
  letter-spacing: 0;
}

button,
input,
select {
  min-height: 44px;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid #1f5f9c;
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.trial-notice {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid #bdd2ec;
  background: #eaf2fd;
  color: #214f86;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: calc(100vh - 44px);
}

.app-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 18px 16px;
  background: var(--nav);
  color: #e8eef5;
}

.back-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  color: #c3d0dd;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.back-link::before {
  margin-right: 7px;
  content: "←";
}

.brand-block {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 15px 0 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
}

.brand-block strong,
.brand-block small {
  display: block;
}

.brand-block strong {
  font-size: 15px;
}

.brand-block small {
  margin-top: 3px;
  color: #aebdcb;
  font-size: 12px;
}

.rail-nav {
  display: grid;
  gap: 5px;
  margin-top: 18px;
}

.rail-nav a {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  border-radius: 7px;
  color: #b9c7d6;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.rail-nav a:hover,
.rail-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.build-card {
  margin-top: auto;
  padding: 13px;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
}

.build-card p {
  margin: 0 0 4px;
  color: #94a7ba;
  font-size: 10px;
  font-weight: 900;
}

.build-card p:not(:first-child) {
  margin-top: 11px;
}

.build-card code {
  color: #d8e5ef;
  font-size: 10px;
}

.app-main {
  min-width: 0;
  max-width: 1720px;
  padding: 16px 18px 34px;
}

#request-console,
#decision-console,
#package-proof {
  scroll-margin-top: 16px;
}

.app-header,
.panel,
.metric-card,
.proof-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.app-header {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(210px, auto) auto;
  gap: 16px;
  align-items: center;
  min-height: 112px;
  padding: 18px 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  font-size: 32px;
  font-weight: 900;
}

h2 {
  font-size: 20px;
  font-weight: 900;
}

.lead,
.selected-meta {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.sync-state {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 210px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(36, 113, 79, 0.14);
}

.sync-state strong,
.sync-state small {
  display: block;
}

.sync-state small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.header-actions,
.decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

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

.primary-button,
.secondary-button,
.ghost-button,
.filter-reset,
.approve-button,
.reject-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.primary-button {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 9px 20px rgba(16, 24, 40, 0.17);
}

.secondary-button {
  background: var(--blue-soft);
  color: var(--blue);
}

.ghost-button,
.filter-reset {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
}

.approve-button {
  background: var(--green-soft);
  color: var(--green);
}

.reject-button {
  background: var(--red-soft);
  color: var(--red);
}

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

.metric-card {
  position: relative;
  min-height: 82px;
  padding: 13px 16px;
  overflow: hidden;
}

.metric-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--blue);
  content: "";
}

.metric-card.pending::before {
  background: var(--gold);
}

.metric-card.complete::before,
.metric-card.approved::before {
  background: var(--green);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.metric-card strong {
  display: block;
  margin: 6px 0;
  font-size: 29px;
  line-height: 1;
}

.metric-card.pending strong {
  color: var(--gold);
}

.metric-card.complete strong,
.metric-card.approved strong {
  color: var(--green);
}

.operations-grid,
.workflow-grid {
  display: grid;
  gap: 11px;
  align-items: start;
}

.operations-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.6fr);
}

.workflow-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(370px, 0.9fr);
  margin-top: 11px;
}

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

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

.visible-count,
.local-pill,
.board-note {
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.filter-grid label,
.form-grid label,
.memo-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filter-grid label > span,
.form-grid label > span,
.memo-field > span {
  color: #4a596c;
  font-size: 11px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

table {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f1f5f9;
  color: #445368;
  font-size: 10px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.selected {
  background: #f0f6ff;
}

.select-request {
  min-height: 44px;
  padding: 0 8px;
  border-radius: 5px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.status-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.status-badge.pending {
  background: var(--gold-soft);
  color: #7c4d05;
}

.status-badge.approved {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.rejected {
  background: var(--red-soft);
  color: var(--red);
}

.empty-row {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

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

.reason-field {
  grid-column: 1 / -1;
}

.field-help {
  margin: 10px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.form-submit {
  width: 100%;
}

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

.board-column {
  min-width: 0;
  min-height: 168px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.board-column h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0 0 9px;
  color: var(--text);
  font-size: 12px;
}

.board-column h3 span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 12px;
  background: #ffffff;
  color: var(--muted);
  font-size: 10px;
}

.board-items {
  display: grid;
  gap: 7px;
}

.board-item {
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.board-item strong,
.board-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.board-item.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 169, 0.12);
}

.board-empty {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

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

.detail-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.detail-grid dt,
.detail-grid dd {
  margin: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.detail-grid dd {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.memo-field {
  margin-bottom: 10px;
}

.decision-actions > * {
  flex: 1 1 130px;
}

.proof-strip {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(320px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 11px;
  padding: 17px 19px;
  border-left: 5px solid var(--blue);
}

.proof-strip p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.proof-strip code {
  max-width: 100%;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 11px;
}

.status-message {
  min-height: 22px;
  margin: 10px 2px 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1200px) {
  .app-header {
    grid-template-columns: minmax(280px, 1fr) auto;
  }

  .header-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .operations-grid,
  .workflow-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr)) auto;
  }

  .proof-strip {
    grid-template-columns: minmax(220px, 0.7fr) minmax(280px, 1fr);
  }

  .proof-strip code {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .trial-notice {
    display: block;
    padding: 9px 12px;
    text-align: left;
  }

  .trial-notice strong,
  .trial-notice span {
    display: block;
  }

  .trial-notice span {
    margin-top: 2px;
  }

  .app-shell {
    display: block;
  }

  .app-rail {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    padding: 10px 12px 12px;
  }

  .back-link {
    min-height: 44px;
  }

  .brand-block {
    padding: 10px 0;
  }

  .rail-nav {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
  }

  .rail-nav a {
    flex: 0 0 auto;
  }

  .build-card {
    display: none;
  }

  .app-main {
    padding: 10px 10px 26px;
  }

  .app-header {
    display: block;
    padding: 16px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 18px;
  }

  .sync-state {
    margin-top: 14px;
  }

  .header-actions {
    justify-content: stretch;
    margin-top: 12px;
  }

  .header-actions > * {
    flex: 1 1 142px;
  }

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

  .metric-card {
    min-height: 78px;
  }

  .filter-grid,
  .form-grid,
  .status-board,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-reset,
  .reason-field {
    grid-column: auto;
  }

  .status-board {
    display: grid;
  }

  .board-column {
    min-height: auto;
  }

  .proof-strip {
    display: block;
    padding: 15px;
  }

  .proof-strip p:not(.eyebrow),
  .proof-strip code {
    display: block;
    margin-top: 10px;
  }
}

@media (max-width: 400px) {
  .metric-card {
    padding: 12px 13px;
  }

  .metric-card strong {
    font-size: 26px;
  }

  .panel {
    padding: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
