:root {
  --bg: #f3f8fb;
  --bg-accent: #d8eef5;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --ink: #16233e;
  --muted: #5b6d8a;
  --line: rgba(26, 48, 81, 0.08);
  --cyan: #0ea5c6;
  --cyan-deep: #0b7ea6;
  --emerald: #17b26a;
  --amber: #f59e0b;
  --danger: #dc4c6a;
  --shadow: 0 16px 44px rgba(19, 42, 72, 0.1);
  --font-main: "Bahnschrift", "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(14, 165, 198, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(23, 178, 106, 0.12), transparent 26%),
    linear-gradient(180deg, var(--bg) 0%, #eef5f7 100%);
}

img {
  display: block;
  max-width: 100%;
}

.surface {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.flash-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: grid;
  gap: 0.75rem;
  z-index: 50;
}

.flash {
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(16, 34, 58, 0.12);
}

.flash-error {
  background: #fff1f4;
  color: #95283f;
}

.flash-info {
  background: #eef9ff;
  color: #0b5f80;
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-page {
  width: min(100%, 520px);
}

.login-card {
  border-radius: 32px;
  padding: 2rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 253, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 90px rgba(17, 35, 59, 0.14);
}

.brand-mark img {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  box-shadow: 0 20px 45px rgba(12, 126, 166, 0.18);
}

.eyebrow {
  margin-top: 0.8rem;
  color: var(--cyan-deep);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

.login-card h1 {
  margin-top: 0.45rem;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 0.98;
}

.lede {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.login-form {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
}

label span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
}

input,
button {
  font: inherit;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid rgba(15, 51, 92, 0.14);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: rgba(14, 165, 198, 0.65);
  box-shadow: 0 0 0 5px rgba(14, 165, 198, 0.12);
  transform: translateY(-1px);
}

.remember-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.remember-row input {
  width: 18px;
  height: 18px;
}

.primary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button {
  padding: 0.86rem 1.05rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--cyan) 0%, #3bd0df 52%, #70e0ba 100%);
  box-shadow: 0 12px 28px rgba(14, 165, 198, 0.2);
}

.ghost-button {
  padding: 0.72rem 0.92rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(21, 41, 72, 0.12);
}

.danger-button {
  padding: 0.72rem 0.92rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #d63a54 0%, #f16355 100%);
  box-shadow: 0 12px 28px rgba(220, 76, 106, 0.22);
}

.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.dashboard-page {
  width: min(1580px, calc(100% - 1rem));
  margin: 0.5rem auto 0.9rem;
  display: grid;
  gap: 0.75rem;
}

.hero {
  border-radius: 24px;
  padding: 0.95rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.hero-brand img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

.hero-copy h1 {
  font-size: clamp(1.6rem, 2.6vw, 2.5rem);
  letter-spacing: -0.03em;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.meta-pill {
  padding: 0.38rem 0.65rem;
  border-radius: 999px;
  background: rgba(14, 165, 198, 0.08);
  border: 1px solid rgba(14, 165, 198, 0.14);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--cyan-deep);
}

.hero-actions {
  display: grid;
  justify-items: end;
  gap: 0.65rem;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.72rem;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  border: 1px solid rgba(22, 35, 62, 0.08);
  font-weight: 700;
  font-size: 0.82rem;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(23, 178, 106, 0.45);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(23, 178, 106, 0.42); }
  70% { box-shadow: 0 0 0 16px rgba(23, 178, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(23, 178, 106, 0); }
}

.top-grid,
.bar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-card,
.bar-card,
.chart-card,
.table-card {
  border-radius: 22px;
  padding: 0.88rem;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.metric-head span {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.metric-head strong {
  font-size: 1.25rem;
}

.metric-foot {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.metric-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.metric-split-compact {
  margin-top: 0.35rem;
}

.metric-split small {
  display: block;
  color: var(--muted);
  margin-bottom: 0.18rem;
  font-size: 0.72rem;
}

.metric-split strong {
  font-size: 0.92rem;
}

.metric-ring {
  width: 92px;
  height: 92px;
  margin: 0.7rem auto 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.98) 0 53%, transparent 54% 100%),
    conic-gradient(var(--cyan) calc(var(--value) * 1%), rgba(15, 41, 72, 0.08) 0);
}

.metric-ring.emerald {
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.98) 0 53%, transparent 54% 100%),
    conic-gradient(var(--emerald) calc(var(--value) * 1%), rgba(15, 41, 72, 0.08) 0);
}

.metric-ring.amber {
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.98) 0 53%, transparent 54% 100%),
    conic-gradient(var(--amber) calc(var(--value) * 1%), rgba(15, 41, 72, 0.08) 0);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
}

.section-head h2 {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.chart-area {
  min-height: 160px;
}

.chart-svg {
  width: 100%;
  height: 160px;
}

.bar-list {
  display: grid;
  gap: 0.55rem;
}

.bar-row {
  display: grid;
  gap: 0.28rem;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.84rem;
}

.bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(18, 35, 62, 0.08);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14, 165, 198, 0.78), rgba(23, 178, 106, 0.7));
}

.table-wrap {
  max-height: min(48vh, 28rem);
  overflow: auto;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.8rem;
}

.time-col {
  width: 10.5rem;
}

.ip-col {
  width: 9rem;
}

.geo-col {
  width: 10rem;
}

.service-col {
  width: 9rem;
}

.protocol-col {
  width: 5rem;
}

.detail-col {
  width: auto;
}

thead th {
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.45rem 0.55rem 0.55rem;
  background: rgba(247, 251, 253, 0.97);
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody td {
  border-top: 1px solid var(--line);
  padding: 0.5rem 0.55rem;
  vertical-align: top;
  line-height: 1.35;
  word-break: break-word;
}

tbody tr:first-child td {
  border-top: 0;
}

@media (max-width: 1180px) {
  .top-grid,
  .bar-grid,
  .chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page {
    width: min(100% - 0.75rem, 100%);
  }
}

@media (max-width: 820px) {
  .dashboard-page {
    width: min(100% - 0.5rem, 100%);
    margin: 0.25rem auto 0.75rem;
  }

  .hero {
    flex-direction: column;
    padding: 0.8rem;
  }

  .hero-actions {
    justify-items: start;
    width: 100%;
  }

  .action-cluster {
    justify-content: flex-start;
  }

  .top-grid,
  .bar-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .metric-ring {
    width: 82px;
    height: 82px;
  }

  .table-wrap {
    max-height: 22rem;
  }
}
