:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-muted: #f0f4f2;
  --text: #1c2621;
  --muted: #6f7b75;
  --border: #e1e8e4;
  --primary: #268a5a;
  --primary-dark: #17643f;
  --primary-soft: #e5f4ec;
  --warning: #d99a21;
  --danger: #c64040;
  --danger-soft: #ffe8e8;
  --shadow: 0 10px 28px rgba(26, 43, 34, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  margin: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px;
  width: 280px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand-mark {
  align-items: center;
  background: var(--primary);
  border-radius: 10px;
  color: white;
  display: flex;
  font-size: 20px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand-title {
  font-size: 18px;
  font-weight: 750;
}

.brand-subtitle,
.muted-label,
.muted {
  color: var(--muted);
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 650;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button,
.ghost-button,
.secondary-button,
.primary-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
}

.nav-button {
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-button.is-active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.session-box {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}

.session-user {
  font-size: 14px;
  font-weight: 700;
}

.ghost-button {
  background: var(--surface-muted);
  color: var(--text);
}

.main {
  flex: 1;
  min-width: 0;
}

.login-panel {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-card h1,
.topbar h1 {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: 0;
  margin: 0;
}

.login-card p,
.topbar p {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0;
}

label {
  color: var(--text);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  min-height: 44px;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(38, 138, 90, 0.12);
  outline: none;
}

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

.primary-button {
  background: var(--primary);
  color: white;
}

.secondary-button {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.panel-view {
  padding: 30px;
}

.is-hidden {
  display: none;
}

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

.status-notice {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 16px;
  min-height: 18px;
}

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

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

.two-column {
  grid-template-columns: 1.1fr 0.9fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h2 {
  font-size: 16px;
  font-weight: 750;
  margin: 0 0 14px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 760;
  letter-spacing: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  margin-top: 4px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
  min-width: 220px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  color: #25312b;
  font-weight: 500;
}

tbody tr:hover {
  background: #f8fbf9;
}

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

.badge-active,
.badge-completed {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.badge-damaged,
.badge-overdue,
.badge-skipped {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-repair,
.badge-planned,
.badge-in_progress {
  background: #fff3d6;
  color: #916000;
}

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

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

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

.error-text {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  min-height: 18px;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    border-bottom: 1px solid var(--border);
    border-right: 0;
    width: auto;
  }

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

  .panel-view {
    padding: 18px;
  }

  .kpi-grid,
  .two-column,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
