:root {
  --bg-color: #f4f6f8;
  --sidebar-bg: #ffffff;
  --text-primary: #1e2329;
  --text-secondary: #6b7280;
  --accent-primary: #0bb5a4;
  --accent-primary-dark: #09a594;
  --accent-primary-light: rgba(11, 181, 164, 0.1);
  --accent-red: #ef4444;
  --accent-warning: #f59e0b;
  --accent-success: #22c55e;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --sidebar-width: 290px;
  --sidebar-collapsed-width: 72px;
  --sidebar-transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(11,181,164,0.08), transparent 28%),
    linear-gradient(180deg, #f8fafb 0%, var(--bg-color) 100%);
  color: var(--text-primary);
}

body { min-height: 100vh; }

button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }

.hidden { display: none !important; }

/* ── App shell ─────────────────────────────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--sidebar-transition);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  width: var(--sidebar-width);
  transition: width var(--sidebar-transition), padding var(--sidebar-transition);
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  padding: 12px 10px;
  gap: 8px;
}

/* Brand */
.sidebar__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding-bottom: 6px;
}

.sidebar__brand::before {
  content: "";
  display: block;
  width: 100%;
  max-width: 258px;
  aspect-ratio: 1800 / 520;
  background: url("isa-logo-sidebar.png") left center / contain no-repeat;
  flex-shrink: 0;
  transition: width var(--sidebar-transition), max-width var(--sidebar-transition);
}

.brand-mark {
  display: none;
}

.sidebar.collapsed .sidebar__brand {
  align-items: center;
}

.sidebar.collapsed .sidebar__brand::before {
  width: 52px;
  max-width: 52px;
  aspect-ratio: 430 / 330;
  background-image: url("isa-logo-compact.png");
  background-position: center;
}

.sidebar__system-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--sidebar-transition);
}

.sidebar.collapsed .sidebar__system-name {
  opacity: 0;
  height: 0;
}

.topbar h2, .login-card h2 { margin: 0; }
.login-card p { margin: 6px 0 0; color: var(--text-secondary); line-height: 1.5; }

.login-logo {
  display: block;
  max-width: 210px;
  height: auto;
  max-height: 72px;
  object-fit: contain;
  margin: 0 auto;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

/* User section */
.sidebar__user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.sidebar__user .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 9px 10px;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-logout__icon {
  display: none;
  flex: 0 0 auto;
}

.sidebar__user-info {
  overflow: hidden;
  transition: opacity var(--sidebar-transition), width var(--sidebar-transition);
  white-space: nowrap;
  min-width: 0;
}

.sidebar.collapsed .sidebar__user-info {
  opacity: 0;
  width: 0;
}

.sidebar__user-info strong { display: block; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; }

.sidebar.collapsed .ghost-button { display: none; }

.sidebar.collapsed .powered-by--sidebar,
.sidebar.collapsed .sidebar__footer {
  display: none;
}

.sidebar.collapsed .sidebar__user {
  display: flex;
  justify-content: center;
  margin-top: auto;
  overflow: visible;
}

.sidebar.collapsed .sidebar__user .sidebar-logout {
  display: inline-flex;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

.sidebar.collapsed .sidebar-logout__label {
  display: none;
}

.sidebar.collapsed .sidebar-logout__icon {
  display: block;
}

/* Nav */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.nav-group { display: flex; flex-direction: column; gap: 4px; }

.nav-group__title {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 8px 10px 2px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--sidebar-transition);
}

.sidebar.collapsed .nav-group__title {
  opacity: 0;
  height: 0;
  margin: 0;
}

.sidebar.collapsed .sidebar__nav {
  flex: 0 0 auto;
  gap: 3px;
  overflow: visible;
}

.sidebar.collapsed .nav-group {
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
  text-align: left;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover { background: var(--accent-primary-light); color: var(--accent-primary); }

.nav-item.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11,181,164,0.22);
}

.nav-item__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.14);
  flex-shrink: 0;
}

.nav-item__icon svg {
  display: block;
  flex: 0 0 auto;
}

.nav-item:not(.active) .nav-item__icon { background: rgba(15,23,42,0.05); }

.nav-item__label {
  overflow: hidden;
  transition: opacity var(--sidebar-transition), width var(--sidebar-transition);
}

.sidebar.collapsed .nav-item__label {
  opacity: 0;
  width: 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  min-height: 36px;
  padding: 3px 0;
  border-radius: 10px;
  overflow: visible;
}

.sidebar.collapsed .nav-item__icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

/* Toggle button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: rgba(15,23,42,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

.sidebar__footer {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow: hidden;
  transition: opacity var(--sidebar-transition);
}

.powered-by {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.powered-by--sidebar {
  padding: 8px 2px 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  transition: opacity var(--sidebar-transition);
}

.powered-by--login {
  margin: 18px 0 0;
  text-align: center;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 12px;
  min-width: 520px;
}

.permissions-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.82rem;
}

.permissions-grid input {
  min-height: 0;
  width: 16px;
  height: 16px;
  padding: 0;
}

.notif-rules-table { border-collapse: collapse; font-size: .88rem; width: 100%; }
.notif-rules-table th, .notif-rules-table td { padding: 10px 8px; border-bottom: 1px solid var(--card-border); }
.notif-cell { text-align: center; width: 80px; white-space: nowrap; }
.notif-cell input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; cursor: pointer; }

.permissions-matrix { border-collapse: collapse; font-size: .82rem; }
.permissions-matrix th,
.permissions-matrix td { padding: 6px 10px; border: 1px solid var(--card-border); text-align: center; }
.permissions-matrix .perm-action { text-align: left; white-space: nowrap; font-weight: 500; }
.perm-cell--granted { color: #16a34a; font-weight: 700; }
.permissions-matrix--editable .perm-action small {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-weight: 400;
}
.permissions-matrix--editable input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
}
.permission-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.permission-panel-toolbar label {
  min-width: 280px;
}
.permission-panel-status,
.permission-panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.permission-panel-actions {
  justify-content: flex-end;
  margin-top: 14px;
}
.permission-unsaved,
.permission-lock {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}
.permission-unsaved {
  color: #92400e;
  background: rgba(245,158,11,0.16);
}
.permission-lock {
  margin-left: 6px;
  color: #475569;
  background: rgba(100,116,139,0.14);
}
.permission-meta {
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: left !important;
}

.sidebar.collapsed .sidebar__footer,
.sidebar.collapsed .powered-by--sidebar { opacity: 0; }

/* ── Main content ──────────────────────────────────────────────────────────── */

.main-content { padding: 28px; }

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

.topbar__actions { display: flex; gap: 12px; }

.notification-center {
  position: relative;
}

.notification-bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
}

.notification-bell__icon {
  display: grid;
  place-items: center;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 35;
  width: min(380px, 88vw);
  max-height: 520px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 10px;
}

.notification-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 10px;
}

.notification-panel__header .ghost-button {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
}

.notification-item {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px;
  border-radius: 10px;
  background: rgba(11,181,164,0.08);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.notification-item.read {
  background: rgba(15,23,42,0.04);
  color: var(--text-secondary);
}

.notification-item__title {
  font-weight: 700;
}

.notification-item small,
.notification-item time,
.notification-empty {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.notification-empty {
  padding: 18px 10px;
  text-align: center;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.primary-button, .ghost-button, .status-pill {
  border-radius: 12px;
  padding: 12px 16px;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.primary-button {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(11,181,164,0.25);
}

.primary-button:hover { background: var(--accent-primary-dark); }
.primary-button--full { width: 100%; }

.ghost-button {
  background: #fff;
  border: 1px solid var(--card-border);
  color: var(--text-primary);
}

.ghost-button:hover { background: var(--accent-primary-light); color: var(--accent-primary); }

/* ── View container ────────────────────────────────────────────────────────── */

.view-container { display: flex; flex-direction: column; gap: 22px; }

.fade-in { animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */

.hero-card, .content-card, .stat-card, .chart-card,
.table-card, .form-card, .login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.hero-card, .content-card, .form-card, .table-card, .chart-card { padding: 22px; }

.hero-card {
  background:
    linear-gradient(135deg, rgba(11,181,164,0.08), rgba(255,255,255,0.95)), #fff;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
  align-items: center;
}

.hero-card h3, .section-heading h3, .content-card h3,
.table-card h3, .chart-card h3, .form-card h3 { margin: 0 0 10px; }

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

.hero-metric {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
}

.hero-metric strong { display: block; font-size: 1.2rem; margin-top: 6px; }

/* ── Grids ─────────────────────────────────────────────────────────────────── */

.stats-grid, .charts-grid, .tables-grid, .portal-grid, .kpi-section {
  display: grid;
  gap: 18px;
}

.stats-grid    { grid-template-columns: repeat(5, minmax(0,1fr)); }
.charts-grid   { grid-template-columns: 1.15fr 1fr; }
.tables-grid   { grid-template-columns: repeat(2, minmax(0,1fr)); }
.portal-grid   { grid-template-columns: repeat(2, minmax(0,1fr)); }

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

.stat-card {
  padding: 18px;
  border-left: 4px solid var(--accent-primary);
}

.stat-card.stat-overdue { border-left-color: var(--accent-red); }
.stat-card.stat-warning { border-left-color: var(--accent-warning); }
.stat-card.stat-success { border-left-color: var(--accent-success); }

.stat-card small { color: var(--text-secondary); font-size: 0.83rem; }
.stat-card strong { display: block; font-size: 1.75rem; margin: 10px 0 6px; }
.stat-card span { color: var(--text-secondary); font-size: 0.9rem; }

/* ── Dashboard sections ────────────────────────────────────────────────────── */

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
  padding: 4px 0;
  border-bottom: 1px solid var(--card-border);
}

/* ── Table actions / filters ───────────────────────────────────────────────── */

.table-actions, .section-heading, .filters-bar, .inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.table-actions { margin-bottom: 14px; }
.filters-bar   { margin-bottom: 16px; }

.filters-bar label, .login-form label, .form-grid label, .settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Dashboard filter bar */
.dashboard-filters {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-soft);
}

.dashboard-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  flex: 1;
  min-width: 140px;
}

.dashboard-filters .filter-reset {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(15,23,42,0.04);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  align-self: flex-end;
  white-space: nowrap;
}

.dashboard-filters .filter-reset:hover {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

/* ── Inputs ────────────────────────────────────────────────────────────────── */

input, select, textarea {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-primary);
  min-height: 46px;
}

textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(11,181,164,0.18);
  border-color: rgba(11,181,164,0.4);
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  width: 100%;
}

.password-field input {
  border-radius: 12px 0 0 12px;
  min-width: 0;
}

.password-toggle {
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--card-border);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  color: var(--text-secondary);
}

.password-toggle:hover {
  color: var(--accent-primary);
  background: var(--accent-primary-light);
}

.password-field--table {
  min-width: 180px;
}

.password-field--table input {
  min-height: 38px;
  padding: 8px 10px;
}

.form-card { max-width: 800px; }

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

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

.helper-text { color: var(--text-secondary); font-size: 0.92rem; margin-top: 4px; }

/* ── Defects editor ────────────────────────────────────────────────────────── */

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

.defect-row {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 10px;
  align-items: end;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }

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

th, td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.94rem;
}

th { font-size: 0.82rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

tbody tr:hover { background: rgba(0,0,0,0.02); }

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.admin-tabs .ghost-button.active {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
}

.admin-filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

[data-admin-row] input,
[data-admin-row] select,
[data-admin-row] textarea {
  min-width: 140px;
  width: 100%;
  padding: 8px 10px;
  min-height: 38px;
  border-radius: 10px;
}

[data-admin-row] textarea {
  min-width: 280px;
}

[data-admin-row] small {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ghost-button.danger {
  color: var(--accent-red);
}

/* ── Status pills ──────────────────────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 20px;
}

.status-pill--paid, .status-pill--active {
  color: #166534;
  background: rgba(34,197,94,0.14);
}

.status-pill--inactive {
  color: #475569;
  background: rgba(100,116,139,0.14);
}

.status-pill--pending {
  color: #92400e;
  background: rgba(245,158,11,0.14);
}

.status-pill--overdue {
  color: #991b1b;
  background: rgba(239,68,68,0.14);
}

.status-pill--closed {
  color: #166534;
  background: rgba(34,197,94,0.14);
}

/* ── Utils ─────────────────────────────────────────────────────────────────── */

.muted     { color: var(--text-secondary); }
.highlight { color: var(--accent-primary); font-weight: 600; }

.empty-state {
  padding: 28px;
  border: 1px dashed var(--card-border);
  border-radius: 14px;
  color: var(--text-secondary);
  text-align: center;
}

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

.data-list  { display: grid; gap: 10px; }

.data-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(15,23,42,0.025);
  align-items: center;
}

/* ── Charts ────────────────────────────────────────────────────────────────── */

.canvas-wrap {
  position: relative;
  min-height: 280px;
}

/* LPA presentation mode */
.lpa-dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lpa-dashboard-toolbar h3 { margin: 0 0 4px; }

.lpa-fullscreen-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.lpa-dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 0;
}

.lpa-dashboard-filters label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.lpa-dashboard-filters input,
.lpa-dashboard-filters select {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
}

.lpa-dashboard-filters .primary-button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
}

.lpa-audit-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 14px 0 16px;
}

.lpa-audit-filters label {
  display: grid;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.lpa-audit-filters input,
.lpa-audit-filters select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-primary);
  background: #fff;
  font-size: 0.875rem;
}

.lpa-audit-filters .ghost-button {
  min-height: 38px;
}

.sidebar.collapsed .sidebar-toggle {
  margin-top: auto;
  padding: 8px;
  border-radius: 9px;
}

.tracker-filter-toolbar {
  --tracker-filter-height: 40px;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  margin: 0 0 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tracker-filter-field {
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
}

.tracker-filter-field--status { width: 168px; }
.tracker-filter-field--date { width: 136px; }
.tracker-filter-field--client { width: 170px; }
.tracker-filter-field--plant { width: 150px; }
.tracker-filter-field--responsible { width: 190px; }

.tracker-filter-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.tracker-filter-control {
  width: 100%;
  height: var(--tracker-filter-height);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0 10px;
}

.tracker-filter-control:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.tracker-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tracker-filter-actions .primary-button,
.tracker-filter-actions .ghost-button {
  height: var(--tracker-filter-height);
  min-height: var(--tracker-filter-height);
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  white-space: nowrap;
}

.table-sort-button {
  padding: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-align: left;
}

.lpa-findings-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.lpa-findings-table-wrap table {
  min-width: 980px;
}

body.lpa-dashboard-fullscreen {
  background: #f8fafb;
  overflow: hidden;
}

body.lpa-dashboard-fullscreen .app-shell {
  grid-template-columns: 1fr;
}

body.lpa-dashboard-fullscreen .sidebar,
body.lpa-dashboard-fullscreen .topbar {
  display: none;
}

body.lpa-dashboard-fullscreen .main-content {
  height: 100vh;
  overflow: hidden;
  padding: 10px;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-screen {
  height: calc(100vh - 20px);
  gap: 8px;
  overflow: hidden;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-toolbar,
body.lpa-dashboard-fullscreen .lpa-dashboard-filters,
body.lpa-dashboard-fullscreen .stat-card,
body.lpa-dashboard-fullscreen .chart-card,
body.lpa-dashboard-fullscreen .table-card {
  box-shadow: none;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-toolbar {
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-toolbar .muted {
  margin: 0;
  font-size: 0.78rem;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-filters {
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-filters div {
  min-width: 110px;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-filters label {
  display: none;
}

body.lpa-dashboard-fullscreen .lpa-dashboard-filters input,
body.lpa-dashboard-fullscreen .lpa-dashboard-filters select,
body.lpa-dashboard-fullscreen .lpa-dashboard-filters .primary-button {
  min-height: 30px !important;
  max-width: 170px;
  padding: 5px 8px !important;
  border-radius: 7px !important;
  font-size: 0.74rem !important;
}

body.lpa-dashboard-fullscreen .stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

body.lpa-dashboard-fullscreen .stat-card {
  padding: 8px 10px;
  border-radius: 10px;
}

body.lpa-dashboard-fullscreen .stat-card small,
body.lpa-dashboard-fullscreen .stat-card span {
  font-size: 0.68rem;
}

body.lpa-dashboard-fullscreen .stat-card strong {
  font-size: 1.35rem;
  margin: 4px 0 2px;
}

body.lpa-dashboard-fullscreen .charts-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

body.lpa-dashboard-fullscreen .chart-card,
body.lpa-dashboard-fullscreen .table-card {
  padding: 10px;
  border-radius: 10px;
}

body.lpa-dashboard-fullscreen .chart-card h3,
body.lpa-dashboard-fullscreen .table-card h3 {
  margin-bottom: 2px;
  font-size: 0.86rem;
}

body.lpa-dashboard-fullscreen .chart-card .muted {
  display: none;
}

body.lpa-dashboard-fullscreen .canvas-wrap {
  min-height: 168px;
}

body.lpa-dashboard-fullscreen .table-card {
  margin-top: 0 !important;
  min-height: 0;
  overflow: hidden;
}

body.lpa-dashboard-fullscreen .lpa-findings-table-wrap {
  max-height: 22vh;
  overflow: auto;
}

body.lpa-dashboard-fullscreen .table-card table {
  font-size: 0.72rem !important;
}

body.lpa-dashboard-fullscreen .table-card th,
body.lpa-dashboard-fullscreen .table-card td {
  padding: 4px 6px !important;
}

body.lpa-dashboard-fullscreen .table-card th:nth-child(6),
body.lpa-dashboard-fullscreen .table-card td:nth-child(6) {
  max-width: 22rem;
}

/* ── Login overlay ─────────────────────────────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.48);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 20px;
}

.login-card {
  width: min(100%, 460px);
  padding: 0;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.login-banner {
  padding: 32px 28px 28px;
  background: #f8fafb;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-body {
  padding: 28px;
}

.login-form { display: grid; gap: 16px; margin-top: 22px; }

/* ── Loading overlay ───────────────────────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248,250,251,0.9);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 50;
}

.loading-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--text-secondary);
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 4px solid var(--accent-primary-light);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error banner ──────────────────────────────────────────────────────────── */

.error-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 12px 20px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 40;
  max-width: 90vw;
  box-shadow: var(--shadow-soft);
}

.error-banner button {
  background: none;
  color: #991b1b;
  padding: 4px 8px;
  font-size: 1rem;
}

.error-banner.success {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.error-banner.success strong,
.error-banner.success button {
  color: #166534;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1100px) {
  .stats-grid, .charts-grid, .tables-grid, .portal-grid, .hero-card,
  .kpi-strip, .kpi-section { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .app-shell  { grid-template-columns: 1fr !important; }
  .sidebar    { position: relative; height: auto; width: 100% !important; }
  .sidebar.collapsed { width: 100% !important; }
  .sidebar.collapsed .sidebar__brand-text,
  .sidebar.collapsed .sidebar__user-info,
  .sidebar.collapsed .nav-item__label,
  .sidebar.collapsed .nav-group__title,
  .sidebar.collapsed .sidebar__footer { opacity: 1; width: auto; height: auto; margin: revert; }
  .main-content { padding: 20px; }
}

@media (max-width: 720px) {
  .topbar, .sidebar__brand, .sidebar__user,
  .table-actions, .section-heading, .filters-bar, .dashboard-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .form-grid, .settings-grid, .hero-metrics, .defect-row, .admin-filter-grid {
    grid-template-columns: 1fr;
  }
  .main-content, .sidebar { padding: 18px; }
}

/* ── LPA Module ─────────────────────────────────────────────────────────────── */

.lpa-wizard-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}

.lpa-wizard-step {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-secondary);
}

.lpa-wizard-step.active {
  background: var(--accent-primary);
  color: white;
}

.lpa-wizard-step.done {
  background: rgba(11,181,164,0.15);
  color: var(--accent-primary);
}

.lpa-wizard-arrow {
  color: #cbd5e1;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.lpa-progress-bar-wrap {
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 0;
}

.lpa-progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.lpa-questions-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lpa-cat-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lpa-cat-title {
  background: #f8fafc;
  border-bottom: 1px solid var(--card-border);
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
}

.lpa-q-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
}

.lpa-q-row:last-child { border-bottom: none; }

.lpa-q-text {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--text-primary);
  line-height: 1.45;
}

.lpa-radios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.lpa-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.lpa-radio input[type="radio"] { display: none; }

.lpa-radio.r-ok        { color: #16a34a; border-color: #bbf7d0; }
.lpa-radio.r-ok.checked { background: #dcfce7; border-color: #16a34a; }

.lpa-radio.r-nf        { color: #d97706; border-color: #fde68a; }
.lpa-radio.r-nf.checked { background: #fef3c7; border-color: #d97706; }

.lpa-radio.r-no        { color: #dc2626; border-color: #fecaca; }
.lpa-radio.r-no.checked { background: #fee2e2; border-color: #dc2626; }

.lpa-radio:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }

.lpa-nok-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: #fff7ed;
  border-radius: 8px;
  border: 1px solid #fed7aa;
}

.lpa-nok-fields label span {
  font-size: 0.75rem;
  color: #92400e;
  font-weight: 600;
}

.photo-file-input {
  margin-top: 4px;
  font-size: 0.8rem;
}
.photo-preview {
  display: block;
  margin-top: 6px;
  max-width: 180px;
  max-height: 120px;
  border-radius: 6px;
  border: 1px solid #fed7aa;
  object-fit: cover;
  cursor: pointer;
}
.photo-preview.hidden { display: none; }
.photo-status {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #92400e;
}

@media (max-width: 700px) {
  .lpa-nok-fields { grid-template-columns: 1fr; }
.lpa-radios { gap: 6px; }
}

body.lpa-dashboard-fullscreen .stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

body.lpa-dashboard-fullscreen .charts-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
\n
.admin-shift-submit {
  align-self: end;
  min-height: 48px;
  height: auto;
}

/* ── LPA Scheduler ────────────────────────────────────────────────────────── */
.sched-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.sched-main { flex: 1; min-width: 0; }
.sched-panel {
  width: 320px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  padding: .75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  max-height: 80vh;
  overflow-y: auto;
}
.sched-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  font-size: .9rem;
}
.sched-cal-grid {
  display: grid;
  grid-template-columns: 1.8rem repeat(7, 1fr);
  gap: 2px;
}
.sched-cal-header { margin-bottom: 4px; }
.sched-cal-label {
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  color: #6b7280;
  padding: .25rem 0;
}
.sched-cal-cell {
  min-height: 80px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: .25rem;
  padding: .25rem;
  cursor: pointer;
  transition: background .15s;
  overflow: hidden;
}
.sched-cal-cell:hover { background: #f0f9ff; }
.sched-cal-cell--empty { background: transparent; border-color: transparent; cursor: default; }
.sched-cal-cell--selected { background: #eff6ff; border-color: #3b82f6; }
.sched-cal-cell--prev-month { background: #f3f4f6; border-color: #e5e7eb; cursor: default; }
.sched-cal-cell--prev-month .sched-cal-day-num { color: #d1d5db; }
.sched-cal-cell--prev-month:hover { background: #f3f4f6; }
.sched-cal-cell--today { background: #f3f9ec; border-color: #6BA53955; }
.sched-cal-cell--today .sched-cal-day-num { color: #4F8F2F; font-weight: 700; }
.sched-cal-week-num {
  font-size: .65rem;
  font-weight: 600;
  color: #9ca3af;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: .3rem;
  cursor: default;
}
.sched-cal-week-label {
  font-size: .65rem;
  font-weight: 600;
  color: #9ca3af;
  text-align: center;
  padding: .25rem 0;
}
.sched-cal-day-num {
  font-size: .75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .2rem;
}
.sched-cal-card {
  border-radius: .2rem;
  padding: .15rem .3rem;
  margin-bottom: .15rem;
  font-size: .65rem;
  line-height: 1.3;
  background: #dbeafe;
  border-left: 3px solid #3b82f6;
  cursor: pointer;
}
.sched-cal-card--overdue   { background: #fee2e2; border-left-color: #ef4444; }
.sched-cal-card--rescheduled { background: #fef3c7; border-left-color: #f59e0b; }
.sched-cal-card--completed { background: #d1fae5; border-left-color: #10b981; }
.sched-cal-card--cancelled { background: #f3f4f6; border-left-color: #9ca3af; }
.sched-cal-card-client { display: block; font-weight: 600; }
.sched-cal-card-area   { display: block; color: #374151; }
.sched-cal-card-user   { display: block; color: #6b7280; }
.sched-item-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: .375rem;
  padding: .6rem;
  margin-bottom: .5rem;
}
.sched-my-heading {
  margin-bottom: 1rem;
  gap: 1rem;
  align-items: flex-start;
}
.sched-my-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: flex-end;
}
.sched-my-filter {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 34px;
  padding: .38rem .62rem;
  border-radius: .45rem;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: .82rem;
  font-weight: 600;
}
.sched-my-filter span {
  min-width: 1.4rem;
  padding: .05rem .35rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: .72rem;
  text-align: center;
}
.sched-my-filter.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary-light);
  color: var(--accent-primary-dark);
}
.sched-my-filter.active span {
  background: var(--accent-primary);
  color: #fff;
}
.sched-my-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.sched-my-card {
  min-height: 245px;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.sched-my-card--completed { border-left: 4px solid #10b981; }
.sched-my-card--cancelled { border-left: 4px solid #9ca3af; }
.sched-my-card--pending { border-left: 4px solid #3b82f6; }
.sched-my-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: start;
}
.sched-my-card__title {
  min-width: 0;
}
.sched-my-card__title strong,
.sched-my-card__title span {
  display: block;
  overflow-wrap: anywhere;
}
.sched-my-card__title strong {
  font-size: .96rem;
  line-height: 1.25;
}
.sched-my-card__title span {
  margin-top: .18rem;
  color: #374151;
  font-size: .86rem;
  font-weight: 600;
}
.sched-my-card__status {
  justify-self: end;
  white-space: nowrap;
}
.sched-my-meta {
  display: grid;
  gap: .45rem;
}
.sched-my-meta div {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: .5rem;
  align-items: baseline;
}
.sched-my-meta span {
  color: #6b7280;
  font-size: .76rem;
}
.sched-my-meta strong {
  color: #374151;
  font-size: .83rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.sched-my-reason {
  margin: 0;
  color: #6b7280;
  font-size: .78rem;
  line-height: 1.35;
}
.sched-my-reason--empty {
  visibility: hidden;
}
.sched-my-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: .25rem;
}
.sched-my-actions .primary-button,
.sched-my-actions .ghost-button {
  min-height: 34px;
  padding: .35rem .75rem;
  font-size: .82rem;
}
.sched-my-empty {
  color: #6b7280;
  margin: .5rem 0 0;
}
@media (max-width: 900px) {
  .sched-layout { flex-direction: column; }
  .sched-panel  { width: 100%; }
  .sched-my-heading {
    flex-direction: column;
  }
  .sched-my-filters {
    justify-content: flex-start;
  }
}

/* ── Home / Inicio ──────────────────────────────────────────────────────────── */

.home-welcome {
  margin-bottom: 4px;
}

.home-welcome__title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
}

.home-welcome__sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.home-modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

@media (max-width: 960px) {
  .home-modules-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .home-modules-grid { grid-template-columns: 1fr; }
}

.home-module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 20px 26px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.13);
  border-color: var(--accent-primary);
}

.home-module-card__icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.home-module-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.home-module-card__desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: -4px;
}
