:root {
  --green-900: #084b2b;
  --green-800: #0b5f37;
  --green-700: #0e7a43;
  --green-100: #e8f6ee;
  --gold: #d5b900;
  --ink: #173126;
  --muted: #66756d;
  --line: #dfe9e3;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --shadow: 0 24px 70px rgba(4, 43, 26, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 10%, rgba(213, 185, 0, .28), transparent 28rem),
    radial-gradient(circle at 10% 82%, rgba(14, 122, 67, .18), transparent 28rem),
    linear-gradient(135deg, #eef8f2 0%, #d9eee4 48%, #f5f0cd 100%);
}

body::before {
  content: none;
}

a { color: inherit; }

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(5, 72, 43, .96), rgba(4, 48, 30, .94));
  border-right: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 18px 0 60px rgba(0, 0, 0, .18);
  color: #fff;
}

.brand {
  display: grid;
  gap: 12px;
  align-items: center;
  justify-items: start;
}

.brand img {
  width: 250px;
  height: 130px;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.brand strong {
  display: block;
  font-size: 20px;
}

.brand span,
.session span {
  color: rgba(255, 255, 255, 0.72);
}

nav {
  display: grid;
  gap: 10px;
}

nav a,
.session a {
  text-decoration: none;
}

nav a {
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, .06);
}

nav a.active,
nav a:hover {
  background: linear-gradient(135deg, rgba(15, 143, 77, .94), rgba(18, 169, 91, .86));
  color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
}

.session {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.content {
  padding: 40px;
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 72px;
  margin-bottom: 24px;
  padding: 0 4px;
  color: #fff;
}

h1 {
  margin: 0;
  font-size: 32px;
}

.grid {
  display: grid;
  gap: 18px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

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

.secondary-stats {
  margin-bottom: 24px;
}

.stat-card,
.panel,
.login-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 142px;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .88), rgba(236, 248, 241, .74));
}

.stat-card span,
label,
.muted {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 38px;
  letter-spacing: 0;
  color: var(--green-900);
}

.stat-card small {
  display: block;
  margin-top: 5px;
  color: var(--green-700);
}

.panel {
  padding: 28px;
  margin-bottom: 24px;
}

.home-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 38px;
  background:
    radial-gradient(circle at 92% 0%, rgba(242, 213, 38, .28), transparent 18rem),
    linear-gradient(135deg, #075a36, #0d7a47 58%, #0b5f37);
  color: #fff;
  overflow: hidden;
}

.home-hero h2 {
  margin: 6px 0 10px;
  font-size: 38px;
  color: #fff;
}

.home-hero .muted {
  max-width: 720px;
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: rgba(255, 255, 255, .84);
}

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

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

.section-title h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.home-hero .eyebrow {
  color: #f2d526;
}

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

.ficha-section table + h2,
.export-panel {
  margin-top: 0;
}

.attention-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  border-left: 6px solid var(--gold);
  background: rgba(255, 255, 255, .82);
}

.home-actions-panel {
  margin-top: 2px;
}

.attention-panel strong {
  font-size: 22px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
}

.field {
  display: grid;
  gap: 6px;
}

input,
select,
textarea,
button,
.button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font: inherit;
}

input,
select,
textarea {
  background: #fff;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: linear-gradient(135deg, var(--green-800), #12a45b);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 650;
  box-shadow: 0 10px 22px rgba(6, 84, 49, .16);
}

button.secondary,
.button.secondary {
  background: rgba(255, 255, 255, .76);
  color: var(--green-900);
  border: 1px solid rgba(8, 75, 43, .16);
  box-shadow: none;
}

td .button,
td button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  overflow: hidden;
}

.installations-panel table {
  background: rgba(255, 255, 255, .82);
}

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

th {
  color: var(--green-900);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tr:hover td {
  background: #f9fdfb;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 700;
}

.badge.warn {
  background: #fff1cf;
  color: #875e00;
}

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

.login-card {
  width: min(420px, 100%);
  padding: 28px;
}

.login-card img {
  width: 150px;
  display: block;
  margin-bottom: 18px;
}

.login-card form,
.form-grid {
  display: grid;
  gap: 14px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff1f1;
  color: #8b1e1e;
}

.ok {
  background: #e8f6ee;
  color: var(--green-900);
}

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

.detail-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

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

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

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .content { padding: 18px; }
  .stats { grid-template-columns: 1fr; }
  .edit-form { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}
