:root {
  --bg: #040d1a;
  --bg-soft: #071426;
  --card: rgba(9, 27, 51, 0.86);
  --card-strong: rgba(12, 38, 70, 0.96);
  --cyan: #00c8ff;
  --blue: #0047ab;
  --purple: #7c3aed;
  --orange: #f59e0b;
  --text: #f7fbff;
  --muted: #9fb7cb;
  --line: rgba(255,255,255,0.11);
  --success: #38d996;
  --warning: #f8c14a;
  --danger: #ff6b6b;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0,0,0,0.38);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0,200,255,0.24), transparent 32rem),
    radial-gradient(circle at 86% 5%, rgba(124,58,237,0.22), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(245,158,11,0.12), transparent 30rem),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: rgba(4,13,26,0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--cyan), var(--blue) 55%, var(--purple));
  font-weight: 950;
  letter-spacing: -0.08em;
  color: white;
  box-shadow: 0 16px 36px rgba(0,200,255,0.22);
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.brand em {
  color: var(--cyan);
  display: block;
  font-size: 14px;
  font-style: normal;
  font-weight: 900;
  margin-top: 3px;
}

.user-card {
  background: linear-gradient(145deg, rgba(0,200,255,0.14), rgba(124,58,237,0.10));
  border: 1px solid rgba(0,200,255,0.22);
  padding: 18px;
  border-radius: var(--radius);
  margin-bottom: 22px;
}

.user-card .label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 7px;
}

.user-card strong {
  display: block;
  font-size: 17px;
}

.user-card small {
  color: var(--muted);
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

.menu {
  display: grid;
  gap: 7px;
}

.menu a,
.logout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: 15px;
  color: var(--muted);
  font-weight: 800;
  transition: 160ms ease;
}

.menu a:hover,
.menu a.active,
.logout:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.logout {
  margin-top: 18px;
  color: #ffb4b4;
}

.main {
  padding: 34px;
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--cyan);
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  margin: 0 0 8px;
}

h1 {
  font-size: clamp(31px, 5vw, 54px);
  letter-spacing: -0.06em;
  line-height: 0.96;
  margin: 0;
}

.subtitle {
  color: var(--muted);
  margin: 14px 0 0;
  max-width: 780px;
  line-height: 1.6;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(18px);
}

.card h2,
.card h3 {
  margin: 0 0 16px;
  letter-spacing: -0.03em;
}

.metric { grid-column: span 3; min-height: 142px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

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

.metric .value {
  font-size: 38px;
  font-weight: 950;
  letter-spacing: -0.06em;
  margin-top: 13px;
}

.metric .hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 8px;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: #e7f5ff;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }

.badge,
.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.info { color: var(--cyan); background: rgba(0,200,255,0.10); border-color: rgba(0,200,255,0.25); }
.badge.warning { color: var(--warning); background: rgba(248,193,74,0.10); border-color: rgba(248,193,74,0.24); }
.badge.purple { color: #caa8ff; background: rgba(124,58,237,0.14); border-color: rgba(124,58,237,0.28); }
.badge.success { color: var(--success); background: rgba(56,217,150,0.10); border-color: rgba(56,217,150,0.24); }
.badge.danger { color: var(--danger); background: rgba(255,107,107,0.10); border-color: rgba(255,107,107,0.25); }
.badge.muted { color: var(--muted); background: rgba(255,255,255,0.06); }

.online-dot.online { color: var(--success); background: rgba(56,217,150,0.10); border-color: rgba(56,217,150,0.24); }
.online-dot.offline { color: var(--muted); background: rgba(255,255,255,0.06); }

.progress {
  height: 9px;
  width: 150px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple), var(--orange));
}

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

.field { grid-column: span 6; }
.field.full { grid-column: span 12; }
.field.third { grid-column: span 4; }

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 15px;
  padding: 13px 14px;
  outline: none;
}

textarea { min-height: 115px; resize: vertical; }

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0,200,255,0.48);
  box-shadow: 0 0 0 4px rgba(0,200,255,0.08);
}

select option { background: #071426; color: white; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 43px;
  border: 0;
  border-radius: 14px;
  padding: 11px 15px;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(0,200,255,0.16);
}

.btn.secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.danger {
  background: rgba(255,107,107,0.16);
  color: #ffd6d6;
  border: 1px solid rgba(255,107,107,0.28);
  box-shadow: none;
}

.btn.small {
  min-height: 35px;
  padding: 8px 11px;
  font-size: 13px;
}

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

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  font-weight: 800;
}

.flash.success { background: rgba(56,217,150,0.10); color: var(--success); border-color: rgba(56,217,150,0.24); }
.flash.error { background: rgba(255,107,107,0.10); color: var(--danger); border-color: rgba(255,107,107,0.25); }
.flash.info { background: rgba(0,200,255,0.10); color: var(--cyan); border-color: rgba(0,200,255,0.25); }

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

.login-card {
  width: min(540px, 100%);
  background: rgba(7,20,38,0.92);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card h1 {
  margin-top: 18px;
  font-size: 38px;
}

.notice {
  padding: 15px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.55;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 14px;
}

.timeline-date {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 950;
}

.timeline-content {
  border-left: 1px solid rgba(0,200,255,0.22);
  padding-left: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.timeline-content strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.invoice-total {
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .menu {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .main { padding: 22px; }
  .topbar { flex-direction: column; }
  .metric { grid-column: span 6; }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
}

@media (max-width: 680px) {
  .metric, .field, .field.third { grid-column: span 12; }
  .table-wrap { margin: 0 -6px; }
  .timeline-item { grid-template-columns: 1fr; }
  .timeline-content {
    border-left: 0;
    border-top: 1px solid rgba(0,200,255,0.22);
    padding-left: 0;
    padding-top: 10px;
  }
}
