:root {
  --bg: #06101d;
  --bg-soft: #0a1423;
  --panel: rgba(15, 25, 42, 0.88);
  --panel-strong: #101b2d;
  --panel-hover: #16243a;
  --border: rgba(255, 255, 255, 0.08);

  --text: #f8fafc;
  --muted: #91a1b8;

  --blue: #2f80ff;
  --cyan: #22d3ee;
  --green: #34d399;
  --yellow: #fbbf24;
  --orange: #fb923c;

  --sidebar-width: 252px;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 10%, rgba(47, 128, 255, 0.12), transparent 30%),
    radial-gradient(circle at 40% 80%, rgba(34, 211, 238, 0.04), transparent 30%),
    linear-gradient(180deg, #07111f 0%, #06101d 100%);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.sidebar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 22px;
  background: rgba(7, 17, 31, 0.93);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(24px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 8px;
  margin-bottom: 34px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  font-size: 21px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 10px 32px rgba(47, 128, 255, 0.28);
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand-sub {
  margin-top: 3px;
  color: var(--cyan);
  font-size: 11px;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 13px;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.nav-item.active {
  color: white;
  background: linear-gradient(
    90deg,
    rgba(47, 128, 255, 0.20),
    rgba(34, 211, 238, 0.06)
  );
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav-icon {
  width: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
}

.sidebar-status {
  margin-top: auto;
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-status strong,
.sidebar-status span {
  display: block;
}

.sidebar-status strong {
  font-size: 12px;
}

.sidebar-status span {
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 15px rgba(52, 211, 153, 0.8);
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 34px;
  max-width: 1720px;
}

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

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 7px 0 3px;
  font-size: clamp(29px, 3vw, 39px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.primary-btn {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: white;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 12px 28px rgba(47, 128, 255, 0.22);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(47, 128, 255, 0.3);
}

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

.stat-card,
.panel {
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(17, 29, 49, 0.92),
    rgba(12, 22, 38, 0.92)
  );
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  padding: 20px;
  border-radius: var(--radius);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -38px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: rgba(47, 128, 255, 0.08);
  filter: blur(2px);
}

.stat-label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  position: relative;
  z-index: 1;
  margin: 9px 0 8px;
  font-size: 35px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-trend {
  position: relative;
  z-index: 1;
  color: #7e8ea6;
  font-size: 11px;
}

.stat-trend.positive {
  color: var(--green);
}

.stat-trend.warning {
  color: var(--yellow);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(300px, 0.8fr);
  gap: 20px;
}

.panel {
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 20px 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-header a {
  color: var(--cyan);
  text-decoration: none;
  font-size: 12px;
}

.ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  transition: background 150ms ease;
}

.ticket-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.ticket-main {
  display: grid;
  gap: 5px;
}

.ticket-main strong {
  font-size: 12px;
}

.ticket-main span {
  color: #c4cede;
  font-size: 14px;
}

.badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  border: 1px solid transparent;
}

.badge.open {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.10);
  border-color: rgba(14, 165, 233, 0.12);
}

.badge.progress {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.12);
}

.badge.waiting {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.12);
}

.activity-panel {
  min-width: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
}

.activity-item strong,
.activity-item span {
  display: block;
}

.activity-item strong {
  font-size: 12px;
  line-height: 1.4;
}

.activity-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}

.activity-dot.blue {
  background: var(--blue);
  box-shadow: 0 0 12px rgba(47, 128, 255, 0.7);
}

.activity-dot.green {
  background: var(--green);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.7);
}

.activity-dot.orange {
  background: var(--orange);
  box-shadow: 0 0 12px rgba(251, 146, 60, 0.7);
}

.bottom-nav {
  display: none;
}

/* Tablet */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .activity-panel {
    display: none;
  }
}

/* iPhone / mobile PWA */
@media (max-width: 760px) {
  :root {
    --sidebar-width: 0px;
  }

  body {
    min-height: 100dvh;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding:
      calc(18px + env(safe-area-inset-top))
      16px
      calc(98px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: block;
    margin-bottom: 22px;
  }

  .eyebrow {
    font-size: 10px;
  }

  h1 {
    font-size: 28px;
    margin-top: 8px;
  }

  .subtitle {
    font-size: 13px;
  }

  .primary-btn {
    width: 100%;
    margin-top: 18px;
    min-height: 50px;
    font-size: 15px;
  }

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

  .stat-card {
    min-height: 122px;
    padding: 16px;
    border-radius: 16px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-value {
    font-size: 30px;
  }

  .stat-trend {
    font-size: 9px;
  }

  .dashboard-grid {
    display: block;
  }

  .panel {
    border-radius: 17px;
  }

  .panel-header {
    padding: 17px 16px 14px;
  }

  .panel-header h2 {
    font-size: 17px;
  }

  .panel-header p {
    display: none;
  }

  .ticket-row {
    min-height: 76px;
    padding: 14px 16px;
  }

  .ticket-main span {
    font-size: 13px;
  }

  .badge {
    font-size: 9px;
    padding: 6px 8px;
  }

  .bottom-nav {
    position: fixed;
    z-index: 30;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 1fr 58px 1fr 1fr;
    align-items: center;
    height: 70px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(8, 17, 31, 0.92);
    backdrop-filter: blur(24px);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  }

  .bottom-nav a {
    display: grid;
    place-items: center;
    gap: 3px;
    color: var(--muted);
    text-decoration: none;
    font-size: 17px;
  }

  .bottom-nav small {
    font-size: 9px;
  }

  .bottom-nav a.active {
    color: var(--cyan);
  }

  .mobile-create {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 0;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    line-height: 1;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    box-shadow: 0 10px 25px rgba(47, 128, 255, 0.35);
  }
}

@media (max-width: 390px) {
  .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 27px;
  }
}
