:root {
  color-scheme: light;
  --navy-950: #0a162b;
  --navy-900: #102342;
  --navy-850: #132a4f;
  --navy-800: #18365f;
  --blue-700: #2468d7;
  --blue-600: #2f80ed;
  --blue-500: #4a90f3;
  --blue-100: #eaf3ff;
  --teal-600: #0d9f8b;
  --teal-100: #e8f8f5;
  --green-600: #138a57;
  --green-100: #e8f7ef;
  --amber-700: #a56000;
  --amber-100: #fff4db;
  --red-700: #bd2c2c;
  --red-100: #fff0f0;
  --purple-700: #6c43c0;
  --purple-100: #f2edff;
  --ink-950: #141b27;
  --ink-800: #293447;
  --ink-700: #465168;
  --ink-600: #687386;
  --ink-500: #8791a2;
  --line-300: #d8deea;
  --line-200: #e7ebf2;
  --line-100: #f0f3f8;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --shadow-sm: 0 4px 12px rgba(18, 39, 72, 0.06);
  --shadow-md: 0 12px 30px rgba(18, 39, 72, 0.10);
  --shadow-lg: 0 24px 70px rgba(7, 22, 47, 0.22);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar-width: 264px;
  --topbar-height: 86px;
  font-family:
    Pretendard, "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--canvas);
  color: var(--ink-950);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
}

.auth-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 32px 18px;
  background:
    radial-gradient(circle at 12% 12%, rgba(47, 128, 237, 0.20), transparent 34%),
    radial-gradient(circle at 88% 76%, rgba(13, 159, 139, 0.18), transparent 34%),
    linear-gradient(145deg, #08152a, #102a51 56%, #0b3c52);
}

.auth-background::before,
.auth-background::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.auth-background::before {
  width: 620px;
  height: 620px;
  top: -260px;
  right: -160px;
}

.auth-background::after {
  width: 420px;
  height: 420px;
  bottom: -190px;
  left: -100px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

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

.auth-brand strong,
.sidebar-brand strong {
  display: block;
  letter-spacing: -0.02em;
}

.auth-brand strong {
  font-size: 20px;
}

.auth-brand span {
  display: block;
  margin-top: 1px;
  color: var(--ink-600);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--blue-600), var(--teal-600));
  box-shadow: 0 9px 22px rgba(47, 128, 237, 0.28);
  color: white;
  font-size: 25px;
  font-weight: 850;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 21px;
}

.auth-heading {
  margin: 36px 0 26px;
}

.eyebrow {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.auth-heading h1 {
  margin: 12px 0 7px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.auth-heading p {
  margin: 0;
  color: var(--ink-600);
}

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form label,
.form-field {
  display: grid;
  gap: 7px;
}

.stack-form label > span,
.form-field > span,
.field-label {
  color: var(--ink-800);
  font-size: 13px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-300);
  border-radius: 9px;
  outline: none;
  background: white;
  color: var(--ink-950);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input,
select {
  padding: 0 12px;
}

textarea {
  min-height: 98px;
  padding: 11px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.13);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f3f5f8;
  color: var(--ink-500);
  cursor: not-allowed;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red-700);
  font-size: 13px;
}

.auth-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-200);
  color: var(--ink-600);
  font-size: 12px;
}

.notice-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal-600);
  box-shadow: 0 0 0 4px rgba(13, 159, 139, 0.12);
}

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

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 0 0, rgba(47, 128, 237, 0.18), transparent 34%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: white;
}

.sidebar-brand {
  height: var(--topbar-height);
  flex: 0 0 auto;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong {
  font-size: 14px;
  letter-spacing: 0.05em;
}

.sidebar-brand span {
  display: block;
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.primary-nav {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 4px;
  overflow-y: auto;
  padding: 20px 14px;
}

.nav-section-label {
  margin: 13px 12px 6px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.70);
  text-align: left;
  transition: 0.16s ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.nav-item span {
  font-size: 13px;
  font-weight: 650;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: white;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(47, 128, 237, 0.32), rgba(47, 128, 237, 0.13));
  color: white;
  box-shadow: inset 3px 0 0 var(--blue-500);
}

.nav-item-badge {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.74);
  font-size: 10px !important;
  text-align: center;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.system-mode-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
}

.system-mode-card strong,
.system-mode-card span {
  display: block;
}

.system-mode-card strong {
  font-size: 11px;
}

.system-mode-card span {
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.50);
  font-size: 10px;
}

.system-pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #42d5ba;
  box-shadow: 0 0 0 5px rgba(66, 213, 186, 0.12);
}

.sidebar-logout {
  width: 100%;
  margin-top: 9px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.sidebar-backdrop {
  display: none;
}

.main-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 30px;
  border-bottom: 1px solid var(--line-200);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-actions,
.user-chip {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  color: var(--ink-950);
  font-size: 20px;
  letter-spacing: -0.035em;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--ink-600);
  font-size: 12px;
}

.topbar-actions {
  gap: 17px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid #b6e7dd;
  border-radius: 999px;
  background: var(--teal-100);
  color: #087866;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.mode-badge > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-600);
}

.user-chip {
  gap: 9px;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #dfeaff, #c5d8ff);
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 800;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip strong {
  font-size: 12px;
}

.user-chip span {
  color: var(--ink-500);
  font-size: 10px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-200);
  border-radius: 9px;
  background: white;
  color: var(--ink-700);
}

.icon-button:hover {
  border-color: #bfd1ef;
  background: var(--blue-100);
  color: var(--blue-700);
}

.mobile-only {
  display: none;
}

.security-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 18px 30px 0;
  padding: 12px 15px;
  border: 1px solid #f4d99c;
  border-radius: 10px;
  background: var(--amber-100);
  color: #7d4b03;
}

.security-banner-icon {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #e6a623;
  color: white;
  font-weight: 850;
}

.security-banner strong,
.security-banner span {
  display: block;
}

.security-banner strong {
  font-size: 12px;
}

.security-banner span {
  margin-top: 1px;
  font-size: 11px;
}

.page-content {
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px 30px 48px;
}

.page-loading {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  gap: 13px;
  color: var(--ink-500);
}

.spinner {
  width: 29px;
  height: 29px;
  border: 3px solid #dbe4f1;
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header-row h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.page-header-row p {
  margin: 3px 0 0;
  color: var(--ink-600);
  font-size: 12px;
}

.page-actions,
.button-row,
.filter-row,
.inline-fields,
.card-header,
.card-footer,
.table-toolbar {
  display: flex;
  align-items: center;
}

.page-actions,
.button-row {
  gap: 9px;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
  transition: 0.15s ease;
}

.button svg {
  width: 16px;
  height: 16px;
}

.button-primary {
  border-color: var(--blue-600);
  background: var(--blue-600);
  color: white;
  box-shadow: 0 5px 12px rgba(47, 128, 237, 0.18);
}

.button-primary:hover {
  border-color: #236fd8;
  background: #236fd8;
}

.button-secondary {
  border-color: var(--line-300);
  background: white;
  color: var(--ink-800);
}

.button-secondary:hover {
  border-color: #b9c9df;
  background: #f8faff;
}

.button-danger {
  border-color: #efbcbc;
  background: var(--red-100);
  color: var(--red-700);
}

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--blue-700);
}

.button-small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.button-block {
  width: 100%;
  min-height: 46px;
}

.button:disabled {
  border-color: var(--line-200);
  background: #eff2f6;
  box-shadow: none;
  color: var(--ink-500);
  cursor: not-allowed;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  min-height: 58px;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-200);
}

.card-header h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.card-header p {
  margin: 2px 0 0;
  color: var(--ink-600);
  font-size: 11px;
}

.card-body {
  padding: 18px;
}

.card-body.flush {
  padding: 0;
}

.card-footer {
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-200);
  background: #fafbfd;
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 135px;
  padding: 18px;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-sm);
}

.metric-card::after {
  position: absolute;
  width: 90px;
  height: 90px;
  right: -30px;
  bottom: -40px;
  content: "";
  border-radius: 50%;
  background: var(--metric-soft, var(--blue-100));
}

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

.metric-label {
  color: var(--ink-600);
  font-size: 12px;
  font-weight: 650;
}

.metric-icon {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 10px;
  background: var(--metric-soft, var(--blue-100));
  color: var(--metric-color, var(--blue-700));
}

.metric-icon svg {
  width: 17px;
  height: 17px;
}

.metric-value {
  position: relative;
  z-index: 1;
  margin-top: 17px;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.metric-caption {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

.lifecycle-bars {
  display: grid;
  gap: 14px;
}

.lifecycle-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
}

.lifecycle-label {
  color: var(--ink-700);
  font-size: 11px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f6;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color, var(--blue-600));
}

.lifecycle-count {
  color: var(--ink-700);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.insight-panel {
  display: grid;
  min-height: 100%;
  align-content: space-between;
  gap: 18px;
  padding: 21px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0, rgba(65, 168, 255, 0.28), transparent 38%),
    linear-gradient(145deg, #11294d, #163967);
  box-shadow: var(--shadow-md);
  color: white;
}

.insight-panel .eyebrow {
  background: rgba(255, 255, 255, 0.12);
  color: #b9dcff;
}

.insight-panel h3 {
  margin: 12px 0 8px;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: -0.035em;
}

.insight-panel p {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.insight-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.insight-stat {
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.insight-stat strong,
.insight-stat span {
  display: block;
}

.insight-stat strong {
  font-size: 17px;
}

.insight-stat span {
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 9px;
}

.insight-panel .button {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.18);
  background: white;
  color: var(--navy-900);
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-200);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #f9fafc;
  color: var(--ink-600);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.data-table td {
  color: var(--ink-800);
  font-size: 11px;
}

.data-table tbody tr:hover {
  background: #fbfcff;
}

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

.product-cell {
  display: flex;
  max-width: 350px;
  align-items: center;
  gap: 10px;
  white-space: normal;
}

.product-thumb {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #e8f0ff, #e6f8f4);
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 850;
}

.product-cell strong,
.product-cell span {
  display: block;
}

.product-cell strong {
  overflow: hidden;
  color: var(--ink-950);
  font-size: 11px;
  text-overflow: ellipsis;
}

.product-cell span {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 9px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.text-right {
  text-align: right !important;
}

.text-center {
  text-align: center !important;
}

.muted {
  color: var(--ink-500) !important;
}

.positive {
  color: var(--green-600) !important;
}

.negative {
  color: var(--red-700) !important;
}

.status-chip,
.grade-chip,
.market-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.status-chip {
  padding: 5px 8px;
  background: #eef2f7;
  color: var(--ink-700);
}

.status-chip.green {
  background: var(--green-100);
  color: var(--green-600);
}

.status-chip.blue {
  background: var(--blue-100);
  color: var(--blue-700);
}

.status-chip.amber {
  background: var(--amber-100);
  color: var(--amber-700);
}

.status-chip.red {
  background: var(--red-100);
  color: var(--red-700);
}

.status-chip.purple {
  background: var(--purple-100);
  color: var(--purple-700);
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.grade-chip {
  min-width: 26px;
  justify-content: center;
  padding: 5px 7px;
  background: var(--ink-950);
  color: white;
}

.grade-chip.grade-s {
  background: linear-gradient(145deg, #0d9f8b, #0a7e6e);
}

.grade-chip.grade-a {
  background: var(--blue-700);
}

.grade-chip.grade-b {
  background: var(--purple-700);
}

.grade-chip.grade-c {
  background: var(--amber-700);
}

.grade-chip.grade-d {
  background: var(--red-700);
}

.market-chip {
  padding: 5px 8px;
  background: #f1f3f7;
  color: var(--ink-700);
}

.list-compact {
  display: grid;
}

.compact-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-200);
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-row-main {
  min-width: 0;
}

.compact-row-main strong,
.compact-row-main span {
  display: block;
}

.compact-row-main strong {
  overflow: hidden;
  color: var(--ink-800);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-row-main span {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 9px;
}

.score-ring {
  display: grid;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  place-items: center;
  border: 4px solid var(--ring-color, var(--blue-600));
  border-radius: 50%;
  color: var(--ink-800);
  font-size: 10px;
  font-weight: 850;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 30px;
  color: var(--ink-500);
  text-align: center;
}

.empty-state-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--line-100);
  color: var(--ink-500);
}

.empty-state h3 {
  margin: 5px 0 0;
  color: var(--ink-800);
  font-size: 13px;
}

.empty-state p {
  max-width: 360px;
  margin: 0;
  font-size: 11px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 18px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-help {
  color: var(--ink-500);
  font-size: 10px;
}

.input-with-unit {
  position: relative;
}

.input-with-unit input {
  padding-right: 48px;
  text-align: right;
}

.input-with-unit span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--ink-500);
  font-size: 10px;
  transform: translateY(-50%);
  pointer-events: none;
}

.checkbox-row,
.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-row input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--blue-600);
}

.checkbox-row label {
  color: var(--ink-800);
  font-size: 11px;
  font-weight: 650;
}

.delta-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.delta-inline input {
  width: 72px;
  min-height: 34px;
  padding: 0 8px;
  text-align: center;
}

.delta-inline span {
  color: var(--ink-500);
  font-size: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cdd4df;
  transition: 0.18s ease;
}

.switch-slider::before {
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  content: "";
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: 0.18s ease;
}

.switch input:checked + .switch-slider {
  background: var(--blue-600);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.switch-copy strong,
.switch-copy span {
  display: block;
}

.switch-copy strong {
  font-size: 11px;
}

.switch-copy span {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 9px;
}

.margin-note {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  color: #ef3f3f;
  font-size: 11px;
}

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

.margin-table th,
.margin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-200);
}

.margin-table th {
  background: #fafbfd;
  color: var(--ink-600);
  font-size: 10px;
  font-weight: 800;
  text-align: left;
}

.margin-table td {
  color: var(--ink-800);
  font-size: 11px;
}

.margin-table td:first-child,
.margin-table th:first-child {
  width: 50px;
  text-align: center;
}

.margin-table td:nth-child(3),
.margin-table th:nth-child(3) {
  width: 150px;
}

.margin-rate-input {
  max-width: 88px;
  text-align: right;
}

.calculation-card {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

.calculation-result {
  display: grid;
  gap: 11px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid #c7dbf7;
  border-radius: 11px;
  background: linear-gradient(145deg, #f5f9ff, #f2fbf9);
}

.calculation-price {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.calculation-price span {
  color: var(--ink-600);
  font-size: 10px;
}

.calculation-price strong {
  color: var(--blue-700);
  font-size: 25px;
  letter-spacing: -0.04em;
}

.result-list {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid rgba(47, 128, 237, 0.14);
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-600);
  font-size: 10px;
}

.result-row strong {
  color: var(--ink-800);
}

.info-callout,
.warning-callout,
.success-callout {
  display: flex;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 11px;
}

.info-callout {
  border: 1px solid #c7dbf7;
  background: var(--blue-100);
  color: #255a9c;
}

.warning-callout {
  border: 1px solid #f1d38a;
  background: var(--amber-100);
  color: #7d4b03;
}

.success-callout {
  border: 1px solid #bce5d1;
  background: var(--green-100);
  color: #126a45;
}

.callout-icon {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 850;
}

.callout-copy strong,
.callout-copy span {
  display: block;
}

.callout-copy span {
  margin-top: 2px;
  opacity: 0.83;
}

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

.market-card {
  display: grid;
  min-height: 206px;
  align-content: space-between;
  padding: 18px;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.market-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.market-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-logo {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border: 1px solid var(--line-200);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--market-color, var(--blue-700));
  font-size: 13px;
  font-weight: 900;
}

.market-card h3 {
  margin: 15px 0 3px;
  font-size: 14px;
}

.market-card p {
  margin: 0;
  color: var(--ink-500);
  font-size: 10px;
}

.market-meta {
  display: grid;
  gap: 6px;
  margin: 15px 0;
  padding: 10px 0;
  border-top: 1px solid var(--line-200);
  border-bottom: 1px solid var(--line-200);
}

.market-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 9px;
}

.market-meta-row span:first-child {
  color: var(--ink-500);
}

.market-meta-row span:last-child {
  overflow: hidden;
  max-width: 160px;
  color: var(--ink-700);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-card-actions {
  display: flex;
  gap: 7px;
}

.market-card-actions .button {
  flex: 1;
}

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

.rule-card {
  padding: 14px;
  border: 1px solid var(--line-200);
  border-radius: 10px;
  background: #fbfcfe;
}

.rule-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.rule-number {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 850;
}

.rule-card h4 {
  margin: 0;
  font-size: 11px;
}

.rule-card p {
  margin: 0;
  color: var(--ink-500);
  font-size: 9px;
}

.table-toolbar {
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-200);
  background: #fbfcfe;
}

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

.search-box {
  position: relative;
  width: min(280px, 100%);
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--ink-500);
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 34px;
}

.compact-select {
  width: auto;
  min-width: 130px;
}

.table-summary {
  color: var(--ink-500);
  font-size: 10px;
}

.score-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.score-bar-mini {
  width: 46px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.score-bar-mini > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue-600);
}

.job-message {
  max-width: 430px;
  overflow: hidden;
  color: var(--ink-600);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 12px 0;
}

.timeline-item:not(:last-child)::before {
  position: absolute;
  width: 1px;
  top: 34px;
  bottom: -2px;
  left: 10px;
  content: "";
  background: var(--line-200);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 4px solid var(--blue-100);
  border-radius: 50%;
  background: var(--blue-600);
}

.timeline-main strong,
.timeline-main span {
  display: block;
}

.timeline-main strong {
  color: var(--ink-800);
  font-size: 11px;
}

.timeline-main span {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 9px;
}

.timeline-time {
  color: var(--ink-500);
  font-size: 9px;
}

.guide-steps {
  display: grid;
  gap: 12px;
}

.guide-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line-200);
  border-radius: 11px;
  background: white;
}

.guide-step-number {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 850;
}

.guide-step h3,
.guide-step p {
  margin: 0;
}

.guide-step h3 {
  font-size: 12px;
}

.guide-step p {
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 10px;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 16, 32, 0.58);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-lg);
}

.modal.wide {
  width: min(760px, 100%);
}

.modal-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line-200);
  background: rgba(255, 255, 255, 0.97);
}

.modal-header h2 {
  margin: 0;
  font-size: 15px;
}

.modal-header p {
  margin: 2px 0 0;
  color: var(--ink-500);
  font-size: 10px;
}

.modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #f1f4f8;
  color: var(--ink-600);
}

.modal-body {
  padding: 19px;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 19px;
  border-top: 1px solid var(--line-200);
  background: rgba(255, 255, 255, 0.97);
}

.toast-container {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 9px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line-200);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease-out;
}

.toast-icon {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 850;
}

.toast.success .toast-icon {
  background: var(--green-100);
  color: var(--green-600);
}

.toast.error .toast-icon {
  background: var(--red-100);
  color: var(--red-700);
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  color: var(--ink-800);
  font-size: 11px;
}

.toast span {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 9px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.skeleton {
  min-height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef1f5, #f8f9fb, #eef1f5);
  background-size: 200% 100%;
  animation: skeleton 1.3s infinite;
}

@keyframes skeleton {
  to {
    background-position: -200% 0;
  }
}

.only-desktop {
  display: inline-flex;
}

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

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

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

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: none;
    border: 0;
    background: rgba(7, 16, 32, 0.48);
  }

  .sidebar-backdrop.visible {
    display: block;
  }

  .main-shell {
    margin-left: 0;
  }

  .mobile-only {
    display: inline-grid;
  }

  .dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .calculation-card {
    position: static;
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-height: 74px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar p,
  .user-chip > div:not(.avatar),
  .mode-badge {
    display: none;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .security-banner {
    margin: 12px 14px 0;
  }

  .page-content {
    padding: 18px 14px 36px;
  }

  .page-header-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .button {
    flex: 1;
  }

  .metric-grid,
  .dashboard-lower-grid,
  .marketplace-grid,
  .rule-grid,
  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

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

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row,
  .search-box,
  .compact-select {
    width: 100%;
  }

  .market-card {
    min-height: 190px;
  }

  .guide-step {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .guide-step > :last-child {
    grid-column: 2;
  }

  .only-desktop {
    display: none;
  }

  .auth-card {
    padding: 28px 22px;
  }
}

@media (max-width: 480px) {
  .metric-grid {
    gap: 10px;
  }

  .metric-value {
    font-size: 23px;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .margin-table th,
  .margin-table td {
    padding: 9px 8px;
  }

  .margin-table td:nth-child(3),
  .margin-table th:nth-child(3) {
    width: 96px;
  }
}
