:root {
  --bg: #050910;
  --panel: #0b1220;
  --panel-alt: #0f1a2d;
  --border: rgba(255, 255, 255, 0.08);
  --muted: #9fb4d3;
  --text: #e7edf8;
  --accent: #7cf0bd;
  --accent-strong: #1ad48a;
  --danger: #ff7b7b;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  --glow-one: rgba(124, 240, 189, 0.1);
  --glow-two: rgba(255, 159, 67, 0.12);
}

:root[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-alt: #f8fafc;
  --border: rgba(0, 0, 0, 0.08);
  --muted: #516174;
  --text: #0f1a2d;
  --accent: #1ad48a;
  --accent-strong: #0fb971;
  --danger: #d14343;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.1);
  --glow-one: rgba(26, 212, 138, 0.08);
  --glow-two: rgba(15, 185, 113, 0.06);
}

body {
  min-height: 100vh;
  background: radial-gradient(
      circle at 10% 10%,
      var(--glow-one),
      transparent 30%
    ),
    radial-gradient(circle at 90% 20%, var(--glow-two), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: "Manrope", "Space Grotesk", system-ui, -apple-system, sans-serif;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
}

a {
  color: var(--text);
}

.pwa-wrapper {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  align-self: stretch;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: grid;
  gap: 1.25rem;
  margin: 0 auto;
}

body[data-auth="out"] .pwa-wrapper {
  max-width: 520px;
}

.main-panel {
  display: grid;
  gap: 0.5rem;
}

.panel-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
}

.session-status {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.panel-intro {
  display: grid;
  gap: 0.1rem;
}

.panel-tools {
  display: grid;
  gap: 0.6rem;
  width: 100%;
}

.search-shell {
  position: relative;
  width: 100%;
}

.search-input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
}

.search-input input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0.6rem 0.4rem;
  font-size: 1rem;
}

.search-input input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.02);
}

.search-results {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: calc(100% + 0.35rem);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow: auto;
  z-index: 4;
}

.search-result {
  width: 100%;
  border: none;
  background: transparent;
  display: grid;
  gap: 0.25rem;
  text-align: left;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover,
.search-result:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.search-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.search-title {
  font-weight: 700;
}

.search-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.search-detail {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
}

.search-empty {
  padding: 0.8rem 0.95rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-empty.error {
  color: #ffb0b0;
}

.row-highlight {
  background: rgba(122, 240, 189, 0.12) !important;
  transition: background 0.35s ease;
}

.customer-profile {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}

.customer-profile[hidden] {
  display: none;
}

.customer-profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.customer-profile-panel {
  position: relative;
  max-width: 1100px;
  width: min(1100px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  max-height: 90vh;
  overflow: hidden;
  z-index: 41;
}

.customer-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-tab {
  padding: 0.6rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.profile-tab.active {
  background: rgba(122, 240, 189, 0.14);
  border-color: rgba(122, 240, 189, 0.6);
  font-weight: 700;
}

.profile-panels {
  overflow: auto;
  max-height: 65vh;
}

.profile-panel {
  display: grid;
  gap: 0.75rem;
}

.profile-panel[hidden] {
  display: none;
}

.attachment-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  background: linear-gradient(120deg, rgba(122, 240, 189, 0.08), rgba(255, 255, 255, 0.02));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}

.attachment-dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.attachment-dropzone.is-dragover {
  border-color: rgba(122, 240, 189, 0.7);
  background: rgba(122, 240, 189, 0.12);
  transform: translateY(-1px);
}

.attachment-dropzone.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.attachment-dropzone h4 {
  margin: 0;
}

.attachment-dropzone-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.attachment-name {
  font-weight: 700;
}

.attachment-row .meta {
  margin-top: 0.1rem;
}

@media (max-width: 640px) {
  .attachment-dropzone {
    flex-direction: column;
    align-items: flex-start;
  }

  .attachment-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.profile-list-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.contact-profile .customer-profile-panel {
  max-width: 900px;
}

.related-box {
  margin-top: 0.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.related-title {
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 81;
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.add-form {
  display: grid;
  gap: 0.75rem;
}

.line-items-field {
  border: 1px solid var(--border);
  background: var(--panel-alt);
  padding: 0.75rem;
  border-radius: 12px;
  display: grid;
  gap: 0.65rem;
}

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

.line-items-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.line-items-title {
  font-weight: 600;
}

.line-items-list {
  display: grid;
  gap: 0.6rem;
}

.prebuild-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.prebuild-controls select {
  min-width: 180px;
}

.line-item-row {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1.2fr 1.2fr 0.6fr 0.8fr 0.7fr auto;
  align-items: end;
}

.line-item-row .field {
  margin: 0;
}

.line-item-total {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  font-weight: 600;
  min-width: 120px;
}

.line-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.line-items-summary {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 900px) {
  .line-item-row {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

.site-profile .customer-profile-panel {
  max-width: 1000px;
}

.job-profile .customer-profile-panel {
  max-width: 900px;
}

.quote-profile .customer-profile-panel,
.order-profile .customer-profile-panel,
.invoice-profile .customer-profile-panel {
  max-width: 900px;
}

.material-profile .customer-profile-panel {
  max-width: 720px;
}

.user-profile .customer-profile-panel {
  max-width: 720px;
}

.info-grid {
  display: grid;
  gap: 0.4rem;
}

.info-grid .meta {
  color: var(--muted);
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.category-browser {
  border: 1px solid var(--border);
  background: var(--panel-alt);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.import-errors {
  margin-top: 0.35rem;
  display: grid;
  gap: 0.25rem;
}

.import-error {
  color: var(--muted);
  font-size: 0.9rem;
}

.category-browser-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.category-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.category-node {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}

.category-row.active {
  background: rgba(26, 212, 138, 0.1);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}

.category-name {
  font-weight: 600;
}

.category-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.category-children {
  list-style: none;
  margin: 0.5rem 0 0 0.25rem;
  padding-left: 0.75rem;
  border-left: 1px dashed var(--border);
  display: grid;
  gap: 0.35rem;
}

.category-add-form {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.profile-link {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.profile-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.pill-row,
.chip-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill.accent {
  background: rgba(122, 240, 189, 0.18);
  border-color: rgba(122, 240, 189, 0.6);
  color: var(--text);
}

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

.pill.warning {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.12);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  text-transform: capitalize;
}

.status-quote-draft {
  color: #94a3b8;
}

.status-quote-pending_check,
.status-quote-awaiting_decision {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.7);
  background: rgba(251, 191, 36, 0.15);
}

.status-quote-sent_to_client {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
}

.status-quote-won {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.7);
  background: rgba(52, 211, 153, 0.14);
}

.status-quote-lost {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(248, 113, 113, 0.14);
}

.status-quote-archived {
  color: #cbd5e1;
}

.status-job-received,
.status-job-clarified,
.status-job-logged {
  color: #94a3b8;
}

.status-job-assigned,
.status-job-accepted {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
}

.status-job-en_route {
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.6);
  background: rgba(168, 85, 247, 0.14);
}

.status-job-on_site {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.7);
  background: rgba(251, 191, 36, 0.14);
}

.status-job-completed,
.status-job-completed_follow_up {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.7);
  background: rgba(52, 211, 153, 0.14);
}

.mobile-only {
  display: inline-flex;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .button {
  background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .button.ghost {
  background: rgba(0, 0, 0, 0.04);
}

.button.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  border-color: rgba(26, 212, 138, 0.65);
  color: #04120c;
  font-weight: 700;
}

.button.danger {
  background: rgba(255, 123, 123, 0.1);
  border-color: rgba(255, 123, 123, 0.3);
  color: #ffc5c5;
}

.auth-stack {
  display: grid;
  gap: 1rem;
}

.tab-row {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.25rem;
  gap: 0.35rem;
}

.tab {
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: rgba(122, 240, 189, 0.16);
  color: var(--text);
  font-weight: 700;
}

.tab-panel.hidden {
  display: none;
}

.form-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.04)
  );
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  display: grid;
  gap: 0.9rem;
}

.form-card.compact {
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
}

.form-card.compact h3,
.form-card.compact p {
  margin: 0;
}

.form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.dual-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.field input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  width: 100%;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.ts-control {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.25rem 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  min-height: 42px;
}

.ts-control input {
  color: inherit;
}

.ts-control .item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  margin: 0.15rem;
}

.ts-dropdown {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.ts-dropdown .active {
  background: rgba(255, 255, 255, 0.06);
}

.option-skill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.toggle input {
  accent-color: var(--accent-strong);
  width: 1.1rem;
  height: 1.1rem;
}

.chip-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.status-line {
  color: var(--muted);
  font-size: 0.95rem;
}

.status-line.error {
  color: var(--danger);
}

.app-shell {
  display: block;
}

.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  position: relative;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--panel-alt);
  border-right: 1px solid var(--border);
  transform: translateX(-110%);
  transition: transform 0.25s ease;
  padding: 1rem;
  z-index: 30;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.5rem;
}

.nav-pill {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
}

.nav-pill.active {
  background: rgba(122, 240, 189, 0.12);
  border-color: rgba(122, 240, 189, 0.4);
  font-weight: 700;
}

.sidebar-meta {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 20;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

.content-area {
  display: grid;
  gap: 1rem;
}

.content-area .content-grid,
.content-area .admin-forms {
  display: none;
}

body[data-admin-view="settings"] #admin-panel {
  display: none;
}

.content-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
}

#sidebar-toggle {
  margin-left: auto;
  order: 3;
}

.content-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.admin-forms {
  display: grid;
  gap: 1rem;
}

.admin-form-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.admin-form {
  display: grid;
  gap: 0.75rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  background: linear-gradient(180deg, var(--panel-alt), var(--panel));
  box-shadow: var(--shadow);
}

.session-card h3 {
  margin: 0.35rem 0;
}

.session-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.card-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.settings-skill-heading {
  margin-top: 1.25rem;
}

.form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.table-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.table-scroll tbody tr td {
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.table-scroll tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--accent);
}

.table-scroll th,
.table-scroll td {
  text-align: left;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.table-scroll th {
  color: var(--muted);
  font-weight: 700;
}

#role-table {
  table-layout: fixed;
}

#role-table th,
#role-table td {
  white-space: normal;
  word-break: break-word;
}

#role-table td:last-child {
  width: 9rem;
}

#role-table td:nth-child(3) {
  width: 7rem;
}

.permission-grid table {
  width: 100%;
  border-collapse: collapse;
}

.permission-grid th,
.permission-grid td {
  text-align: left;
  padding: 0.4rem 0.35rem;
  color: var(--text);
}

.permission-grid th {
  color: var(--muted);
  font-weight: 700;
}

.permission-grid label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.permission-grid input[type='checkbox'] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  cursor: pointer;
  transition: all 0.16s ease;
}

.permission-grid input[type='checkbox']:checked {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: var(--accent-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.permission-grid input[type='checkbox']:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  font-size: 12px;
  color: #0b1220;
  font-weight: 700;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
}

.accordion + .accordion {
  margin-top: 0.75rem;
}

.accordion summary {
  list-style: none;
  cursor: pointer;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary::marker {
  display: none;
}

.accordion[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
}
.list {
  display: grid;
  gap: 0.65rem;
}

.list li {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.25rem;
}

.list .meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.list .pill {
  width: fit-content;
}

.filter-row {
  padding: 0.3rem 0.75rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.field.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-row [data-filter-group] {
  display: none !important;
}

.filter-row [data-filter-group].filter-active {
  display: inline-flex !important;
}

.field.inline select,
.field.inline input {
  min-width: 160px;
  width: auto;
}

.history-block {
  margin-top: 1rem;
}

.history-block .list {
  margin-top: 0.35rem;
}

.history-block li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.history-block li:last-child {
  border-bottom: none;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  display: inline-block;
}

.dot.accent {
  background: var(--accent);
}

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

.hidden {
  display: none;
}

body[data-auth="in"] #auth-views {
  display: none;
}

body[data-auth="out"] #app-shell {
  display: none;
}

@media (min-width: 640px) {
  body {
    padding: 1rem;
  }

  .pwa-wrapper {
    padding: 1.5rem;
    border-radius: 22px;
    gap: 1.4rem;
  }

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

  .card-heading {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-forms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  body {
    padding: 1rem;
  }

  .pwa-wrapper {
    padding: 1.75rem;
    border-radius: 26px;
    gap: 1.5rem;
  }

  .panel-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .panel-tools {
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: center;
  }

  .session-status {
    width: auto;
    justify-content: flex-end;
  }

  .mobile-only {
    display: none;
  }

  .app-layout {
    grid-template-columns: 260px 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: fit-content;
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
  }

  .content-area {
    padding-left: 0.5rem;
  }

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

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