:root {
  color-scheme: light;
  --bg: #f4f7f4;
  --surface: #ffffff;
  --surface-strong: #f7faf7;
  --ink: #17211a;
  --muted: #637267;
  --line: #dfe8df;
  --brand: #1f6b4d;
  --brand-strong: #14553c;
  --accent: #d78c2f;
  --danger: #b83232;
  --warning: #b66b00;
  --ok: #188052;
  --shadow: 0 14px 40px rgba(18, 48, 32, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(31, 107, 77, 0.08), transparent 36rem),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-visual {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  background:
    linear-gradient(135deg, rgba(20, 85, 60, 0.92), rgba(31, 107, 77, 0.76)),
    url("data:image/svg+xml,%3Csvg width='900' height='900' viewBox='0 0 900 900' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.13' stroke-width='2'%3E%3Cpath d='M83 158h640v312H83z'/%3E%3Cpath d='M149 218h102v192H149zM295 218h102v192H295zM441 218h102v192H441zM587 218h102v192H587z'/%3E%3Cpath d='M205 560h495M205 620h495M205 680h360'/%3E%3Ccircle cx='650' cy='658' r='78'/%3E%3Cpath d='M650 608v53l39 28'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
  letter-spacing: 0;
}

.login-visual h1 {
  max-width: 650px;
  margin: 26px 0 16px;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1;
}

.login-visual p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
  line-height: 1.65;
}

.login-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 36px;
}

.login-metrics div {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
}

.login-metrics strong {
  display: block;
  font-size: 1.45rem;
}

.login-metrics span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  align-content: center;
  padding: 42px;
}

.auth-card,
.panel,
.stat-card,
.table-wrap,
.asset-card,
.maintenance-card,
.modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 430px);
  margin: auto;
  padding: 28px;
}

.auth-card h2,
.section-title h2 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-card p,
.section-title p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.field label,
.checklist-title {
  color: #314139;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfdacf;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 107, 77, 0.14);
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 9px 14px;
  background: #e8efe8;
  color: #203027;
  font-weight: 800;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-strong);
}

.btn.danger {
  background: #f8e6e6;
  color: var(--danger);
}

.btn.ghost {
  border: 1px solid var(--line);
  background: transparent;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.auth-actions .btn {
  width: 100%;
}

.hint,
.error,
.success {
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.9rem;
}

.hint {
  background: #edf5ed;
  color: #4a5d50;
}

.error {
  background: #fae7e7;
  color: var(--danger);
}

.success {
  background: #e4f5ec;
  color: var(--ok);
}

.shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fbfdfb;
  padding: 22px 18px;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.side-head .brand-mark {
  border-color: #cfe0d4;
  background: #e7f0e9;
  color: var(--brand);
}

.side-head strong {
  display: block;
  line-height: 1.15;
}

.side-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.nav {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.nav button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius);
  background: transparent;
  color: #33453a;
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
}

.nav button.active,
.nav button:hover {
  background: #e7f0e9;
  color: var(--brand-strong);
}

.nav-icon {
  width: 22px;
  text-align: center;
}

.user-box {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.user-box small {
  display: block;
  color: var(--muted);
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

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

.topbar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  line-height: 1.04;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
}

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

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

.stat-card {
  padding: 17px;
  box-shadow: none;
}

.stat-card small {
  color: var(--muted);
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.85rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.grid-2 {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

.panel {
  padding: 18px;
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2,
.panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-head p,
.panel p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

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

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

.checklist {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 10px;
  color: #2f3f36;
  font-weight: 700;
}

.check-item input {
  width: 18px;
  min-height: 18px;
}

.table-wrap {
  overflow-x: auto;
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

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

th {
  background: #f2f7f2;
  color: #45554b;
  font-size: 0.82rem;
  text-transform: uppercase;
}

td {
  color: #27352d;
  font-size: 0.92rem;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e8efe8;
  color: #2d4538;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.ok {
  background: #e2f5eb;
  color: var(--ok);
}

.badge.warn {
  background: #fff2d9;
  color: var(--warning);
}

.badge.danger {
  background: #f9e5e5;
  color: var(--danger);
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #2b3a31;
  font-size: 0.9rem;
  font-weight: 800;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2eae2;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

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

.asset-card,
.maintenance-card {
  padding: 14px;
  box-shadow: none;
}

.asset-card h3,
.maintenance-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.asset-card dl {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.asset-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.asset-card dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.thumbs {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.thumbs img,
.preview-list img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
}

.preview-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.empty {
  border: 1px dashed #c8d4c8;
  border-radius: var(--radius);
  background: #fbfdfb;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.filters .field {
  min-width: 180px;
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 28, 18, 0.5);
}

.modal-card {
  width: min(100%, 760px);
  max-height: min(92vh, 820px);
  overflow-y: auto;
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.modal-head h2 {
  margin: 0;
}

.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.mobile-top {
  display: none;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.ok {
  background: var(--ok);
}

.status-dot.warn {
  background: var(--warning);
}

.status-dot.danger {
  background: var(--danger);
}

@media (max-width: 1080px) {
  .stats-grid,
  .asset-grid,
  .maintenance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  .login-shell,
  .shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: auto;
    padding: 28px 22px;
  }

  .login-panel {
    min-height: auto;
    padding: 22px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .side-head,
  .user-box {
    display: none;
  }

  .mobile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav button {
    white-space: nowrap;
  }

  .main {
    padding: 18px 14px 24px;
  }

  .topbar {
    flex-direction: column;
  }

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

@media (max-width: 560px) {
  .login-metrics,
  .stats-grid,
  .asset-grid,
  .maintenance-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 20px;
  }

  .panel,
  .stat-card,
  .asset-card,
  .maintenance-card {
    padding: 14px;
  }

  .filters {
    display: grid;
  }

  .filters .field {
    min-width: 0;
  }
}
