:root {
  --bg: #f9fbfd;
  --surface: #ffffff;
  --line: #dfe6ee;
  --ink: #0f172a;
  --ink-soft: #5b6b7a;
  --brand: #087c6d;
  --brand-dark: #065f54;
  --accent: #dff3ef;
  --shadow: 0 1px 15px 1px rgba(69, 65, 78, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 20%, #ecfff9 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, #e5f1ff 0%, transparent 35%),
    linear-gradient(135deg, #f7fbff 0%, #edf4f8 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}

.login-welcome {
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.welcome-logo {
  width: min(380px, 80%);
  margin-bottom: 24px;
}

.welcome-title {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.welcome-highlight {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--brand-dark);
}

.welcome-copy {
  max-width: 520px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.login-card-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.card-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin-bottom: 16px;
}

.input-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.input-block label {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.input-block input,
.select-group select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
  outline: none;
}

.input-block input:focus,
.select-group select:focus {
  border-color: #8fd6ca;
  box-shadow: 0 0 0 3px rgba(8, 124, 109, 0.13);
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #09a68f 100%);
  color: #fff;
}

.login-card .btn-primary {
  width: 100%;
}

.btn-secondary {
  background: #070707;
  color: #f4f7fb;
}

.btn-danger {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  background: #b42318;
  color: #fff;
}

.btn-ghost {
  margin: 18px 14px 6px;
  background: transparent;
  border: 1px solid var(--line);
}

.forgot {
  display: inline-block;
  margin-top: 12px;
  color: #1f4f87;
  text-decoration: none;
  font-size: 0.92rem;
}

.install-tip {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.dashboard-body {
  min-height: 100vh;
}

.topbar {
  height: 78px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-inline img {
  width: 220px;
  max-width: 38vw;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: #354b63;
  cursor: pointer;
  font-size: 1.1rem;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-group label {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.portal-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  min-height: calc(100vh - 78px);
  border-right: 1px solid var(--line);
  background: #f9fbfd;
  transition: transform 0.2s ease;
}

.user-card {
  margin: 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-card small {
  color: var(--ink-soft);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
}

.sidebar nav h4 {
  font-size: 0.79rem;
  color: #6f8092;
  margin: 18px 14px 8px;
  text-transform: uppercase;
}

.sidebar nav a {
  text-decoration: none;
  color: #1f334a;
  padding: 10px 14px;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #f2f4f8;
  border-left-color: #0f0f0f;
}

.content {
  padding: 22px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.page-head h2 {
  margin: 0;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.content h2 {
  margin-top: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metrics-grid.small {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.metric-card {
  background: var(--surface);
  border: 1px solid #edf1f6;
  border-radius: 5px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  align-items: center;
}

.metric-card i {
  color: #ffffff;
  font-size: 2rem;
  width: 86px;
  height: 86px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: linear-gradient(170deg, #58adff, #1f7ef0);
}

.metrics-grid .metric-card:nth-child(2) i,
.metrics-grid .metric-card:nth-child(3) i,
.metrics-grid .metric-card:nth-child(4) i {
  background: linear-gradient(170deg, #57db5c, #2fc539);
}

.metrics-grid.small .metric-card:nth-child(1) i {
  background: linear-gradient(170deg, #31cb68, #22ae55);
}

.metrics-grid.small .metric-card:nth-child(2) i {
  background: linear-gradient(170deg, #4ca7ff, #227be8);
}

.metrics-grid.small .metric-card:nth-child(3) i {
  background: linear-gradient(170deg, #35a9ff, #1e82f6);
}

.metric-card p {
  margin: 0 0 6px;
  color: #9a9a9a;
  font-size: 13px;
}

.metric-card h3 {
  margin: 0;
  color: #575962;
  font-size: 36px;
  font-weight: 300;
}

.metric-card span {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: #7b8c9d;
  margin-top: 2px;
}

.panel {
  background: var(--surface);
  border: 1px solid #edf1f6;
  border-radius: 5px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.panel-dark {
  background: #2a2f3a;
  color: #ecf1f8;
}

.panel-dark h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel h3 {
  margin: 0 0 10px;
}

.form-panel {
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.form-grid input,
.form-grid select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: #fbfdff;
}

.inline-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-feedback {
  margin: 8px 0 0;
  min-height: 20px;
  font-size: 0.86rem;
  color: #5f748a;
}

.form-feedback.success {
  color: #0a6f2f;
}

.form-feedback.error {
  color: #8b1d32;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.btn-inline {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #ecf0f4;
  font-size: 0.91rem;
}

.data-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #6f8092;
  letter-spacing: 0.03em;
  background: #f9fbfd;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-chip.ok {
  background: #ddf8e7;
  color: #0a6f2f;
}

.status-chip.wait {
  background: #fff2d9;
  color: #915700;
}

.status-chip.off {
  background: #ffe4e6;
  color: #8b1d32;
}

.loading {
  border: 1px dashed #bed2e6;
  border-radius: 12px;
  padding: 18px;
  color: #66829d;
  background: #f8fbff;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chart-row,
.chart-double {
  margin-top: 12px;
}

.chart-double {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chart-placeholder {
  margin-top: 12px;
  height: 220px;
  border-radius: 12px;
  border: 1px dashed #bed2e6;
  background:
    linear-gradient(180deg, #fcfeff 0%, #f2f8ff 100%),
    repeating-linear-gradient(90deg, transparent 0 52px, rgba(9, 88, 149, 0.06) 52px 53px);
}

.chart-shell {
  margin-top: 12px;
  height: 260px;
}

.chart-shell.chart-donut {
  height: 280px;
}

.tipos-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tipo-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tipo-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #d8dfeb;
}

.tipo-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.tipo-fill {
  height: 100%;
  border-radius: inherit;
}

.chart-placeholder.donut {
  height: 180px;
  background:
    radial-gradient(circle at center, #fff 34%, transparent 36%),
    conic-gradient(#0e836f 0 45%, #7cd8c8 45% 74%, #bde8df 74% 100%);
}

.chart-placeholder.bars {
  height: 180px;
  background:
    linear-gradient(to top,
      #0d866f 0 20%, transparent 20% 100%),
    linear-gradient(to top,
      #2aa18c 0 46%, transparent 46% 100%),
    linear-gradient(to top,
      #79d7c6 0 64%, transparent 64% 100%),
    linear-gradient(to top,
      #96e3d5 0 30%, transparent 30% 100%),
    #f4fbf9;
  background-repeat: no-repeat;
  background-size: 14% 100%, 14% 100%, 14% 100%, 14% 100%, 100% 100%;
  background-position: 12% 100%, 36% 100%, 60% 100%, 84% 100%, 0 0;
}

@media (max-width: 1100px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-welcome {
    padding: 26px 26px 6px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .metric-card {
    grid-template-columns: 62px 1fr;
  }

  .metric-card i {
    width: 62px;
    height: 62px;
    font-size: 1.6rem;
  }

  .metric-card h3 {
    font-size: 28px;
  }

  .metrics-grid.small,
  .chart-double {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .portal-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 78px;
    left: 0;
    width: 290px;
    transform: translateX(-100%);
    z-index: 19;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .topbar-actions {
    gap: 8px;
  }

  .select-group {
    display: none;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 14px;
  }

  .quick-actions {
    flex-direction: column;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .btn-secondary,
  .btn-primary {
    width: 100%;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
