:root {
  --bg: #f2f6f8;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --ink: #152431;
  --muted: #607283;
  --line: rgba(21, 36, 49, 0.12);
  --brand: #1e6b67;
  --brand-dark: #104443;
  --warm: #ff8a3d;
  --warm-soft: rgba(255, 138, 61, 0.16);
  --cool-soft: rgba(30, 107, 103, 0.14);
  --shadow: 0 22px 60px rgba(30, 44, 59, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-ui: "Bahnschrift", "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(30, 107, 103, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 138, 61, 0.18), transparent 28%),
    linear-gradient(140deg, #eef4f6 0%, #f7fbfd 52%, #eef3f5 100%);
}

.login-screen,
.dashboard-screen {
  padding: 32px;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 420px);
  gap: 28px;
  align-items: stretch;
  max-width: 1120px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
}

.brand-panel,
.panel-card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.brand-panel {
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto -48px -72px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 138, 61, 0.3) 0%, transparent 68%);
}

.brand-panel h1,
.topbar h1,
.section-header h2,
.hero-copy h2,
.login-panel h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.brand-panel h1 {
  font-size: clamp(2.6rem, 4vw, 4.2rem);
  margin-top: 10px;
}

.brand-panel p,
.muted,
.hero-copy p {
  color: var(--muted);
  line-height: 1.65;
}

.brand-link {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(16, 68, 67, 0.24);
}

.brand-link:hover {
  border-bottom-color: rgba(16, 68, 67, 0.72);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 14px;
}

.feature-list li {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.login-panel {
  display: flex;
  align-items: center;
}

.login-panel .panel-card {
  width: 100%;
  padding: 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--brand);
  font-weight: 700;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), transparent);
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form span {
  font-weight: 700;
  font-size: 0.94rem;
}

input {
  width: 100%;
  border: 1px solid rgba(21, 36, 49, 0.14);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

select {
  width: 100%;
  border: 1px solid rgba(21, 36, 49, 0.14);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus {
  border-color: rgba(30, 107, 103, 0.44);
  box-shadow: 0 0 0 4px rgba(30, 107, 103, 0.14);
  transform: translateY(-1px);
}

button,
a.secondary-button {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: 0 18px 36px rgba(16, 68, 67, 0.22);
}

.secondary-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(21, 36, 49, 0.1);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(21, 36, 49, 0.08);
}

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

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.form-feedback {
  min-height: 22px;
  margin: 0;
  font-size: 0.94rem;
  color: #a53b16;
}

.topbar {
  max-width: 1360px;
  margin: 0 auto 24px;
  display: flex;
  gap: 14px 20px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.topbar > div:first-child {
  flex: 1 1 260px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1 1 520px;
}

.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.92rem;
}

.dashboard-grid {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.panel-card {
  padding: 24px;
  min-width: 0;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: center;
  min-width: 0;
}

.hero-copy,
.history-card,
.password-card {
  min-width: 0;
}

.hero-copy p {
  max-width: 35ch;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.gauge-panel {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.gauge-shell {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.96) 0 36%, transparent 36%),
    conic-gradient(from 230deg, #0f4f4f, #1d8a84, #6cc0b4, #ffd092, #ff8a3d, #c24c1a, #0f4f4f);
  padding: 18px;
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.8),
    0 22px 44px rgba(21, 36, 49, 0.16);
}

.gauge-shell::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 255, 255, 0.98) 0 32%, rgba(242, 246, 248, 0.94) 32% 68%, transparent 69%),
    radial-gradient(circle at top left, rgba(255, 138, 61, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.6));
  border: 1px solid rgba(21, 36, 49, 0.08);
}

.gauge-shell::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 58%;
  width: 54%;
  height: 54%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.99) 0 54%, rgba(244, 248, 250, 0.97) 55% 78%, rgba(255, 255, 255, 0.92) 79% 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 10px 24px rgba(21, 36, 49, 0.06);
  z-index: 2;
}

.gauge-arc {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 18px solid transparent;
  clip-path: inset(0 0 42% 0);
}

.gauge-needle {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 8px;
  height: 120px;
  background: linear-gradient(180deg, #d84f1b 0%, #ff8a3d 58%, #204b57 100%);
  border-radius: 999px;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-120deg);
  box-shadow: 0 10px 18px rgba(32, 75, 87, 0.18);
  transition: transform 0.18s ease-out;
  z-index: 1;
}

.gauge-needle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1c3444;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.92);
}

.gauge-center {
  position: absolute;
  inset: 28% 18% 18%;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  z-index: 3;
}

.gauge-phase {
  margin: 0;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand);
  font-weight: 800;
}

.gauge-value {
  margin: 8px 0 0;
  font-size: clamp(2.6rem, 4.3vw, 4.1rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.gauge-unit,
.gauge-caption {
  margin: 0;
  color: var(--muted);
}

.gauge-unit {
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gauge-caption {
  max-width: 210px;
  margin-top: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.gauge-marker {
  position: absolute;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(21, 36, 49, 0.62);
  z-index: 1;
}

.marker-a {
  left: 56px;
  bottom: 104px;
}

.marker-b {
  left: 88px;
  top: 74px;
}

.marker-c {
  right: 92px;
  top: 74px;
}

.marker-d {
  right: 52px;
  bottom: 104px;
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 108px;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -18px -20px auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  opacity: 0.9;
}

.accent-download::after {
  background: rgba(255, 138, 61, 0.16);
}

.accent-upload::after {
  background: rgba(30, 107, 103, 0.18);
}

.accent-ping::after {
  background: rgba(92, 150, 241, 0.15);
}

.accent-jitter::after {
  background: rgba(239, 192, 54, 0.16);
}

.accent-loss::after {
  background: rgba(211, 89, 77, 0.16);
}

.accent-time::after {
  background: rgba(76, 90, 132, 0.14);
}

.metric-label {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  margin-bottom: 12px;
}

.metric-value {
  display: block;
  font-size: clamp(1.35rem, 2vw, 1.95rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.history-card,
.password-card {
  align-self: start;
}

.users-layout {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.users-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

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

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

.form-note {
  margin: 0;
}

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

.table-action-button {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.92rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.role-admin {
  color: #8a3e12;
  background: rgba(255, 138, 61, 0.16);
  border-color: rgba(255, 138, 61, 0.28);
}

.role-supervisor {
  color: #145e5c;
  background: rgba(30, 107, 103, 0.16);
  border-color: rgba(30, 107, 103, 0.28);
}

.role-cliente {
  color: #31506e;
  background: rgba(92, 150, 241, 0.14);
  border-color: rgba(92, 150, 241, 0.24);
}

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

.table-wrapper {
  overflow: auto;
  max-width: 100%;
}

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

.history-table th,
.history-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.history-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

.compact-form {
  grid-template-columns: 1fr;
  align-items: start;
}

.compact-form button {
  grid-column: 1 / -1;
  justify-self: start;
}

.compact-form .form-feedback {
  grid-column: 1 / -1;
}

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

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

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

@media (max-width: 1120px) {
  .hero-card,
  .login-layout,
  .users-grid {
    grid-template-columns: 1fr;
  }

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

  .compact-form,
  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy p {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .login-screen,
  .dashboard-screen {
    padding: 18px;
  }

  .brand-panel,
  .panel-card {
    padding: 22px;
  }

  .topbar {
    margin-bottom: 20px;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex: 1 1 auto;
  }

  .metrics-grid,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .gauge-shell {
    width: min(100%, 300px);
  }

  .marker-a {
    left: 42px;
    bottom: 92px;
  }

  .marker-b {
    left: 66px;
    top: 62px;
  }

  .marker-c {
    right: 66px;
    top: 62px;
  }

  .marker-d {
    right: 40px;
    bottom: 92px;
  }
}
