:root {
  --blue-950: #0a1d34;
  --blue-850: #102b4b;
  --blue-700: #145da0;
  --blue-500: #1f78d1;
  --blue-100: #e9f3ff;
  --ink: #142033;
  --muted: #66758a;
  --line: #d9e2ec;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --ok: #168a5b;
  --warn: #b56a00;
  --danger: #b42318;
  --shadow: 0 14px 32px rgba(20, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: var(--blue-950);
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--blue-500);
  border-radius: 6px;
  font-weight: 800;
}

.brand small,
.role-card p,
.eyebrow,
.task-card p,
.card-meta,
.project-title span,
td small {
  color: var(--muted);
}

.brand small {
  color: #b9c9da;
  display: block;
  margin-top: 3px;
}

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

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #dce8f5;
  text-align: left;
  padding: 12px 13px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.role-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.role-card label {
  display: grid;
  gap: 8px;
  color: #dce8f5;
  font-weight: 700;
}

.role-card select {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 10px;
}

.role-card p {
  color: #c8d7e8;
  margin: 12px 0 0;
  line-height: 1.45;
}

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

.topbar {
  min-height: 88px;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 26px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.sidebar-backdrop {
  display: none;
}

.user-pill,
.status-pill,
.connection-pill,
.visibility,
.status,
.priority,
.type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.user-pill,
.status-pill {
  background: var(--blue-100);
  color: var(--blue-700);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.connection-pill.demo {
  background: #fff4df;
  color: var(--warn);
}

.connection-pill.online {
  background: #e7f7ef;
  color: var(--ok);
}

.view-root {
  padding: 26px 28px 42px;
  display: grid;
  gap: 22px;
}

.panel,
.login-panel,
.access-panel,
.metric-card,
.portal-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.login-panel,
.access-panel,
.portal-hero {
  padding: 20px;
}

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

.panel-heading h2,
.login-panel h2,
.portal-hero h2,
.compact-form h2 {
  margin: 0;
  font-size: 20px;
}

.primary-action,
.secondary-action {
  border: 1px solid var(--blue-700);
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-action {
  background: var(--blue-700);
  color: #fff;
}

.secondary-action {
  background: #fff;
  color: var(--blue-700);
}

.logout-action {
  min-height: 34px;
  padding: 7px 10px;
}

.primary-action:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-grid,
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
}

.login-panel p {
  line-height: 1.6;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

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

.access-panel {
  display: grid;
  gap: 12px;
}

.role-row {
  border-left: 4px solid var(--blue-500);
  padding: 8px 0 8px 12px;
}

.role-row strong,
.role-row span,
td small {
  display: block;
}

.role-row span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

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

.customer-metrics .metric-card {
  box-shadow: none;
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric-card strong {
  font-size: 34px;
  color: var(--blue-700);
}

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

.task-stack,
.project-list,
.project-cards {
  display: grid;
  gap: 12px;
}

.task-card,
.project-card,
.project-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-card {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.clickable,
.clickable-row {
  cursor: pointer;
}

.clickable:hover,
.clickable-row:hover {
  border-color: var(--blue-500);
  background: #f8fbff;
}

.clickable:focus,
.clickable-row:focus {
  outline: 3px solid var(--blue-100);
  outline-offset: 2px;
}

.task-main strong {
  display: block;
  margin: 7px 0;
  font-size: 16px;
}

.task-main p {
  margin: 0;
  line-height: 1.45;
}

.task-badges {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.task-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.task-meta span {
  background: #f3f6fa;
  border-radius: 6px;
  padding: 6px 8px;
}

.type {
  background: #eef2f7;
  color: var(--blue-850);
}

.status {
  background: #edf4ff;
  color: var(--blue-700);
}

.status-wartet-auf-kunde,
.status-wartet-auf-material {
  background: #fff4df;
  color: var(--warn);
}

.status-zur-prufung {
  background: #fff4df;
  color: var(--warn);
}

.status-abgenommen,
.status-erledigt-gemeldet {
  background: #e7f7ef;
  color: var(--ok);
}

.priority {
  background: #eef2f7;
  color: var(--muted);
}

.priority-hoch {
  background: #fff4df;
  color: var(--warn);
}

.priority-kritisch {
  background: #ffe8e5;
  color: var(--danger);
}

.project-row {
  padding: 13px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.project-row span,
.card-meta {
  display: block;
  margin-top: 5px;
}

.project-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.project-title,
.card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-title strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.visibility {
  background: #eef2f7;
  color: var(--muted);
}

.visibility.on {
  background: #e7f7ef;
  color: var(--ok);
}

.visibility.proposal {
  background: #fff4df;
  color: var(--warn);
}

.area-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.area-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--blue-850);
  background: #fbfdff;
  font-size: 12px;
  font-weight: 800;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle span {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.view-toggle span:first-child {
  background: var(--blue-700);
  color: #fff;
}

.wide {
  grid-column: 1 / -1;
}

.upload-drop {
  border: 1px dashed var(--blue-500);
  border-radius: 8px;
  background: #f8fbff;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.upload-drop span {
  color: var(--muted);
}

.form-actions,
.portal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.portal-hero {
  background: var(--blue-850);
  color: #fff;
}

.read-only-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  font-weight: 800;
}

.portal-hero .eyebrow,
.portal-hero p {
  color: #cfe0f2;
}

.portal-hero p {
  max-width: 720px;
  line-height: 1.55;
}

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdff;
}

.error-banner {
  border: 1px solid #ffc9c2;
  border-radius: 8px;
  background: #fff1ef;
  color: var(--danger);
  padding: 12px 14px;
  font-weight: 800;
}

.detail-panel {
  display: grid;
  gap: 18px;
}

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

.detail-main {
  display: grid;
  gap: 18px;
}

.detail-main p {
  margin: 0;
  line-height: 1.6;
}

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

.fact {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.fact span,
.muted-text {
  color: var(--muted);
}

.fact span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.fact strong {
  display: block;
  line-height: 1.35;
}

.detail-side,
.detail-edit-form,
.project-edit-form,
.master-list,
.master-edit-form,
.user-admin-card,
.user-password-form,
.user-projects-form,
.area-editor,
.area-edit-form,
.area-create-form,
.permission-note,
.detail-support,
.attachment-list,
.attachment-form {
  display: grid;
  gap: 12px;
}

.detail-edit-form,
.project-edit-form,
.permission-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

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

.master-list,
.area-editor {
  display: grid;
  gap: 12px;
}

.master-edit-form,
.area-edit-form,
.area-create-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.user-admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.user-password-form,
.user-projects-form {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.user-password-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.user-delete-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.area-editor {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.area-edit-form,
.area-create-form {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.member-picker,
.toggle-label,
.check-row {
  display: grid;
  gap: 8px;
}

.member-picker {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.toggle-label,
.check-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.detail-edit-form h3,
.permission-note strong,
.detail-support h2 {
  margin: 0;
}

.permission-note span {
  color: var(--muted);
  line-height: 1.45;
}

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

.history-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.attachment-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fbfdff;
  display: grid;
  gap: 0;
}

.attachment-list {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.attachment-info {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
}

.attachment-info strong {
  color: var(--blue-700);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.attachment-info span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.attachment-preview-trigger,
.attachment-file-placeholder {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #eaf1f8;
  border: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.attachment-preview-trigger {
  cursor: pointer;
}

.attachment-preview-trigger img {
  height: 100%;
  object-fit: cover;
  transition: transform 160ms ease;
  width: 100%;
}

.attachment-preview-trigger:hover img {
  transform: scale(1.025);
}

.pdf-preview,
.attachment-file-placeholder {
  color: var(--blue-700);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .08em;
}

.attachment-actions {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px 12px;
}

.attachment-actions .secondary-action,
.attachment-actions .danger-action {
  font-size: 13px;
  padding: 8px 10px;
}

.attachment-viewer {
  align-items: center;
  background: rgba(5, 20, 38, .88);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 1000;
}

.attachment-viewer-dialog {
  background: #fff;
  border-radius: 12px;
  display: grid;
  max-height: calc(100vh - 40px);
  max-width: 1100px;
  overflow: hidden;
  width: 100%;
}

.attachment-viewer-dialog > header,
.attachment-viewer-dialog > footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.attachment-viewer-dialog > header div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-viewer-dialog > header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-viewer-dialog > header span {
  color: var(--muted);
  font-size: 12px;
}

.viewer-close,
.viewer-nav {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  font-size: 28px;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.attachment-viewer-stage {
  align-items: center;
  background: #101820;
  display: flex;
  justify-content: center;
  min-height: 300px;
  overflow: hidden;
  position: relative;
}

.attachment-viewer-stage img {
  max-height: calc(100vh - 170px);
  max-width: 100%;
  object-fit: contain;
}

.attachment-viewer-stage iframe {
  background: #fff;
  border: 0;
  height: calc(100vh - 170px);
  min-height: 420px;
  width: 100%;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}

.viewer-prev { left: 12px; }
.viewer-next { right: 12px; }

.attachment-form {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.danger-action {
  border: 1px solid #d06a6a;
  background: #fff5f5;
  color: #9b1c1c;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
}

.archive-action {
  margin-top: 12px;
}

.archive-pill {
  margin-left: 8px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9;
    border: 0;
    background: rgba(15, 23, 42, 0.45);
  }

  .mobile-menu {
    display: grid;
    place-items: center;
  }

  .metric-grid,
  .login-grid,
  .dashboard-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 14px 16px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .view-root {
    padding: 16px;
  }

  .user-pill {
    display: none;
  }

  .topbar-status {
    justify-content: flex-start;
  }

  .metric-grid,
  .login-grid,
  .dashboard-layout,
  .form-grid,
  .filter-grid,
  .task-form {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .project-title,
  .card-actions,
  .form-actions,
  .portal-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .task-card {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .detail-facts,
  .detail-support {
    grid-template-columns: 1fr;
  }

  .task-badges {
    justify-content: flex-start;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
  }

  td {
    border: 0;
    padding: 8px 4px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
  }

  button,
  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-height: 44px;
  }
}

/* Mobile-first notepad mode */
.settings-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  display: grid;
  gap: 6px;
  min-height: 110px;
  padding: 18px;
  text-align: left;
}

.settings-card span {
  color: var(--muted);
  font-size: 13px;
}

.simple-project-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.simple-project-heading span {
  color: var(--muted);
  font-size: 12px;
}

.simple-project-heading h2 {
  margin: 4px 0 0;
}

.simple-project-heading > strong {
  background: var(--blue-100);
  border-radius: 999px;
  color: var(--blue-700);
  padding: 7px 10px;
  white-space: nowrap;
}

.add-note-button {
  background: #f4f8fd;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--blue-700);
  font-weight: 900;
  min-height: 52px;
  padding: 12px 16px;
  text-align: left;
  width: 100%;
}

.simple-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
  white-space: nowrap;
}

.simple-status-offen {
  background: #e8f2ff;
  color: var(--blue-700);
}

.simple-status-vorschlag {
  background: #fff0c7;
  color: #8b5200;
}

.simple-status-erledigt {
  background: #e7f7ef;
  color: var(--ok);
}

.simple-status-abgelehnt {
  background: #fff0f0;
  color: #9b1c1c;
}

.note-compose {
  margin: 0 auto;
  max-width: 680px;
  width: 100%;
}

.back-link {
  background: transparent;
  border: 0;
  color: var(--blue-700);
  font-weight: 800;
  margin-bottom: 14px;
  padding: 8px 0;
}

.note-context {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.note-context span {
  color: var(--muted);
  font-size: 13px;
}

.note-context strong {
  font-size: 24px;
}

.note-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  padding: 22px;
}

.note-form textarea {
  font-size: 17px;
  min-height: 190px;
}

.photo-field span,
.proposal-review-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.save-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.note-save-button {
  font-size: 16px;
  min-height: 52px;
}

.note-detail-body {
  display: grid;
  gap: 18px;
}

.note-text {
  font-size: 18px;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
}

.note-byline {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 10px;
}

.note-management {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.note-management > summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  padding: 14px 16px;
}

.note-management > summary::-webkit-details-marker {
  display: none;
}

.note-management > summary::after {
  color: var(--blue-700);
  content: "+";
  float: right;
  font-size: 20px;
}

.note-management[open] > summary::after {
  content: "−";
}

.note-content-form {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 16px;
}

.note-content-form label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.note-delete-action {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.note-delete-action div {
  display: grid;
  gap: 4px;
}

.note-delete-action span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  .note-delete-action {
    align-items: stretch;
    flex-direction: column;
  }
}

.simple-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.simple-permissions {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.simple-permissions legend {
  color: var(--ink);
  font-weight: 800;
  padding: 0 6px;
}

.simple-permissions small {
  color: var(--muted);
}

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

  .sidebar {
    background: var(--blue-950);
    bottom: 0;
    display: block;
    height: auto;
    inset: auto 0 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    position: fixed;
    transform: none;
    width: 100%;
    z-index: 20;
  }

  .sidebar .brand,
  .sidebar .role-card,
  .sidebar .nav-section-label,
  .sidebar .nav-item[data-view="login"] {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 5px;
  }

  .nav-item {
    flex: 1 1 0;
    min-height: 50px;
    padding: 8px 6px;
    text-align: center;
  }

  .nav-item[data-view="tasks"] {
    justify-content: center;
    gap: 6px;
  }

  .mobile-menu,
  .sidebar-backdrop {
    display: none !important;
  }

  .main-content {
    padding-bottom: 74px;
  }

  .topbar {
    min-height: 62px;
    padding: 10px 14px;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .compact-intro {
    padding: 16px;
  }

  .compact-intro h2 {
    font-size: 25px;
  }

  .settings-menu,
  .simple-support {
    grid-template-columns: 1fr;
  }

  .simple-project-heading {
    align-items: flex-start;
  }

  .project-workspace,
  .panel {
    padding: 16px;
  }

  .area-work-card > summary {
    min-height: 62px;
  }

  .area-task-row {
    gap: 10px;
  }

  .note-form {
    border-radius: 14px;
    padding: 16px;
  }

  .note-save-button {
    position: sticky;
    bottom: 82px;
  }

  .note-detail .panel-heading {
    gap: 12px;
  }

  .simple-task-actions {
    display: grid;
  }
}

/* Customer proposal inbox */
.nav-item[data-view="tasks"] {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.nav-badge {
  background: #f59e0b;
  border-radius: 999px;
  color: #172033;
  font-size: 11px;
  font-weight: 900;
  min-width: 24px;
  padding: 4px 7px;
  text-align: center;
}

.proposal-inbox {
  border-color: #f3c86f;
}

.proposal-inbox.has-items {
  background: linear-gradient(135deg, #fffdf8 0%, #fff8e8 100%);
  box-shadow: 0 10px 30px rgba(181, 106, 0, .10);
}

.proposal-count,
.proposal-badge {
  align-items: center;
  background: #fff0c7;
  border: 1px solid #f2c55c;
  border-radius: 999px;
  color: #8b5200;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 28px;
  padding: 4px 9px;
  white-space: nowrap;
}

.proposal-count {
  margin-left: 6px;
  min-width: 28px;
  justify-content: center;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filter {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  min-height: 40px;
  padding: 8px 14px;
}

.quick-filter:hover,
.quick-filter.active {
  background: var(--blue-100);
  border-color: var(--blue-500);
  color: var(--blue-700);
}

.quick-filter.highlight:not(.active) {
  background: #fff8e8;
  border-color: #f2c55c;
  color: #8b5200;
}

.proposal-review-form {
  background: #fffaf0;
  border: 1px solid #f2c55c;
  border-radius: 12px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.proposal-review-heading h3 {
  margin: 10px 0 5px;
}

.proposal-review-heading p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.proposal-actions {
  display: grid;
  gap: 8px;
}

.proposal-actions button {
  min-height: 44px;
  width: 100%;
}

@media (max-width: 720px) {
  .quick-filters {
    flex-wrap: nowrap;
    margin-inline: -14px;
    overflow-x: auto;
    padding: 0 14px 4px;
  }

  .quick-filter {
    flex: 0 0 auto;
  }
}

/* Compact project drill-down */
.list-toggle {
  background: transparent;
  border: 0;
  color: var(--blue-700);
  display: block;
  font-weight: 800;
  margin: 14px auto 0;
  min-height: 40px;
  padding: 8px 14px;
}

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

.project-select-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 15px;
  text-align: left;
}

.project-select-card:hover,
.project-select-card.active {
  background: #f1f7ff;
  border-color: var(--blue-500);
}

.project-select-card.active {
  box-shadow: inset 0 0 0 1px var(--blue-500);
}

.project-select-card span,
.project-select-card small {
  color: var(--muted);
  font-size: 12px;
}

.project-select-card strong {
  font-size: 16px;
}

.project-empty-selection {
  color: var(--muted);
  text-align: center;
}

.project-empty-selection strong {
  color: var(--ink);
  display: block;
  font-size: 18px;
}

.project-empty-selection p {
  margin-bottom: 0;
}

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

.customer-project-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  text-align: left;
}

.customer-project-card:hover,
.customer-project-card:focus-visible {
  background: #f1f7ff;
  border-color: var(--blue-500);
}

.customer-project-card span,
.customer-project-card small {
  color: var(--muted);
}

.customer-project-card span {
  font-size: 13px;
}

.customer-project-card strong {
  font-size: 19px;
}

.customer-project-empty {
  margin: min(12vh, 90px) auto 0;
  max-width: 620px;
  padding: 32px;
  text-align: center;
}

.customer-project-empty h2 {
  margin: 0 0 10px;
}

.customer-project-empty p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.customer-project-detail {
  display: grid;
}

.focused-user-view .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.focused-user-view .sidebar,
.focused-user-view .sidebar-backdrop,
.focused-user-view .sidebar-backdrop.open,
.focused-user-view .mobile-menu,
.focused-user-view .connection-pill {
  display: none;
}

.project-workspace {
  scroll-margin-top: 96px;
}

.workspace-step {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.workspace-step > span {
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 800;
}

.area-work-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.area-work-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.area-work-card > summary {
  align-items: center;
  background: #fbfcfe;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  min-height: 68px;
  padding: 13px 15px;
}

.area-work-card > summary::-webkit-details-marker {
  display: none;
}

.area-work-card > summary strong,
.area-work-card > summary span {
  display: block;
}

.area-work-card > summary div > span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.area-count {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
}

.area-count.has-open {
  background: #fff4df;
  color: var(--warn);
}

.area-count.is-done {
  background: #e7f7ef;
  color: var(--ok);
}

.area-count.has-rejected {
  background: #fff0f0;
  color: #9b1c1c;
}

.area-task-list {
  border-top: 1px solid var(--line);
  display: grid;
}

.area-task-row {
  align-items: center;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  color: var(--ink);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 13px 15px;
  text-align: left;
  width: 100%;
}

.area-task-row:last-child {
  border-bottom: 0;
}

.area-task-row:hover {
  background: #f7faff;
}

.area-task-row strong,
.area-task-row small {
  display: block;
}

.area-task-row > span:first-child {
  flex: 1;
  min-width: 0;
}

.area-task-row small {
  color: var(--muted);
  margin-top: 4px;
}

.area-task-row.done {
  opacity: .58;
}

.area-task-state {
  align-items: flex-end;
  display: grid;
  justify-items: end;
}

.project-row-button {
  align-items: center;
  color: var(--ink);
  text-align: left;
  width: 100%;
}

@media (max-width: 900px) {
  .project-selector {
    grid-template-columns: 1fr;
  }

  .project-select-card {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .project-title {
    align-items: stretch;
    flex-direction: column;
  }

  .area-task-row {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 11px 12px;
  }

  .area-task-row > span:first-child {
    display: block;
    overflow: hidden;
  }

  .area-task-row strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .area-task-row small {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .area-task-row .simple-status {
    flex: 0 0 auto;
  }
}

/* Task-first interface refresh */
body {
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: #f6f8fb;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 20px 16px;
  gap: 20px;
}

.brand {
  padding: 4px 6px 14px;
}

.brand-mark {
  border-radius: 10px;
}

.nav-list {
  gap: 4px;
}

.nav-section-label {
  color: #7f9ab8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  margin: 16px 12px 6px;
  text-transform: uppercase;
}

.nav-item {
  border-radius: 9px;
  min-height: 44px;
  padding: 11px 12px;
}

.nav-item.active {
  background: #fff;
  border-color: #fff;
  color: var(--blue-950);
  font-weight: 800;
}

.nav-create {
  color: #fff;
  font-weight: 800;
}

.role-card {
  border-radius: 12px;
  padding: 13px;
}

.role-card p {
  font-size: 13px;
  margin-top: 8px;
}

.topbar {
  min-height: 76px;
  padding: 14px 30px;
}

.topbar h1 {
  font-size: 23px;
}

.connection-pill.online {
  display: none;
}

.view-root {
  margin: 0 auto;
  max-width: 1320px;
  padding: 28px 32px 52px;
  width: 100%;
}

.panel,
.login-panel,
.access-panel,
.metric-card,
.portal-hero {
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(20, 32, 51, .06);
}

.page-intro,
.work-hero {
  align-items: center;
  background: linear-gradient(135deg, #fff 0%, #f0f6fd 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
}

.page-intro h2,
.work-hero h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin: 4px 0 7px;
}

.page-intro p:not(.eyebrow),
.work-hero p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

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

.metric-card {
  box-shadow: none;
}

.metric-card strong {
  font-size: 30px;
}

.text-action {
  background: transparent;
  border: 0;
  color: var(--blue-700);
  font-weight: 800;
  padding: 8px;
}

.task-list-section {
  min-width: 0;
}

.task-stack-roomy {
  gap: 14px;
}

.task-card {
  border-radius: 12px;
  gap: 10px;
  grid-template-columns: 1fr;
  padding: 17px 18px;
}

.task-card-top {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.task-context {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-main strong {
  font-size: 17px;
  margin: 0 0 5px;
}

.task-main p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-meta {
  border-top: 1px solid #edf1f5;
  gap: 18px;
  padding-top: 10px;
}

.task-meta span {
  background: transparent;
  padding: 0;
}

.task-meta .due-overdue {
  color: var(--danger);
  font-weight: 800;
}

.filter-panel,
.admin-disclosure,
.project-admin-tools,
.user-admin-card {
  overflow: hidden;
}

.filter-panel > summary,
.admin-disclosure > summary,
.project-admin-tools > summary,
.user-admin-card > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 800;
  justify-content: space-between;
  list-style: none;
  min-height: 46px;
}

.filter-panel > summary::-webkit-details-marker,
.admin-disclosure > summary::-webkit-details-marker,
.project-admin-tools > summary::-webkit-details-marker,
.user-admin-card > summary::-webkit-details-marker {
  display: none;
}

.filter-panel > summary::after,
.admin-disclosure > summary::after,
.project-admin-tools > summary::after {
  color: var(--blue-700);
  content: "+";
  font-size: 22px;
}

.filter-panel[open] > summary::after,
.admin-disclosure[open] > summary::after,
.project-admin-tools[open] > summary::after {
  content: "−";
}

.filter-panel[open] > summary,
.admin-disclosure[open] > summary,
.project-admin-tools[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 12px;
}

.project-create-disclosure {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 18px;
  padding: 6px 14px;
}

.project-card {
  border-radius: 12px;
  padding: 18px;
}

.project-admin-tools {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 4px;
}

.user-admin-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 14px;
}

.user-admin-card > summary small {
  color: var(--muted);
  display: block;
  font-weight: 600;
  margin-top: 3px;
}

.user-admin-card[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.logged-out .sidebar,
.logged-out .topbar,
.logged-out .sidebar-backdrop {
  display: none;
}

.logged-out .app-shell {
  display: block;
}

.logged-out .main-content,
.logged-out .view-root {
  min-height: 100vh;
}

.logged-out .view-root {
  align-items: center;
  display: grid;
  justify-items: center;
  max-width: none;
  padding: 32px 18px;
}

.login-screen {
  max-width: 480px;
  width: 100%;
}

.login-panel {
  padding: 36px;
}

.login-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 26px;
}

.login-brand .brand-mark {
  color: #fff;
  flex: 0 0 auto;
}

.login-brand span:not(.brand-mark) {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.login-copy h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.login-copy p {
  color: var(--muted);
  margin: 0 0 24px;
}

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

.login-form .primary-action {
  margin-top: 4px;
  min-height: 48px;
}

.login-help {
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0 0;
}

.demo-login-details {
  border-top: 1px solid var(--line);
  color: var(--muted);
  margin-top: 22px;
  padding-top: 14px;
}

.advanced-fields {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.advanced-fields > summary {
  color: var(--blue-700);
  cursor: pointer;
  font-weight: 800;
}

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

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

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

@media (max-width: 720px) {
  .view-root {
    padding: 16px 14px 36px;
  }

  .page-intro,
  .work-hero,
  .task-card-top {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid-compact {
    grid-template-columns: 1fr;
  }

  .page-intro,
  .work-hero {
    padding: 20px;
  }

  .login-panel {
    padding: 26px 20px;
  }

  .task-badges {
    justify-content: flex-start;
  }

  .task-meta {
    display: grid;
    gap: 7px;
  }

  .task-form-advanced {
    grid-template-columns: 1fr;
  }

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

  .customer-project-empty {
    margin-top: 28px;
    padding: 26px 20px;
  }
}

.area-status-list {
  background: #f4f7fa;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.area-status-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.area-status-section > summary {
  align-items: center;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  list-style: none;
  min-height: 50px;
  padding: 9px 13px;
}

.area-status-section > summary::-webkit-details-marker {
  display: none;
}

.area-status-section > summary span {
  font-weight: 900;
}

.area-status-section > summary strong {
  border-radius: 999px;
  min-width: 30px;
  padding: 5px 8px;
  text-align: center;
}

.area-status-open > summary strong {
  background: #e8f2ff;
  color: var(--blue-700);
}

.area-status-requested > summary strong {
  background: #fff0c7;
  color: #8b5200;
}

.area-status-done > summary strong {
  background: #e7f7ef;
  color: var(--ok);
}

.area-status-rejected > summary strong {
  background: #fff0f0;
  color: #9b1c1c;
}

.area-status-open[open] > summary {
  background: #f1f7ff;
  color: var(--blue-700);
}

.area-status-requested[open] > summary {
  background: #fff8e8;
  color: #8b5200;
}

.area-status-done[open] > summary {
  background: #effaf4;
  color: var(--ok);
}

.area-status-rejected[open] > summary {
  background: #fff5f5;
  color: #9b1c1c;
}

.area-status-list > .add-note-button {
  border: 1px dashed #b9cce2;
  border-radius: 10px;
}

.simple-status-angefragt {
  background: #fff0c7;
  color: #8b5200;
}

.note-visibility-choice {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.note-visibility-choice legend,
.note-visibility-controls > strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 8px;
}

.note-visibility-choice label {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 9px;
  min-height: 58px;
  padding: 10px;
}

.note-visibility-choice label:has(input:checked) {
  background: #f1f7ff;
  border-color: var(--blue-500);
}

.note-visibility-choice strong,
.note-visibility-choice small {
  display: block;
}

.note-visibility-choice small {
  color: var(--muted);
  margin-top: 2px;
}

.note-visibility-controls {
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
}

.note-visibility-controls > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.visibility-action {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  min-height: 40px;
  padding: 8px 12px;
}

.visibility-action.active {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: #fff;
}

.note-files-panel {
  margin-top: 18px;
}

/* Final phone navigation overrides */
[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .attachment-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attachment-info,
  .attachment-actions {
    padding-left: 9px;
    padding-right: 9px;
  }

  .attachment-actions {
    display: grid;
  }

  .attachment-viewer {
    padding: 0;
  }

  .attachment-viewer-dialog {
    border-radius: 0;
    height: 100%;
    max-height: none;
  }

  .attachment-viewer-stage img,
  .attachment-viewer-stage iframe {
    max-height: none;
    height: 100%;
  }

  .attachment-viewer-stage iframe {
    min-height: 0;
  }

  .area-status-list {
    padding: 8px;
  }

  .note-visibility-choice {
    grid-template-columns: 1fr;
  }

  .sidebar {
    inset: auto 0 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    transform: none;
    width: 100%;
  }

  .nav-list {
    display: flex;
    gap: 5px;
  }

  .nav-item {
    flex: 1 1 0;
    min-height: 50px;
    padding: 8px 6px;
    text-align: center;
  }

  .sidebar .brand,
  .sidebar .role-card,
  .sidebar .nav-section-label,
  .sidebar .nav-item[data-view="login"] {
    display: none;
  }
}
