:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f0f4f7;
  --text: #1e252c;
  --muted: #65717e;
  --line: #dbe1e7;
  --accent: #1f6fb2;
  --accent-strong: #164f83;
  --green: #197a50;
  --orange: #b85f00;
  --red: #bb2b2b;
  --purple: #7651c8;
  --dark: #303842;
  --gray: #707986;
  --shadow: 0 12px 32px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  background: linear-gradient(120deg, #eef3f6 0%, #f8faf9 55%, #edf2f7 100%);
}

.login-visual {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(23, 33, 43, 0.96), rgba(30, 62, 73, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 72px);
  color: #fff;
}

.login-visual h1 {
  margin: 0;
  max-width: 720px;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: 0;
}

.login-visual p {
  margin: 18px 0 0;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.88);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h2,
.page-title h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.login-card .subtle {
  margin-top: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label,
.check-field,
.radio-label {
  color: var(--text);
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.filters input,
.filters select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}

.field textarea {
  min-height: 98px;
  resize: vertical;
}

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

.form-grid .span-2 {
  grid-column: 1 / -1;
}

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

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.button,
.ghost-button,
.danger-button,
.success-button,
.warning-button,
.dark-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.button {
  background: var(--accent);
  color: #fff;
}

.button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.success-button {
  background: var(--green);
  color: #fff;
}

.warning-button {
  background: var(--orange);
  color: #fff;
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.dark-button {
  background: var(--dark);
  color: #fff;
}

.icon-button {
  min-height: 34px;
  padding: 7px 10px;
  background: #f7fafc;
  border-color: var(--line);
  color: var(--text);
}

.demo-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

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

.sidebar {
  background: #17212b;
  color: #f8fafc;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 3px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.brand span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.84);
}

.nav a[aria-current="page"],
.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 4;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e4edf5;
  color: var(--accent-strong);
  font-weight: 800;
  flex: 0 0 auto;
}

.user-chip small,
.subtle,
.meta {
  color: var(--muted);
}

.content {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 20px;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel,
.metric,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(26, 38, 52, 0.04);
}

.panel {
  padding: 18px;
}

.panel h2,
.panel h3,
.detail-card h2,
.detail-card h3 {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: 0;
}

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

.metric {
  padding: 16px;
  display: grid;
  gap: 6px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f2f5f7;
  color: #3e4b57;
  font-size: 13px;
  white-space: nowrap;
}

td {
  background: #fff;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-draft,
.status-cancel {
  background: #edf0f2;
  color: var(--gray);
}

.status-submitted {
  background: #e7f1fb;
  color: var(--accent-strong);
}

.status-returned {
  background: #fff0dc;
  color: var(--orange);
}

.status-approved {
  background: #e6f4ed;
  color: var(--green);
}

.status-rejected {
  background: #fde7e7;
  color: var(--red);
}

.status-processing {
  background: #efe9ff;
  color: var(--purple);
}

.status-completed {
  background: #e8ebee;
  color: var(--dark);
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.filters .wide {
  grid-column: span 2;
}

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

.detail-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
}

.detail-item strong {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.detail-card {
  padding: 18px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #f8fafb;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
}

.timeline-item strong {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-list,
.notification-list,
.compact-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachment-list li,
.notification-list li,
.compact-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.notification-list li.unread {
  border-color: #b5cde7;
  background: #f4f9ff;
}

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

.empty {
  padding: 18px;
  border: 1px dashed #c6cfd8;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

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

.check-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17212b;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.error-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--red);
}

.mobile-only {
  display: none;
}

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

  .split,
  .detail-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 780px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: auto;
    padding: 32px 22px;
  }

  .login-visual h1 {
    font-size: 30px;
  }

  .login-panel {
    padding: 18px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    border-bottom: 0;
    padding-bottom: 4px;
  }

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

  .nav a {
    background: rgba(255, 255, 255, 0.08);
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    position: static;
    padding: 12px 16px;
    align-items: flex-start;
  }

  .content {
    padding: 16px;
  }

  .page-title {
    display: grid;
  }

  .form-grid,
  .detail-grid,
  .settings-list,
  .check-grid {
    grid-template-columns: 1fr;
  }

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

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

  .filters .wide {
    grid-column: auto;
  }

  .button-row {
    align-items: stretch;
  }

  .button-row > * {
    flex: 1 1 auto;
  }

  .demo-users {
    grid-template-columns: 1fr;
  }

  .mobile-only {
    display: inline;
  }
}
