:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #647067;
  --line: #dce4de;
  --paper: #ffffff;
  --canvas: #f3f6f3;
  --green: #096b48;
  --green-dark: #07543a;
  --green-soft: #e8f5ee;
  --navy: #101b2a;
  --danger: #a32727;
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  min-width: 320px;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

.page-shell { min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  color: #fff;
  background: var(--navy);
  border-bottom: 4px solid var(--green);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; }
.brand small { margin-top: 3px; color: #b9c7bf; font-size: 12px; }
.master-link { color: #dce8e1; font-size: 13px; text-underline-offset: 4px; }

main { width: min(1220px, calc(100% - 32px)); margin: 38px auto 72px; flex: 1; }

.auth-card {
  width: min(540px, 100%);
  margin: 8vh auto 0;
  padding: clamp(28px, 5vw, 46px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 20px 55px rgba(22, 41, 29, .08);
}

.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 900; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: 23px; letter-spacing: -.035em; }
h3 { margin: 26px 0 12px; font-size: 16px; }
.auth-description, .panel-heading p { color: var(--muted); line-height: 1.72; }

.account-rule {
  display: grid;
  gap: 6px;
  margin: 24px 0;
  padding: 17px 18px;
  border: 1px solid #cfe3d8;
  border-radius: 12px;
  background: var(--green-soft);
}
.account-rule span { color: var(--muted); font-size: 12px; }
.account-rule strong { overflow-wrap: anywhere; font-size: 15px; }

.primary-button, .secondary-button {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 800;
  transition: background .15s ease, border-color .15s ease;
}
.primary-button { width: 100%; border: 1px solid var(--green); color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.link-button { display: grid; place-items: center; text-decoration: none; }
.primary-button.compact { width: auto; align-self: end; }
.secondary-button { border: 1px solid #bdcbc1; color: var(--ink); background: #fff; }
.secondary-button:hover { border-color: var(--green); color: var(--green); }

.status-message { min-height: 22px; margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.status-message.is-error { color: var(--danger); font-weight: 700; }
.status-message.is-success { color: var(--green); font-weight: 700; }

.viewer-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 20px; }
.viewer-account { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.security-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 15px 18px;
  color: #d7e2dc;
  background: var(--navy);
  border-radius: 12px;
  font-size: 13px;
}
.security-strip strong { color: #fff; }
.security-mask { margin-left: auto; color: #aab8b0; }

.tabs { display: flex; gap: 8px; margin: 22px 0 14px; border-bottom: 1px solid var(--line); }
.tab-button {
  min-width: 112px;
  padding: 13px 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}
.tab-button.is-active { color: var(--green); border-bottom-color: var(--green); }

.panel { padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.panel-heading p { margin-bottom: 0; font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.metric-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.metric-card span, .metric-card strong { display: block; }
.metric-card span { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 21px; letter-spacing: -.03em; }

.search-field { display: grid; grid-template-columns: auto minmax(180px, 360px); align-items: center; justify-content: end; gap: 10px; margin: 18px 0 8px; font-size: 13px; font-weight: 700; }
input {
  width: 100%;
  height: 42px;
  border: 1px solid #cbd6ce;
  border-radius: 9px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}
input:focus { outline: 3px solid rgba(9, 107, 72, .13); border-color: var(--green); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #526057; background: #f7f9f7; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.product-name { display: grid; gap: 4px; min-width: 220px; white-space: normal; }
.product-name small { color: var(--muted); }
.status-chip { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
.status-chip.is-off { color: #7a4c20; background: #fff2df; }
.empty-row { padding: 38px 16px; color: var(--muted); text-align: center; }

.date-form { display: grid; grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto; gap: 12px; align-items: end; margin: 24px 0 10px; }
.date-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(18px, 4vw, 56px);
  color: #7c8981;
  background: #e8ede9;
  font-size: 12px;
}

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header { min-height: 68px; }
  .master-link { display: none; }
  main { width: min(100% - 20px, 1220px); margin-top: 20px; }
  .auth-card { margin-top: 5vh; border-radius: 16px; }
  .viewer-heading, .panel-heading { align-items: stretch; }
  .viewer-heading { flex-direction: column; }
  .viewer-heading .secondary-button { width: 100%; }
  .security-mask { width: 100%; margin-left: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field { grid-template-columns: 1fr; justify-content: stretch; }
  .date-form { grid-template-columns: 1fr 1fr; }
  .date-form .primary-button { grid-column: 1 / -1; }
  .split-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .brand small { display: none; }
  .panel { padding: 16px 12px; }
  .tabs .tab-button { flex: 1; min-width: 0; }
  .metric-grid { gap: 8px; }
  .metric-card { padding: 14px 12px; }
  .metric-card strong { font-size: 18px; }
  .date-form { grid-template-columns: 1fr; }
  .date-form .primary-button { grid-column: auto; }
}
