:root {
  --bg: #f4f7fb;
  --bg-2: #eef3f9;
  --panel: rgba(255, 255, 255, 0.62);
  --panel-strong: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.28);

  --text: #0f172a;
  --text-soft: #334155;
  --text-muted: #64748b;

  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-soft-2: rgba(37, 99, 235, 0.18);

  --success-bg: rgba(34, 197, 94, 0.12);
  --success-text: #15803d;

  --warning-bg: rgba(245, 158, 11, 0.16);
  --warning-text: #b45309;

  --danger-bg: rgba(239, 68, 68, 0.13);
  --danger-text: #b91c1c;

  --shadow-1: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-3: 0 24px 80px rgba(15, 23, 42, 0.1);

  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 32px;

  --sidebar-width: 292px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.07), transparent 20%),
    radial-gradient(circle at 100% 100%, rgba(148, 163, 184, 0.06), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

a {
  color: inherit;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  padding: 20px;
  z-index: 40;
}

.sidebar-inner {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.72),
    rgba(255, 255, 255, 0.58)
  );
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 18px 4px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-section-title {
  margin: 10px 8px 10px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  padding: 13px 14px;
  border-radius: 18px;
  color: var(--text-soft);
  font-weight: 650;
  transition: all 0.18s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.52);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-link-active {
  background: linear-gradient(
    180deg,
    rgba(37, 99, 235, 0.14),
    rgba(37, 99, 235, 0.09)
  );
  color: #1d4ed8;
  box-shadow:
    inset 0 0 0 1px rgba(37, 99, 235, 0.08),
    0 12px 24px rgba(37, 99, 235, 0.08);
}

.nav-badge {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.sidebar-footer-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.sidebar-footer-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 45;
  margin: 0;
  padding: 14px 16px;
  background: rgba(244, 247, 251, 0.76);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.mobile-topbar-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 28px 28px 40px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.page-title {
  margin: 0;
  font-size: 36px;
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.page-subtitle {
  margin: 10px 0 0 0;
  max-width: 860px;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 14px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  font: inherit;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.input-sm {
  max-width: 200px;
}

.textarea {
  min-height: 72vh;
  resize: vertical;
  line-height: 1.6;
}

.btn {
  border: 0;
  border-radius: 18px;
  padding: 13px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 0.08s ease, opacity 0.15s ease, box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(12px);
}

.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kpi-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  color: var(--text-soft);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px);
  font-size: 13px;
}

.kpi-pill strong {
  color: var(--text);
  font-weight: 800;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

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

.card {
  position: relative;
  padding: 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.74),
    rgba(255, 255, 255, 0.58)
  );
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0)
  );
}

.card-hero {
  min-height: 184px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 36%),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.82),
      rgba(255, 255, 255, 0.62)
    );
}

.card-hero::after,
.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
}

.hero-metric,
.stat-label,
.stat-value,
.stat-subvalue,
.section-head,
.log-item,
.pre-wrap {
  position: relative;
  z-index: 1;
}

.hero-overline {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.hero-value {
  margin-top: 12px;
  font-size: 44px;
  line-height: 0.96;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.hero-meta {
  margin-top: 12px;
  max-width: 560px;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 14px;
}

.hero-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hero-side-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(10px);
}

.hero-side-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero-side-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-card {
  min-height: 154px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-subvalue {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 13px;
}

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

.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(10px);
}

.table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

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

.table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.44);
}

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

.cell-strong {
  font-weight: 700;
}

.cell-money {
  font-variant-numeric: tabular-nums;
}

.cell-profit {
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-info {
  background: var(--accent-soft);
  color: #1d4ed8;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-item {
  padding: 15px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(10px);
}

.log-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.log-time {
  font-size: 12px;
  color: var(--text-muted);
}

.log-title {
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.log-message {
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 14px;
}

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

.doc-link {
  text-decoration: none;
  color: inherit;
}

.doc-card {
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.doc-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.doc-code {
  color: var(--text-muted);
  font-size: 13px;
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.68;
  color: var(--text-soft);
}

.empty-state {
  color: var(--text-muted);
  padding: 6px 2px 2px;
}

@media (max-width: 1280px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 980px) {
  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 18px 16px 28px;
  }

  .page-title {
    font-size: 30px;
  }

  .hero-value {
    font-size: 36px;
  }

  .hero-side {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .table {
    min-width: 820px;
  }

  .input-sm {
    max-width: none;
  }
}