:root {
  --bg: #f2f5f1;
  --bg-accent: #dce8d9;
  --panel: #ffffff;
  --accent: #0d5b43;
  --accent-dark: #083a2b;
  --text: #1f2b24;
  --muted: #5d6d64;
  --border: #c7d5cc;
  --danger: #8d1f1f;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 400px at 10% 0%, var(--bg-accent), transparent 60%),
    radial-gradient(1000px 300px at 90% 0%, #e5efe1, transparent 55%),
    var(--bg);
}

.topbar {
  padding: 0.9rem 1.4rem;
  background: linear-gradient(120deg, var(--accent-dark), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--topbar-height);
}

.topbar-brand {
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.topbar a {
  color: #f2fff7;
  text-decoration: none;
  font-weight: 600;
}

.user-pill {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: #fff;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

main {
  width: 100%;
  max-width: none;
  margin: 1rem 0;
  padding: 0 1rem 2rem;
}

.hero {
  margin-bottom: 1rem;
}

.hero h1 {
  margin-bottom: 0.35rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 16px rgba(23, 33, 27, 0.04);
}

.flash {
  background: #d7f2df;
  border: 1px solid #79b28a;
  padding: 0.7rem;
  margin-bottom: 1rem;
  border-radius: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
}

.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input,
select,
button {
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

input:focus,
select:focus {
  outline: 2px solid rgba(13, 91, 67, 0.25);
  border-color: var(--accent);
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: #0b4d39;
}

.inline-form {
  display: flex;
  gap: 0.6rem;
  align-items: end;
  flex-wrap: wrap;
}

.actions-cell {
  min-width: 220px;
}

.small-button {
  padding: 0.4rem 0.55rem;
  font-size: 0.83rem;
}

.danger-button {
  background: #8d1f1f;
}

.danger-button:hover {
  background: #6f1616;
}

.details {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.3rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.45rem;
  text-align: left;
}

th {
  background: #edf3ee;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.table-container .data-table {
  margin: 0;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.table-container .data-table th,
.table-container .data-table td {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table-container .data-table tr:last-child td {
  border-bottom: none;
}

.table-cell-main {
  min-width: 280px;
  max-width: 620px;
}

.col-severity {
  width: 120px;
  min-width: 110px;
}

.col-code {
  width: 190px;
  min-width: 160px;
}

.col-num {
  width: 90px;
  min-width: 80px;
}

.col-xpath {
  width: 320px;
  min-width: 240px;
}

.col-actions {
  width: 130px;
  min-width: 110px;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.technical-value {
  font-family: "Consolas", "Cascadia Mono", "Menlo", monospace;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.expandable-text {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.expandable-summary {
  cursor: pointer;
}

.expandable-full {
  margin-top: 0.45rem;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: #f8fbf8;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-details summary {
  cursor: pointer;
}

.inline-details-body {
  margin-top: 0.5rem;
}

.technical-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.45rem;
  background: #f9fcf9;
}

.technical-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.technical-body {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.77rem;
  font-weight: 700;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-badge-neutral {
  color: #1b3a2e;
  background: #e6efe9;
  border-color: #b9cfbf;
}

.status-badge-success {
  color: #0d4f31;
  background: #d8f2df;
  border-color: #9ed0ac;
}

.status-badge-warning {
  color: #6a4b04;
  background: #f8ebc7;
  border-color: #e8d18e;
}

.status-badge-danger {
  color: #6e1f1f;
  background: #f8d8d8;
  border-color: #e3a8a8;
}

.filter-bar {
  display: flex;
  align-items: end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.filter-bar label {
  min-width: 220px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.summary-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  background: #f8fbf8;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

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

.summary-item strong {
  font-size: 1.1rem;
}

.detail-panel {
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.hint {
  color: var(--muted);
  margin-top: 0;
}

.hint-block {
  margin-top: 0.9rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--muted);
}

.validation-summary {
  color: var(--danger);
  margin-bottom: 0.6rem;
}

.validation-message {
  color: var(--danger);
  font-size: 0.85rem;
}

.auth-panel {
  max-width: 520px;
}

.logout-form {
  margin: 0;
}

.admin-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1rem;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 0.7rem);
  max-height: calc(100vh - var(--topbar-height) - 1.4rem);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.admin-sidebar h2 {
  margin: 0 0 0.8rem;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.admin-nav a:hover {
  background: #edf3ee;
}

.admin-nav a.active {
  background: #e2efe7;
  border-color: #9fbea9;
  font-weight: 700;
}

.admin-nav-group {
  margin-top: 0.7rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.admin-main {
  min-width: 0;
}

.customer-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1rem;
  align-items: start;
}

.customer-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 0.7rem);
  max-height: calc(100vh - var(--topbar-height) - 1.4rem);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.customer-sidebar h2 {
  margin: 0 0 0.8rem;
}

.customer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.customer-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.customer-nav a:hover {
  background: #edf3ee;
}

.customer-nav a.active {
  background: #e2efe7;
  border-color: #9fbea9;
  font-weight: 700;
}

.customer-main {
  min-width: 0;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}

.permission-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  margin: 0;
}

.permission-group legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.permission-checkbox {
  justify-content: flex-start;
}

.breadcrumbs {
  margin-bottom: 0.55rem;
  color: var(--muted);
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  background: #f7faf7;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.8rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.muted {
  color: var(--muted);
}

ul.clean-list {
  margin: 0;
  padding-left: 1.1rem;
}

.pager {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pager a {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  color: var(--text);
  background: #f6faf7;
}

.pager a:hover {
  background: #edf3ee;
}

.pager-disabled {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  color: var(--muted);
  background: #f7f9f8;
}

@media (max-width: 768px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .customer-shell {
    grid-template-columns: 1fr;
  }

  .customer-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

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

  .table-container .data-table {
    min-width: 640px;
  }

  .filter-bar label {
    min-width: 180px;
    flex: 1 1 180px;
  }
}
