:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --blue: #0071e3;
  --blue-dark: #0057b8;
  --green: #30d158;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 113, 227, 0.12), transparent 32rem),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 100%);
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: rgba(245, 245, 247, 0.86);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}

.brand.large { margin-bottom: 32px; }

.brand strong {
  display: block;
  font-size: 13px;
  letter-spacing: 0;
}

.brand small, small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #111827, #3b82f6);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 113, 227, 0.28);
}

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

.nav a {
  padding: 10px 12px;
  border-radius: 12px;
  color: #343438;
}

.nav a:hover {
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(251, 251, 253, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
}

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

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

.stat-card, .panel, .login-card {
  background: var(--panel);
  border: 1px solid rgba(210, 210, 215, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.stat-card {
  border-radius: var(--radius);
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  display: block;
  font-size: 25px;
  margin: 8px 0 2px;
}

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

.panel {
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}

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

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

.muted { color: var(--muted); line-height: 1.6; }

.pill, .status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef5ff;
  color: #075db3;
  font-size: 11px;
  white-space: nowrap;
}

.status {
  background: #f1f1f3;
  color: #424245;
}

.table-wrap {
  overflow-x: auto;
}

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

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid #ececf0;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}

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

label {
  display: grid;
  gap: 6px;
  color: #3a3a3c;
  font-size: 12px;
}

.full { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 11px;
  font: inherit;
  background: rgba(255, 255, 255, 0.88);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.primary-btn, .soft-btn, .icon-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 15px;
  font: inherit;
  cursor: pointer;
}

.primary-btn {
  background: var(--blue);
  color: white;
  box-shadow: 0 10px 26px rgba(0, 113, 227, 0.24);
}

.primary-btn:hover { background: var(--blue-dark); }

.soft-btn, .icon-btn {
  background: #fff;
  border: 1px solid var(--line);
}

.icon-btn { display: none; }

.module-list, .logic-list {
  display: grid;
  gap: 10px;
}

.module-list a, .logic-list div {
  display: grid;
  gap: 4px;
  padding: 13px;
  border-radius: 14px;
  background: var(--panel-solid);
  border: 1px solid #eeeef2;
}

.module-list span, .logic-list span {
  color: var(--muted);
  line-height: 1.45;
}

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

.ops-actions a {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-solid);
  border: 1px solid #eeeef2;
}

.ops-actions a:hover {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 10px 26px rgba(0, 113, 227, 0.1);
}

.ops-actions span {
  color: var(--muted);
  line-height: 1.45;
}

.logic-list div {
  grid-template-columns: 28px 1fr;
  align-items: center;
}

.logic-list strong {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-size: 11px;
}

.formula {
  display: grid;
  gap: 8px;
}

.formula code {
  display: block;
  padding: 11px 13px;
  border-radius: 12px;
  background: #111827;
  color: #e5f0ff;
  white-space: normal;
}

.inline-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.inline-form input,
.inline-form select {
  width: auto;
  min-width: 108px;
  padding: 7px 9px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(1020px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}

.login-hero {
  border-radius: 28px;
  padding: 34px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.2), transparent),
    linear-gradient(145deg, #050509, #1d4ed8 58%, #60a5fa);
  box-shadow: var(--shadow);
}

.login-hero h1 {
  margin: 60px 0 24px;
  max-width: 650px;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-metrics span {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
}

.login-card {
  border-radius: 28px;
  padding: 28px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 11px;
}

.login-card h2 {
  margin: 0;
  font-size: 20px;
}

.alert {
  padding: 10px 12px;
  border-radius: 12px;
  color: #9f0712;
  background: #fff0f1;
  border: 1px solid #ffd3d8;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .icon-btn { display: inline-flex; }
  .stats-grid, .grid-2, .login-panel, .ops-actions { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 26px; margin-top: 40px; }
}

@media (max-width: 620px) {
  body { font-size: 12px; }
  .content, .topbar { padding: 14px; }
  .topbar h1 { font-size: 15px; }
  .panel, .stat-card { border-radius: 14px; padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .login-body { padding: 12px; }
  .login-hero, .login-card { border-radius: 18px; padding: 20px; }
  .login-hero h1 { font-size: 22px; }
}

