:root {
  --bg: #eef4fb;
  --bg-strong: #e3edf9;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-soft: rgba(248, 251, 255, 0.98);
  --panel-dark: #0f2743;
  --line: #d8e4f2;
  --line-strong: #c3d4e7;
  --text: #17304e;
  --muted: #647a94;
  --heading: #10253d;
  --blue-900: #0f2743;
  --blue-700: #1d5fa8;
  --blue-600: #2b6db6;
  --blue-500: #3e84cf;
  --blue-100: #dbeafe;
  --blue-050: #f3f8fe;
  --danger: #bf4f5e;
  --success: #22836a;
  --warn: #b67a1d;
  --shadow-lg: 0 28px 60px rgba(22, 50, 84, 0.16);
  --shadow-md: 0 16px 34px rgba(20, 44, 74, 0.1);
  --shadow-sm: 0 10px 24px rgba(20, 44, 74, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(62, 132, 207, 0.16), transparent 28%),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
}

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

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  box-shadow: 0 10px 24px rgba(43, 109, 182, 0.18);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(43, 109, 182, 0.24);
}

button.ghost,
button.subtle {
  color: var(--blue-700);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.danger {
  background: linear-gradient(135deg, #9e4250, var(--danger));
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(43, 109, 182, 0.45);
  box-shadow: 0 0 0 4px rgba(62, 132, 207, 0.12);
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-screen {
  min-height: 100vh;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(62, 132, 207, 0.18), transparent 28%),
    linear-gradient(135deg, #0f2743 0%, #19375d 50%, #0d2238 100%);
}

.auth-frame {
  width: min(1400px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 480px;
  gap: 28px;
  align-items: stretch;
}

.auth-brand-panel,
.auth-form-panel {
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-brand-panel {
  padding: 40px;
  color: #f7fbff;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(15, 39, 67, 0.82), rgba(7, 21, 37, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.auth-kicker,
.section-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-kicker {
  color: rgba(247, 251, 255, 0.58);
}

.section-kicker {
  color: var(--blue-600);
}

.auth-brand-panel h1 {
  margin: 0;
  font-size: clamp(42px, 4vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.auth-brand-copy {
  margin: 0;
  max-width: 700px;
  font-size: 16px;
  line-height: 1.85;
  color: rgba(247, 251, 255, 0.76);
}

.auth-brand-grid {
  margin-top: auto;
  display: grid;
  gap: 16px;
}

.brand-data-card {
  padding: 20px 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-data-card span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.54);
}

.brand-data-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  color: #fff;
}

.brand-data-card p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(247, 251, 255, 0.7);
}

.auth-form-panel {
  padding: 22px;
  background: rgba(250, 252, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.85);
  display: grid;
  gap: 18px;
  align-content: start;
}

.auth-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--blue-050);
  border: 1px solid var(--line);
}

.auth-mode-btn {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.auth-mode-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
}

.auth-card {
  padding: 28px;
  border-radius: 26px;
  background: #fff;
  border: 1px solid rgba(221, 231, 241, 0.92);
  box-shadow: var(--shadow-md);
}

.auth-card-hidden {
  display: none;
}

.card-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.card-heading h2,
.card-heading p {
  margin: 0;
}

.card-heading h2 {
  font-size: 28px;
  line-height: 1.15;
  color: var(--heading);
}

.card-heading p:last-child {
  color: var(--muted);
  line-height: 1.72;
}

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

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

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

.form-grid.compact {
  gap: 14px;
}

.action-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.quick-role-list {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feedback-banner,
.feedback-note {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--blue-050);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.7;
}

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

.app-hidden {
  display: none !important;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    linear-gradient(180deg, #0f2743, #133257 55%, #102842);
  color: #f5f9fe;
  display: grid;
  gap: 20px;
  align-content: start;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h2,
.sidebar-brand p,
.sidebar-user-card strong,
.sidebar-user-card p,
.sidebar-footnote strong,
.sidebar-footnote span {
  margin: 0;
}

.sidebar-brand h2 {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1.12;
}

.sidebar-copy,
.sidebar-user-card p {
  color: rgba(245, 249, 254, 0.68);
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.sidebar-user-card,
.sidebar-footnote {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-card span,
.sidebar-footnote span,
.sidebar-nav-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 249, 254, 0.58);
}

.sidebar-user-card strong,
.sidebar-footnote strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sidebar-nav-links {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.side-nav-link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 18px;
  text-decoration: none;
  color: rgba(245, 249, 254, 0.88);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  gap: 16px;
}

.side-nav-link:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.side-nav-link span,
.side-nav-link small {
  overflow-wrap: anywhere;
}

.side-nav-link span {
  flex: 1 1 auto;
}

.side-nav-link small {
  flex: 0 0 auto;
  color: rgba(245, 249, 254, 0.54);
  text-align: right;
}

.app-main {
  padding: 22px;
  display: grid;
  gap: 18px;
  max-height: 100vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.topbar,
.session-strip,
.content-card,
.inner-card,
.data-table-card,
.workspace-hero {
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid rgba(218, 229, 241, 0.88);
  box-shadow: var(--shadow-sm);
}

.topbar {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.topbar h1,
.workspace-hero h2,
.inner-card h3 {
  margin: 0;
  color: var(--heading);
}

.topbar h1 {
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.topbar p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.topbar-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
  min-width: min(100%, 480px);
}

.topbar-stat,
.kpi-card,
.stat-card {
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(243, 248, 254, 0.95), rgba(255, 255, 255, 0.92));
  border: 1px solid var(--line);
}

.topbar-stat span,
.kpi-card span,
.stat-card .stat-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-stat strong,
.kpi-card strong,
.stat-card .stat-value {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.12;
  color: var(--heading);
}

.topbar-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.role-workspace {
  display: none;
  gap: 18px;
}

.role-workspace.active {
  display: grid;
}

.workspace-hero {
  padding: 24px;
  display: grid;
  gap: 18px;
  background:
    radial-gradient(circle at top right, rgba(62, 132, 207, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
}

.hero-copy-block p:last-child {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.78;
}

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

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

.kpi-card p,
.stat-card .stat-detail {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.content-card {
  padding: 22px;
  display: grid;
  gap: 18px;
}

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

.content-split > .content-card,
.content-split > .inner-card {
  min-width: 0;
}

.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.inner-card {
  padding: 20px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.summary-card {
  margin-top: 4px;
}

.data-table-card {
  padding: 4px;
  overflow: hidden;
  min-width: 0;
}

.sales-table-scroll {
  max-height: 360px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.summary-block {
  padding: 16px;
  border-radius: 16px;
  background: var(--blue-050);
  border: 1px solid var(--line);
  line-height: 1.72;
}

.result-card pre,
.stat-detail {
  padding: 18px;
  border-radius: 16px;
  background: #0f2743;
  color: #eaf3fd;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

thead {
  background: #f4f8fd;
}

th,
td {
  padding: 15px 14px;
  border-bottom: 1px solid #e7eef7;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
}

tbody tr:hover {
  background: #f8fbff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 131, 106, 0.12);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.warn {
  background: rgba(182, 122, 29, 0.12);
  color: var(--warn);
}

.status-pill.neutral {
  background: rgba(100, 122, 148, 0.12);
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .auth-frame,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
  }

  .session-strip,
  .form-grid.four,
  .kpi-grid,
  .kpi-grid-three,
  .topbar-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .auth-screen,
  .app-main {
    padding: 16px;
  }

  .auth-brand-panel,
  .auth-form-panel,
  .topbar,
  .workspace-hero,
  .content-card,
  .inner-card {
    padding: 18px;
  }

  .form-grid.two,
  .form-grid.four,
  .content-split,
  .session-strip,
  .kpi-grid,
  .kpi-grid-three,
  .topbar-meta {
    grid-template-columns: 1fr;
  }

  .section-toolbar,
  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}
