:root {
    color-scheme: light;
    /* Hanemann Corporate Design: Rot und Grau aus Logo und Briefbogen */
    --brand-red: #e2001a;
    --brand-red-dark: #b50015;
    --brand-red-soft: #fdecee;
    --brand-gray: #6d6e70;
    --brand-anthracite: #2e2f31;
    /* Alte Variablennamen bleiben, zeigen aber auf die Hausfarben */
    --navy-950: #2e2f31;
    --navy-900: #3a3b3d;
    --navy-800: #4a4b4e;
    --navy-700: #6d6e70;
    --teal-700: #b50015;
    --teal-600: #e2001a;
    --teal-100: #fdecee;
    --orange-600: #b45309;
    --orange-100: #fdf1e3;
    --red-700: #a8071a;
    --red-100: #fde8ea;
    --green-700: #26734d;
    --green-100: #e3f3e9;
    --amber-700: #8a6418;
    --amber-100: #fff4d5;
    --ink: #2e2f31;
    --muted: #6d6e70;
    --line: #e4e4e6;
    --line-strong: #cfd0d3;
    --surface: #ffffff;
    --canvas: #f5f5f6;
    --shadow: 0 10px 30px rgba(46, 47, 49, 0.10);
    --radius: 10px;
    --radius-sm: 6px;
    font-family: "Segoe UI", "Fira Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-width: 280px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    line-height: 1.5;
}

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

button,
select {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
dialog:focus-visible {
    outline: 3px solid rgba(226, 0, 26, 0.25);
    outline-offset: 2px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--navy-950);
    line-height: 1.18;
}

h1 {
    margin-bottom: 0;
    font-size: 1.5rem;
    font-weight: 650;
}

h2 {
    margin-bottom: 0.3rem;
    font-size: 1.5rem;
    font-weight: 650;
}

h3 {
    margin-bottom: 0.25rem;
    font-size: 1.02rem;
    font-weight: 650;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.eyebrow {
    margin-bottom: 0.3rem;
    color: var(--brand-gray);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

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

.brand-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
}





/* Anmeldung */

.login-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(340px, 0.9fr) minmax(480px, 1.1fr);
}

.login-intro {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(2rem, 5vw, 4.5rem);
    overflow: hidden;
    color: var(--brand-gray);
    background: #fff;
    border-right: 1px solid var(--line);
}

.login-intro::before {
    position: absolute;
    top: 0;
    right: 0;
    width: 36%;
    height: 14px;
    background: var(--brand-red);
    content: "";
}

.login-intro::after {
    position: absolute;
    left: -4rem;
    bottom: -6rem;
    width: min(78%, 34rem);
    aspect-ratio: 640 / 765;
    background: url("/assets/hanemann-hahn.png") no-repeat left bottom / contain;
    opacity: 0.07;
    pointer-events: none;
    content: "";
}

.login-intro .brand-logo {
    max-width: 320px;
}

.login-copy {
    position: relative;
    z-index: 1;
    max-width: 34rem;
}

.login-copy .eyebrow {
    color: var(--brand-red);
}

.login-copy h1 {
    max-width: 14ch;
    margin-bottom: 1rem;
    color: var(--brand-anthracite);
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.login-copy > p:last-child {
    max-width: 32rem;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
}

.login-footnote {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.86rem;
}

.login-panel {
    display: grid;
    min-height: 100vh;
    padding: 2rem;
    place-items: center;
    background: var(--canvas);
}

.login-card {
    width: min(100%, 27rem);
    padding: clamp(2rem, 5vw, 2.75rem);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand-red);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.login-card > * + * {
    margin-top: 1.25rem;
}

/* Formulare und Buttons */

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

.field label,
.compact-field span {
    color: var(--navy-900);
    font-size: 0.86rem;
    font-weight: 700;
}

.field small {
    color: var(--muted);
    font-size: 0.78rem;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.68rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: #fff;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #a9aaad;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-gray);
    box-shadow: 0 0 0 3px rgba(109, 110, 112, 0.15);
    outline: none;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 5.2rem;
}

.text-button {
    border: 0;
    color: var(--teal-700);
    background: transparent;
    font-size: 0.8rem;
    font-weight: 750;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
}

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:not(:disabled):active {
    transform: translateY(1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.button-primary {
    color: #fff;
    background: var(--brand-red);
}

.button-primary:hover:not(:disabled) {
    background: var(--brand-red-dark);
}

.button-secondary {
    border-color: var(--line-strong);
    color: var(--ink);
    background: #fff;
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
    background: #f0f0f1;
}

.button-quiet {
    border-color: transparent;
    color: var(--navy-800);
    background: transparent;
}

.button-danger {
    color: #fff;
    background: var(--red-700);
}

.button-wide {
    width: 100%;
}

.form-error {
    padding: 0.7rem 0.8rem;
    border-left: 3px solid var(--red-700);
    border-radius: 4px;
    color: var(--red-700);
    background: var(--red-100);
    font-size: 0.86rem;
}

/* App-Rahmen */

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

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    padding: 0 0.75rem 0.75rem;
    color: var(--ink);
    background: #fff;
    border-right: 1px solid var(--line);
}

/* Roter Balken oben wie im Briefbogen */
.sidebar::before {
    display: block;
    height: 5px;
    margin: 0 -0.75rem;
    background: var(--brand-red);
    content: "";
}

.sidebar .brand {
    padding: 1.25rem 0.6rem 1.1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
}

.main-nav {
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 0.1rem;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d4d4d7 transparent;
}

.main-nav .nav-item {
    flex-shrink: 0;
}

.nav-item {
    position: relative;
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-radius: var(--radius-sm);
    color: #47484b;
    background: transparent;
    text-align: left;
    font-size: 0.92rem;
    font-weight: 500;
}

.nav-item:hover {
    color: var(--ink);
    background: #f2f2f3;
}

.nav-item.is-active {
    color: var(--brand-red-dark);
    background: var(--brand-red-soft);
    font-weight: 600;
}

.nav-item.is-active::before {
    position: absolute;
    top: 0.45rem;
    bottom: 0.45rem;
    left: 0;
    width: 3px;
    border-radius: 2px;
    background: var(--brand-red);
    content: "";
}

.nav-icon {
    display: inline-flex;
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--brand-gray);
}

.nav-item.is-active .nav-icon {
    color: var(--brand-red);
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.sidebar-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: auto;
    padding: 0.8rem 0.7rem 0.2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.76rem;
}

.status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #2f9e62;
    box-shadow: 0 0 0 3px rgba(47, 158, 98, 0.15);
}

.workspace {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 0.6rem clamp(1.25rem, 3vw, 2.5rem);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

/* Der Seitentitel steht schon groß im Inhalt, oben reicht der Pfad */
.topbar h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.breadcrumb {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.breadcrumb span {
    color: var(--ink);
    font-weight: 600;
}

.account-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.account-copy {
    display: grid;
    text-align: right;
}

.account-copy strong {
    max-width: 19rem;
    overflow: hidden;
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 600;
    text-overflow: ellipsis;
}

.account-copy span {
    color: var(--muted);
    font-size: 0.75rem;
}

.content:focus {
    outline: none;
}

.content {
    width: 100%;
    margin: 0;
    padding: clamp(1rem, 1.8vw, 1.75rem) clamp(1rem, 1.8vw, 1.75rem) 3rem;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
}

.section-heading .muted {
    font-size: 0.92rem;
}

/* Plantafel */

.content.content-wide {
    width: 100%;
    padding: 0.75rem 1rem;
}

.board-heading {
    margin-bottom: 1rem;
}

.board-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.board-toolbar input[type="number"] {
    width: 4.5rem;
}

.board-toolbar input[type="checkbox"] {
    width: auto;
    min-height: 0;
}

.board-wrap {
    overflow-x: auto;
    border: 1px solid #9fb3c4;
    border-radius: var(--radius-sm);
    background: #dfe8f3;
}

.board {
    min-width: calc(3.5rem + var(--board-cols) * 7.5rem);
}

.board-row {
    display: grid;
    grid-template-columns: 3.5rem repeat(var(--board-cols), minmax(0, 1fr));
}

.board-gutter {
    padding: 0.2rem;
    color: var(--muted);
    background: #dfe8f3;
}

.board-head {
    position: sticky;
    top: 0;
    z-index: 3;
}

.board-col-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.2rem;
    border-left: 1px solid #9fb3c4;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.15;
}

.board-col-head img,
.board-avatar {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    object-fit: cover;
}

.board-avatar {
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.6);
    color: var(--navy-900);
    font-size: 1.4rem;
    font-weight: 700;
}

.board-allday {
    border-top: 1px solid #9fb3c4;
    border-bottom: 1px solid #9fb3c4;
}

.board-allday-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 1.9rem;
    padding: 3px;
    border-left: 1px solid #9fb3c4;
    background: #3a6ea5;
}

.board-chip {
    padding: 0.15rem 0.35rem;
    border: 1px solid #1b2c3b;
    border-radius: 2px;
    background: #fff;
    color: #1b2c3b;
    font-size: 0.78rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.board-body {
    position: relative;
}

.board-hours > div {
    height: var(--board-hour);
    border-top: 1px solid #b7c6d4;
    font-size: 1.25rem;
    color: var(--navy-900);
}

.board-hours sup {
    font-size: 0.6rem;
    margin-left: 1px;
}

.board-col {
    position: relative;
    border-left: 1px solid #9fb3c4;
}

.board-slot {
    height: var(--board-hour);
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    background: linear-gradient(rgba(0, 0, 0, 0.05) 50%, transparent 50%) 0 calc(var(--board-hour) / 2) / 100% var(--board-hour) no-repeat;
}

.board-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    margin-left: 2px;
    padding: 0.2rem 0.3rem 0.2rem 0.55rem;
    overflow: hidden;
    border: 1px solid #1b2c3b;
    border-left: 6px solid #1f3fd0;
    border-radius: 2px;
    background: #ffffff;
    color: #1b2c3b;
    font-size: 0.8rem;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    z-index: 1;
}

.board-item small {
    font-size: 0.74rem;
}

.board-item-notes {
    white-space: pre-line;
    color: #3d4d5c;
}

.board-item-time {
    font-weight: 600;
    font-size: 0.72rem;
    color: #3d4d5c;
}

.board-item-measurement {
    background: #fff4d5;
}

.board-item-delivery {
    background: #e1f3e8;
}

.board-item-meeting {
    background: #fde2d6;
}

.board-item-other {
    background: #f3f7fb;
}

.board-now {
    position: absolute;
    left: 3.5rem;
    right: 0;
    border-top: 2px solid #d62828;
    z-index: 2;
    pointer-events: none;
}

.board-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 1px solid #9fb3c4;
    border-radius: 3px;
    vertical-align: middle;
}

.board-photo-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
}

#board-section:fullscreen {
    overflow: auto;
    padding: 0.4rem;
    background: #dfe8f3;
}

#board-section:fullscreen .board-heading,
#board-section:fullscreen .board-toolbar .compact-field {
    display: none;
}

#board-section:fullscreen .board-toolbar {
    margin-bottom: 0.3rem;
}

#board-section:fullscreen .board-wrap {
    border-radius: 0;
}

/* Dashboard */

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

.metric-card {
    position: relative;
    display: grid;
    min-height: 120px;
    align-content: space-between;
    gap: 0.4rem;
    padding: 1rem 1.1rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}







.metric-label,
.metric-note {
    color: var(--muted);
    font-size: 0.78rem;
}

.metric-label {
    font-weight: 700;
}

.metric-card strong {
    color: var(--brand-anthracite);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.dashboard-grid {
    display: grid;
    margin-top: 1rem;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 1rem;
}

.panel,
.table-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.panel {
    padding: 1.25rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.quick-action {
    display: flex;
    min-height: 88px;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: #fff;
    text-align: left;
}

.quick-action:hover {
    border-color: var(--line-strong);
    background: #fafafa;
}

.quick-action-mark {
    display: grid;
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-red);
    background: var(--brand-red-soft);
    font-size: 1.3rem;
    font-weight: 600;
}

.quick-action span:last-child {
    display: grid;
}

.quick-action small {
    margin-top: 0.15rem;
    color: var(--muted);
}

.status-list {
    margin: 0;
}

.status-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}

.status-list > div:last-child {
    border-bottom: 0;
}

.status-list dt {
    color: var(--muted);
    font-size: 0.84rem;
}

.status-list dd {
    margin: 0;
}

.status-pill,
.badge {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    color: var(--muted);
    background: #efeff0;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-success,
.badge-active {
    color: var(--green-700);
    background: var(--green-100);
}

.badge-inactive {
    color: var(--red-700);
    background: var(--red-100);
}

.badge-owner {
    color: var(--orange-600);
    background: var(--orange-100);
}

.badge-admin {
    color: var(--teal-700);
    background: var(--teal-100);
}

.badge-member {
    color: var(--navy-800);
    background: #efeff0;
}

/* Tabellen */

.toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-field {
    width: min(100%, 30rem);
}

.compact-field {
    display: grid;
    width: 10rem;
    gap: 0.25rem;
}

.compact-field span {
    font-size: 0.72rem;
}

.table-panel {
    overflow: hidden;
}

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

th,
td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ececee;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: #fafafa;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: #fafafa;
}

.align-right {
    text-align: right;
}

.cell-primary {
    display: grid;
    gap: 0.12rem;
}

.cell-primary strong {
    color: var(--navy-900);
}

.cell-primary small {
    color: var(--muted);
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
}

.action-button,
.icon-button {
    display: inline-grid;
    min-width: 36px;
    min-height: 36px;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: #fff;
    font-size: 0.78rem;
    font-weight: 600;
}

.action-button:hover,
.icon-button:hover {
    border-color: #a9aaad;
    background: #f5f5f6;
}

.action-button-danger {
    color: var(--red-700);
}

.empty-state {
    display: grid;
    min-height: 180px;
    place-content: center;
    gap: 0.35rem;
    padding: 2rem;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--navy-900);
}

/* Dialoge */

.modal {
    width: min(calc(100% - 2rem), 52rem);
    max-height: 94vh;
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: var(--radius);
    border-top: 4px solid var(--brand-red);
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(30, 30, 32, 0.25);
}

/* Große Fenster: fast der ganze Bildschirm, damit man ohne Scrollen den Überblick hat. */
.modal-wide {
    width: min(calc(100% - 2rem), 1700px);
    height: 94vh;
}

.modal-small {
    width: min(calc(100% - 2rem), 28rem);
}

.modal::backdrop {
    background: rgba(30, 30, 32, 0.5);
    backdrop-filter: blur(2px);
}

.modal > form,
.modal > div,
.modal > p {
    margin-left: 1.5rem;
    margin-right: 1.5rem;
}

.modal > form {
    margin-top: 0;
    margin-bottom: 0;
    padding: 0 0 1.5rem;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 -0.05rem 1.35rem;
    padding-top: 1.5rem;
}

.modal-header h2 {
    font-size: 1.35rem;
}

.modal-header .icon-button {
    border-color: transparent;
    font-size: 1.35rem;
}

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

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

textarea {
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.assignment-list {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1.2rem;
}

.assignment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fafafa;
}

.assignment-item > span:first-child {
    display: grid;
}

.assignment-item small {
    color: var(--muted);
}

.assignment-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fafafa;
}

.assignment-form .button {
    margin-bottom: 1px;
}

/* Systemzustände */

.loading-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #fff;
    background: rgba(30, 30, 32, 0.45);
    font-weight: 700;
}

.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

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

.toast-region {
    position: fixed;
    z-index: 1100;
    right: 1rem;
    bottom: 1rem;
    display: grid;
    width: min(calc(100% - 2rem), 24rem);
    gap: 0.65rem;
}

.toast {
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--brand-gray);
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow);
    font-size: 0.88rem;
}

.toast-error {
    border-left-color: var(--red-700);
}

/* Responsive */

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

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

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

@media (max-width: 860px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-intro {
        min-height: 260px;
        padding: 2rem;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .login-copy h1 {
        max-width: none;
        font-size: clamp(2.25rem, 10vw, 3.6rem);
    }

    .login-footnote {
        display: none;
    }

    .login-panel {
        min-height: auto;
        padding: 1rem;
    }

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

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

    .sidebar {
        position: static;
        height: auto;
        padding: 0 1rem 0.5rem;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar::before {
        margin: 0 -1rem;
    }

    .sidebar .brand {
        padding: 0.75rem 0;
    }

    .sidebar .brand-logo {
        max-width: 170px;
    }

    .topbar {
        position: static;
    }

    .main-nav {
        display: flex;
        flex: none;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .nav-item {
        flex: 1 0 auto;
        justify-content: center;
    }

    .nav-icon,
    .sidebar-footer {
        display: none;
    }

    .topbar {
        min-height: 52px;
        padding: 0.5rem 1rem;
    }

    .account-copy {
        display: none;
    }

    .content {
        padding: 1.25rem 1rem;
    }

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

    table {
        min-width: 720px;
    }
}

@media (max-width: 620px) {
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading > .button {
        width: 100%;
    }

    .metric-grid,
    .quick-actions,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .toolbar,
    .toolbar-wrap {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field,
    .compact-field {
        width: 100%;
    }

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

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .button {
        width: 100%;
    }

    .topbar h1 {
        font-size: 1.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.4rem 1rem;
    max-height: 30vh;
    overflow-y: auto;
    padding: 0.6rem 0.8rem;
    border: 1px solid #c8d4dc;
    border-radius: var(--radius-sm);
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.check-item input {
    width: auto;
    min-height: 0;
}

.status-select {
    min-height: 36px;
    padding: 0.3rem 0.5rem;
}

@media (max-width: 720px) {
    .check-list {
        grid-template-columns: 1fr;
    }
}

.tab-bar {
    display: flex;
    gap: 0.25rem;
    margin: 0.5rem 0 1rem;
    border-bottom: 1px solid var(--line);
}

.tab {
    padding: 0.6rem 1rem;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    background: none;
    font-weight: 600;
}

.tab.is-active {
    border-bottom-color: var(--brand-red);
    color: var(--ink);
}

.entry-form {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.entry-actions {
    display: flex;
    gap: 0.5rem;
}

.entry-list {
    display: grid;
    gap: 0.75rem;
    max-height: 46vh;
    overflow-y: auto;
}

.entry-card {
    padding: 0.8rem 1rem;
    border: 1px solid #e4e4e6;
    border-radius: var(--radius-sm);
    background: #fff;
}

.entry-card header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.entry-card header small {
    color: var(--muted);
}

.entry-card header .action-button,
.entry-card header .status-select {
    margin-left: auto;
}

.entry-card header .status-select + .action-button {
    margin-left: 0;
}

.entry-card p {
    margin: 0.5rem 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.entry-defect {
    border-left: 3px solid #c0392b;
}

.detail-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.text-danger {
    color: #b3261e;
    font-weight: 600;
}

@media (max-width: 720px) {
    .entry-form {
        grid-template-columns: 1fr;
    }
}

.intake-form,
.intake-proposal {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.intake-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 150px;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.intake-row input[type="checkbox"] {
    width: 18px;
    min-height: 0;
}

.intake-entry {
    grid-template-columns: 24px 160px minmax(0, 1fr);
    align-items: start;
}

.intake-measure {
    grid-template-columns: 24px minmax(0, 2fr) 100px 100px 80px minmax(0, 2fr);
}

.intake-head {
    color: var(--muted);
    font-size: 0.8rem;
}

.intake-warning {
    padding: 0.7rem 1rem;
    border: 1px solid #e8c36a;
    border-radius: var(--radius-sm);
    background: #fff8e6;
}

.intake-warning ul {
    margin: 0.3rem 0 0;
    padding-left: 1.2rem;
}

.measurement-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 120px 120px 90px minmax(0, 2fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .measurement-form,
    .intake-measure,
    .intake-row,
    .intake-entry {
        grid-template-columns: 1fr;
    }
}

/* Dateien und Zettel-Fotos */
.photo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.photo-item {
    display: grid;
    gap: 6px;
    justify-items: start;
}

.photo-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid var(--line, #d7dce2);
    border-radius: 8px;
    background: #f5f5f6;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 8px;
}

.file-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.file-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line, #d7dce2);
    border-radius: 10px;
    background: #fff;
}

.file-thumb-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.file-thumb {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    background: #f5f5f6;
}

.file-pdf {
    display: grid;
    place-items: center;
    height: 140px;
    border-radius: 6px;
    background: #f0f0f1;
    font-weight: 700;
}

.file-meta {
    display: grid;
    gap: 2px;
    overflow-wrap: anywhere;
}

.file-viewer {
    display: grid;
    place-items: center;
    max-height: 70vh;
    overflow: auto;
}

.file-viewer img {
    max-width: 100%;
    height: auto;
}

/* Artikel und Preislisten */
.price-input {
    width: 130px;
    padding: 6px 8px;
    text-align: right;
    border: 1px solid var(--line, #d7dce2);
    border-radius: 6px;
}

.price-input.is-saved {
    border-color: #2e7d32;
    background: #eef8ef;
}

/* Angebote */
.quote-totals {
    display: grid;
    gap: 6px;
    max-width: 420px;
    margin: 12px 0 0 auto;
}

.quote-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.quote-total-gross {
    padding-top: 6px;
    border-top: 2px solid var(--line, #d7dce2);
    font-size: 1.1em;
}

.measure-pick {
    display: grid;
    gap: 10px;
}

.measure-list {
    display: grid;
    gap: 4px;
    max-height: 220px;
    overflow: auto;
}

#print-area {
    display: none;
}

@media print {
    body > *:not(#print-area) {
        display: none !important;
    }

    dialog {
        display: none !important;
    }

    #print-area {
        display: block !important;
        padding: 0;
        color: #000;
        background: #fff;
        font-size: 11pt;
    }

    #print-area table {
        width: 100%;
        border-collapse: collapse;
        margin: 12px 0;
    }

    #print-area th,
    #print-area td {
        padding: 4px 6px;
        border-bottom: 1px solid #999;
        text-align: left;
    }

    .print-totals {
        margin-left: auto;
        width: 260px;
        text-align: right;
    }
}

/* Zeiterfassung */
.panel-pad {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

/* Kalender */
.calendar-title {
    min-width: 11rem;
    text-align: center;
    text-transform: capitalize;
}

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

.cal-weekdays span {
    padding: 0.25rem 0.4rem;
    color: var(--muted, #667);
    font-size: 0.78rem;
    font-weight: 700;
}

.cal-day {
    display: flex;
    min-height: 104px;
    flex-direction: column;
    gap: 3px;
    padding: 4px;
    border: 1px solid rgba(120, 130, 150, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.5);
}

.cal-day.is-outside {
    opacity: 0.5;
}

.cal-day.is-today {
    border-color: var(--teal-700, #0f766e);
    box-shadow: inset 0 0 0 1px var(--teal-700, #0f766e);
}

.cal-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
}

.cal-add {
    width: 1.4rem;
    height: 1.4rem;
    border: 0;
    border-radius: 4px;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.cal-add:hover {
    background: rgba(120, 130, 150, 0.25);
}

.cal-item {
    overflow: hidden;
    padding: 2px 5px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: #475569;
    font-size: 0.74rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.cal-day-number,
.cal-more {
    padding: 0 0.2rem;
    border: 0;
    border-radius: 4px;
    color: inherit;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.cal-day-number:hover,
.cal-more:hover {
    background: rgba(120, 130, 150, 0.25);
}

.cal-more {
    align-self: flex-start;
    font-size: 0.74rem;
    font-weight: 400;
    text-decoration: underline;
}

.cal-day-list {
    display: grid;
    gap: 4px;
    max-height: 60vh;
    overflow-y: auto;
    margin: 0.5rem 0 1rem;
}

.cal-day-entry {
    padding: 6px 8px;
    font-size: 0.85rem;
    white-space: normal;
}

.table-group td {
    padding-top: 0.9rem;
    font-weight: 700;
    color: var(--muted, #667);
}

.table-more td {
    color: var(--muted, #667);
    font-style: italic;
    text-align: center;
}

.cal-installation { background: #0f766e; }
.cal-measurement { background: #7c3aed; }
.cal-delivery { background: #b45309; }
.cal-meeting { background: #2563eb; }
.cal-other { background: #475569; }
.cal-project { background: #0e7490; }
.cal-order { background: #4d7c0f; }
.cal-task { background: #be123c; }

@media (max-width: 720px) {
    .cal-day {
        min-height: 72px;
    }

    .cal-item {
        font-size: 0.66rem;
    }
}


/* Seitenmenue: aufklappbare Gruppen */
.nav-group { display: grid; gap: 0.1rem; }

.nav-group-toggle {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding: 0.3rem 0.7rem;
    border: 0;
    border-radius: var(--radius-sm);
    color: #8a8b8e;
    background: transparent;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
}

.nav-group-toggle:hover { color: var(--ink); background: #f2f2f3; }
.nav-chevron { transition: transform 0.15s ease; }
.nav-group.is-collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group-items { display: grid; gap: 0.1rem; }
.nav-group.is-collapsed .nav-group-items { display: none; }

@media (max-width: 860px) {
    .nav-group,
    .nav-group-items,
    .nav-group.is-collapsed .nav-group-items { display: contents; }
    .nav-group-toggle { display: none; }
}


/* Belegarchiv */
.hash {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 0.78rem;
}

.field label.checkbox-line {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: 400;
}

.field label.checkbox-line input {
    width: auto;
    margin-top: 0.2rem;
}

.bank-suggestion {
    margin: 0.35rem 0;
}

.bank-suggestion small {
    display: block;
}

.board-col-head[data-action] {
    cursor: pointer;
}

#board-section:fullscreen .board-col-head[data-action] {
    cursor: default;
}

.board-member-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Knopfleiste in Formularen über die ganze Breite */
.form-grid > .modal-actions {
    grid-column: 1 / -1;
}

#project-document-list h3,
#bcglas-document-heading {
    margin: 1.25rem 0 0.5rem;
}

/* Finanzen im Dashboard (nur Chef, Admin, Owner) */

:root {
    --series-income: #2a78d6;
    --series-expense: #eb6834;
}

.finance-overview {
    display: grid;
    margin-top: 1.5rem;
    gap: 1rem;
}

.finance-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.finance-head h3,
.finance-head p {
    margin: 0;
}

.finance-filters {
    display: flex;
    gap: 0.75rem;
}

.finance-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
    gap: 1rem;
}

.finance-tile {
    display: grid;
    align-content: start;
    gap: 0.4rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.finance-tile strong {
    font-size: 1.55rem;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.finance-tile .metric-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.series-key {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 3px;
}

.series-income {
    background: var(--series-income);
}

.series-expense {
    background: var(--series-expense);
}

.finance-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.finance-chart-panel {
    position: relative;
}

.finance-legend {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.finance-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.finance-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

.finance-chart .grid-line {
    stroke: var(--line);
    stroke-width: 1;
}

.finance-chart .axis-label {
    fill: var(--muted);
    font-size: 11px;
}

.finance-chart .axis-label.is-selected {
    fill: var(--ink);
    font-weight: 700;
}

.finance-chart .bar-income {
    fill: var(--series-income);
}

.finance-chart .bar-expense {
    fill: var(--series-expense);
}

.finance-chart .is-dimmed {
    opacity: 0.3;
}

.finance-chart .hit {
    fill: transparent;
}

.finance-chart .hit:hover,
.finance-chart .hit.is-hover {
    fill: rgba(46, 47, 49, 0.06);
}

.finance-tooltip {
    position: absolute;
    z-index: 5;
    min-width: 11rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 0.82rem;
    pointer-events: none;
}

.finance-tooltip strong {
    display: block;
    margin-bottom: 0.2rem;
}

.finance-tooltip div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-variant-numeric: tabular-nums;
}

.finance-tooltip div span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.finance-table td,
.finance-table th {
    font-variant-numeric: tabular-nums;
}

.finance-lists {
    margin-top: 0;
    grid-template-columns: 1fr 1fr;
}

.finance-list td {
    vertical-align: top;
}

.finance-list small {
    display: block;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .finance-lists {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .finance-filters {
        width: 100%;
        flex-direction: column;
    }

    .finance-filters .compact-field {
        width: 100%;
    }
}

.finance-table td,
.finance-table th {
    white-space: nowrap;
}

/* Projekt-Chat (wie Craftnote) */
.chat-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.chat-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 56vh;
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid #e4e4e6;
    border-radius: var(--radius-sm);
    background: #f5f5f6;
}

.chat-day {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

.chat-day span {
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: #ececee;
    color: var(--muted);
    font-size: 0.8rem;
}

.chat-row {
    display: flex;
}

.chat-row.is-mine {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: min(75%, 34rem);
    padding: 0.5rem 0.75rem;
    border: 1px solid #e4e4e6;
    border-radius: 12px 12px 12px 4px;
    background: #fff;
}

.chat-row.is-mine .chat-bubble {
    border-color: #f6c5cb;
    border-radius: 12px 12px 4px 12px;
    background: var(--teal-100);
}

.chat-meta {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    font-size: 0.85rem;
}

.chat-meta strong {
    color: var(--teal-700);
}

.chat-meta small {
    color: var(--muted);
}

.chat-bubble p {
    margin: 0.25rem 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-bubble .badge {
    margin-top: 0.3rem;
}

.chat-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 0.35rem;
    margin-top: 0.35rem;
    min-width: min(16rem, 60vw);
}

.chat-photo {
    padding: 0;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #ececee;
    cursor: zoom-in;
    aspect-ratio: 1;
}

.chat-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-doc {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.35rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid #e4e4e6;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.chat-doc-kind {
    flex: none;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: var(--teal-700);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.chat-composer {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-composer textarea {
    flex: 1;
    min-height: 2.6rem;
    max-height: 9rem;
    resize: vertical;
    font: inherit;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cfd0d3;
    border-radius: var(--radius-sm);
}

.chat-attach {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid #cfd0d3;
    border-radius: 50%;
    background: #fff;
    color: var(--teal-700);
    font-size: 1.4rem;
    cursor: pointer;
}

.chat-attach:hover {
    border-color: var(--teal-600);
}

/* Baustelle: Meine Projekte und Zettel fuers Buero */
.toolbar-title {
    margin: 0;
    margin-right: auto;
}

.myproject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.myproject-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 1rem;
    border: 1px solid #d8e1e7;
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.myproject-card:hover {
    border-color: var(--teal-600);
}

.myproject-card small {
    color: var(--muted);
}

.myproject-open {
    margin-top: 0.35rem;
    color: var(--teal-700);
    font-weight: 600;
}

.notescan-panel {
    margin-bottom: 1rem;
}

.notescan-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.75rem;
}

.notescan-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem;
    border: 1px solid #d8e1e7;
    border-radius: var(--radius-sm);
    background: #fff;
}

.notescan-card .file-thumb-button {
    flex: none;
    width: 6rem;
    height: 6rem;
}

.notescan-card .file-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.notescan-card .table-actions {
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.chat-attach-note {
    width: auto;
    padding: 0 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Mein Tag: der ganze Tagesplan ohne eigenen Scrollbereich */
#myday-appointments,
#myday-tasks {
    max-height: none;
    overflow: visible;
}

.notescan-card .table-actions {
    justify-content: flex-start;
}

/* Tabellen: Spalten ziehen und sortieren */
.table-panel {
    overflow-x: auto;
}

th {
    position: relative;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--text, #222);
}

th.sort-asc::after,
th.sort-desc::after {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.7rem;
}

th.sort-asc::after {
    content: "▲";
}

th.sort-desc::after {
    content: "▼";
}

.col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    bottom: 0;
    z-index: 1;
    width: 9px;
    cursor: col-resize;
    touch-action: none;
}

.col-resizer::after {
    content: "";
    position: absolute;
    top: 25%;
    bottom: 25%;
    left: 4px;
    width: 1px;
    background: #d6d6da;
}

.col-resizer:hover::after,
.col-resizer.is-dragging::after {
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--teal-600);
}

table.table-resized {
    table-layout: fixed;
    min-width: 100%;
}

table.table-resized td,
table.table-resized th {
    overflow-wrap: anywhere;
}

/* Chat: Art der Nachricht, Bearbeiten, Maengel */
.chat-kind {
    flex: none;
    height: 2.6rem;
    padding: 0 0.5rem;
    border: 1px solid #c9d4dc;
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
}

.chat-composer.is-editing textarea {
    border-color: var(--teal-600);
}

.chat-edit {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.chat-edit:hover {
    color: var(--teal-700);
    text-decoration: underline;
}

.chat-bubble.is-defect {
    border-left: 4px solid #c0392b;
}

.chat-composer .chat-kind {
    width: 9.5rem;
    min-width: 0;
}

.chat-composer textarea {
    width: auto;
    min-width: 0;
}

/* Tabellenzeilen mit Oeffnen-Knopf sind ganz anklickbar */
tbody tr.row-openable {
    cursor: pointer;
}

/* Gesamtuebersicht im Angebot (wie BC Glas) */
.quote-overview-panel {
    margin: 0.75rem 0 1rem;
    border: 1px solid var(--line, #e3e3e3);
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
}

.quote-overview-panel > summary {
    cursor: pointer;
    font-weight: 600;
}

.quote-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    align-items: flex-start;
    margin-top: 0.6rem;
}

.overview-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
    gap: 0.5rem 1rem;
    margin: 0;
    flex: 1 1 18rem;
}

.overview-figures dt {
    color: var(--muted);
    font-size: 0.8rem;
}

.overview-figures dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.overview-margin {
    flex: 2 1 24rem;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.overview-margin th,
.overview-margin td {
    padding: 0.25rem 0.6rem;
    border-bottom: 1px solid var(--line, #e3e3e3);
    font-size: 0.88rem;
}

.overview-margin th[scope="row"] {
    text-align: left;
    font-weight: 600;
}

/* Suchfeld mit Aufklapp-Pfeil statt langer Auswahlliste */
select.combo-native {
    display: none;
}

.combo {
    position: relative;
    min-width: 0;
}

.combo-input {
    width: 100%;
    padding-right: 2.2rem;
}

.combo-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 2rem;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 7px 7px 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
}

.combo-toggle:hover {
    color: var(--navy-900, #222);
}

.combo-list {
    position: absolute;
    z-index: 60;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    max-height: 18rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line-strong, #cfd0d3);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.combo-list li {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.3;
}

.combo-list li.is-active {
    background: #fde6e8;
}

.combo-list li.is-selected {
    font-weight: 600;
}

.combo-list li.combo-empty {
    color: var(--muted);
    cursor: default;
}

/* Artikel direkt unter den Positionen suchen */
.quote-add-line {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.6rem 0.9rem;
    margin: 0.6rem 0 0.9rem;
}

.quote-add-line .quote-add-article {
    flex: 1 1 24rem;
}

.quote-add-line .quote-add-small {
    flex: 0 0 7rem;
}

/* Glasrechner kompakt im Angebot */
.glass-panel {
    margin: 0.5rem 0 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.5rem 0.9rem 0.75rem;
}

.glass-panel > summary {
    cursor: pointer;
    font-weight: 600;
}

.glass-panel > summary small {
    font-weight: 400;
    margin-left: 0.5rem;
}

.glass-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem 0.75rem;
    margin: 0.6rem 0 0.5rem;
}

.glass-grid .field {
    gap: 0.25rem;
    align-content: start;
}

.glass-grid .field label {
    font-size: 0.8rem;
}

.glass-grid input,
.glass-grid select,
.glass-grid textarea {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    min-height: 0;
}

.glass-grid textarea {
    font-family: inherit;
}

.glass-grid .glass-span-2 {
    grid-column: span 2;
}

.glass-grid .inline-check {
    margin: 0;
}

.glass-grid .inline-check input {
    width: 0.95rem;
    height: 0.95rem;
    flex: none;
    margin: 0;
    padding: 0;
}

.glass-pair-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 0.35rem;
}

.glass-preview th,
.glass-preview td {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.86rem;
}

.glass-preview .glass-text-row td {
    color: var(--muted);
    white-space: normal;
}

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

.glass-summary {
    margin: 0;
    font-weight: 600;
}

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

.glass-grid .glass-pair {
    grid-column: span 2;
}

/* ------------------------------------------------------------
   Neues Hauptmenue: Bereiche links, Unterbereiche als Reiter
   ------------------------------------------------------------ */
.main-nav .nav-item[data-section] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.7rem;
    row-gap: 0.05rem;
    min-height: 46px;
    padding: 0.5rem 0.7rem;
}

.main-nav .nav-item[data-section] .nav-icon {
    grid-row: 1 / span 2;
    align-self: center;
}

.nav-label {
    line-height: 1.2;
}

.nav-hint {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nav-hint:empty {
    display: none;
}

.nav-item.is-active .nav-hint {
    color: var(--brand-red-dark);
    opacity: 0.75;
}

.nav-divider {
    height: 1px;
    margin: 0.5rem 0.4rem;
    background: var(--line);
}

.topbar-main {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.breadcrumb-sep {
    margin: 0 0.4rem;
    color: var(--line-strong);
}

#breadcrumb-section {
    color: var(--ink);
    font-weight: 600;
}

.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.4rem;
    margin-bottom: -0.6rem;
}

.section-tab {
    position: relative;
    padding: 0.35rem 0 0.6rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.section-tab::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--brand-red);
    content: "";
    transform: scaleX(0);
    transition: transform 0.18s ease;
}

.section-tab:hover {
    color: var(--ink);
}

.section-tab.is-active {
    color: var(--brand-red);
}

.section-tab.is-active::after {
    transform: scaleX(1);
}

.section-tab:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   Kleinansicht fuer Angebote und Rechnungen
   ------------------------------------------------------------ */
.doc-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.doc-split.has-preview {
    grid-template-columns: minmax(0, 1fr) 360px;
}

tr.is-previewed > td {
    background: var(--brand-red-soft) !important;
}

tr.is-previewed > td:first-child {
    box-shadow: inset 3px 0 0 var(--brand-red);
}

.doc-preview {
    position: sticky;
    top: 84px;
    display: grid;
    gap: 0.9rem;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 0.9rem 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(46, 47, 49, 0.08);
    animation: doc-preview-in 0.18s ease-out;
}

@keyframes doc-preview-in {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: none; }
}

.doc-preview-loading {
    padding: 2rem 0;
    color: var(--muted);
    text-align: center;
}

.doc-preview-bar {
    display: flex;
    justify-content: space-between;
    gap: 0.25rem;
}

.doc-icon {
    display: inline-flex;
    width: 2.4rem;
    height: 2.4rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #47484b;
    cursor: pointer;
}

.doc-icon:hover {
    color: var(--brand-red);
    background: var(--brand-red-soft);
}

.doc-icon svg,
.doc-preview-main svg,
.doc-thumb-expand svg {
    width: 1.3rem;
    height: 1.3rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.doc-preview-main {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    font-size: 1rem;
}

.doc-preview-main svg {
    width: 1.1rem;
    height: 1.1rem;
}

.doc-thumb {
    position: relative;
    display: grid;
    gap: 0.3rem;
    width: 100%;
    padding: 0.8rem 0.9rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    color: #3a3b3d;
    font-size: 0.62rem;
    line-height: 1.35;
    text-align: left;
    cursor: zoom-in;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.doc-thumb:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.doc-thumb::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    border-radius: 8px 8px 0 0;
    background: var(--brand-red);
    content: "";
}

.doc-thumb-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.doc-thumb-head img {
    width: 74px;
    height: auto;
}

.doc-thumb-sender {
    margin-top: 1.4rem;
    color: var(--muted);
    font-size: 0.5rem;
    text-decoration: underline;
}

.doc-thumb-address {
    margin-bottom: 0.4rem;
}

.doc-thumb-title {
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.doc-thumb-line,
.doc-thumb-total {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid #f0f0f1;
}

.doc-thumb-line span:first-child {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.doc-thumb-total {
    border-bottom: 0;
    font-weight: 700;
}

.doc-thumb-expand {
    position: absolute;
    right: 0.5rem;
    bottom: 0.4rem;
    color: var(--muted);
}

.doc-thumb-expand svg {
    width: 0.9rem;
    height: 0.9rem;
}

.doc-steps {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.doc-steps li {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0.15rem;
    padding-top: 1.1rem;
    color: var(--muted);
    font-size: 0.75rem;
    text-align: center;
}

.doc-steps li::before {
    position: absolute;
    top: 0.2rem;
    left: 50%;
    width: 0.7rem;
    height: 0.7rem;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    background: #fff;
    content: "";
    transform: translateX(-50%);
}

.doc-steps li + li::after {
    position: absolute;
    top: 0.52rem;
    right: 50%;
    left: -50%;
    z-index: -1;
    height: 2px;
    background: var(--line);
    content: "";
}

.doc-steps li.is-done {
    color: var(--ink);
    font-weight: 600;
}

.doc-steps li.is-done::before {
    border-color: var(--brand-red);
    background: var(--brand-red);
}

.doc-steps li.is-done + li.is-done::after {
    background: var(--brand-red);
}

.doc-steps small {
    color: var(--muted);
    font-weight: 400;
}

.doc-steps {
    position: relative;
    z-index: 0;
}

.doc-preview-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.2rem 0 -0.3rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.doc-preview-divider::before,
.doc-preview-divider::after {
    flex: 1;
    height: 1px;
    background: var(--line);
    content: "";
}

.doc-facts {
    display: grid;
    gap: 0.45rem;
    margin: 0;
}

.doc-facts-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

.doc-facts-row dt {
    color: var(--muted);
}

.doc-facts-row dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-align: right;
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 3px;
    cursor: pointer;
}

.link-button:hover {
    color: var(--brand-red);
    text-decoration-color: currentColor;
}

.doc-payments {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.doc-payments li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.doc-preview-empty {
    margin: 0;
    font-size: 0.88rem;
}

@media (max-width: 1100px) {
    .doc-split.has-preview {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-preview {
        position: static;
        max-height: none;
    }
}

.doc-split > * {
    min-width: 0;
}

.doc-split > .table-panel {
    overflow-x: auto;
}

.doc-thumb {
    min-width: 0;
    overflow: hidden;
}

.doc-thumb {
    grid-template-columns: minmax(0, 1fr);
}

.doc-thumb > span {
    min-width: 0;
}

.doc-thumb-line span:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.doc-thumb-line span:last-child,
.doc-thumb-total span:last-child {
    flex: none;
}

.doc-thumb-head img {
    flex: none;
}

.doc-thumb {
    padding-bottom: 1.5rem;
}

/* ------------------------------------------------------------
   Kompakt (Wunsch Alex): kleinere Schrift, schmalere Felder,
   Tabellen ohne Querscrollen
   ------------------------------------------------------------ */
html {
    font-size: 14px;
}

body {
    line-height: 1.4;
}

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

.content {
    padding: 0.9rem 1.1rem 2rem;
}

.topbar {
    min-height: 52px;
    padding: 0.45rem 1.1rem;
}

input,
select,
textarea {
    min-height: 34px;
    padding: 0.38rem 0.6rem;
}

.combo-input {
    padding-right: 2rem;
}

.button {
    min-height: 32px;
    padding: 0.38rem 0.8rem;
}

.action-button {
    padding: 0.25rem 0.55rem;
    font-size: 0.82rem;
}

th,
td {
    padding: 0.42rem 0.6rem;
}

th {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.table-resized th {
    overflow-wrap: normal;
}

td select,
td input {
    width: auto;
    max-width: 100%;
    min-height: 28px;
    padding: 0.15rem 0.4rem;
}

td .cell-primary small,
td small {
    font-size: 0.78rem;
}

td:first-child > strong {
    white-space: nowrap;
}

.toolbar {
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.section-heading {
    margin-bottom: 0.7rem;
    padding-bottom: 0.6rem;
}

.section-heading .eyebrow {
    display: none;
}

.section-heading h2 {
    margin-bottom: 0.1rem;
    font-size: 1.2rem;
}

.section-heading p.muted {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.field label,
.compact-field span {
    font-size: 0.8rem;
}

.main-nav .nav-item[data-section] {
    min-height: 40px;
    padding: 0.4rem 0.6rem;
}

.metric-card {
    padding: 0.8rem 1rem;
}

.badge {
    font-size: 0.72rem;
}

.doc-split.has-preview {
    grid-template-columns: minmax(0, 1fr) 320px;
}

/* KI-Angebot */
.ai-quote-panel {
    margin: 0.5rem 0 0.75rem;
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--brand-red);
    border-radius: 8px;
    padding: 0.5rem 0.9rem 0.75rem;
}

.ai-quote-panel > summary {
    cursor: pointer;
    font-weight: 600;
}

.ai-quote-panel > summary small {
    font-weight: 400;
    margin-left: 0.5rem;
}

.ai-quote-form {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ai-quote-form textarea {
    font-family: inherit;
    width: 100%;
    resize: vertical;
}

.ai-quote-actions,
.ai-quote-apply {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.ai-quote-actions p,
.ai-quote-apply p {
    flex: 1 1 16rem;
    margin: 0;
    font-size: 0.85rem;
}

.ai-quote-notes {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Plantafel: Termine ziehen */
.board-item,
.board-chip {
    touch-action: none;
}

.board-dragging {
    opacity: 0.35;
}

.board-ghost {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    outline: 2px solid var(--brand-red);
}

.board-allday-cell > .board-ghost {
    position: static;
}

.board-ghost-label {
    display: block;
    margin: -0.2rem -0.3rem 0.15rem -0.55rem;
    padding: 0.1rem 0.4rem;
    background: var(--brand-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* KI-Angebot oben in der Angebotsliste: eine Eingabezeile */
.ai-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(12rem, 20rem) auto;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin: 0 0 0.9rem;
    padding: 0.4rem 0.4rem 0.4rem 0.8rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    background: linear-gradient(90deg, var(--brand-red-soft), var(--surface) 45%);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-bar:focus-within {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(226, 0, 26, 0.12);
}

.ai-bar-icon {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: var(--brand-red);
    stroke-width: 1.6;
    stroke-linejoin: round;
}

.ai-bar .ai-bar-text {
    min-height: 0;
    height: 2.2rem;
    max-height: 9rem;
    padding: 0.45rem 0.2rem;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.3rem;
    resize: none;
    overflow-y: auto;
}

.ai-bar .ai-bar-text:focus {
    outline: none;
    box-shadow: none;
}

.ai-bar-project .combo-input {
    border-radius: 8px;
    background: var(--surface);
}

.ai-bar-button {
    min-width: 7.5rem;
    border-radius: 8px;
}

.ai-bar-hint {
    grid-column: 2 / -1;
    margin: -0.15rem 0 0.1rem;
    font-size: 0.78rem;
    color: var(--muted);
}

@media (max-width: 900px) {
    .ai-bar {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .ai-bar-project,
    .ai-bar-button {
        grid-column: 1 / -1;
    }
}

/* Dashboard (drei Spalten: Zu erledigen, Konten/Umsatzsteuer, Übersicht) */
.dash-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.dash-head h2 {
    margin: 0;
    font-size: 1.6rem;
}

.dash-head p {
    margin: 0.15rem 0 0;
}

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

.dash-eye {
    display: inline-grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.dash-eye svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dash-eye:hover,
.dash-eye[aria-pressed="true"] {
    color: var(--brand-red);
    border-color: var(--brand-red);
}

.dash-grid {
    display: grid;
    grid-template-columns: minmax(15rem, 0.9fr) minmax(16rem, 1fr) minmax(0, 2fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.dash-col {
    display: grid;
    gap: 1rem;
}

.dash-col[hidden] {
    display: none;
}

.dash-card {
    position: relative;
    border: 1px solid var(--line);
    border-top: 3px solid var(--brand-red);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(46, 47, 49, 0.06);
}

.dash-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.8rem 1rem 0.5rem;
}

.dash-card-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.dash-card-head p {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
}

.dash-card-foot {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 1rem 0.8rem;
    border-top: 1px solid var(--line);
}

.dash-link {
    padding: 0.2rem 0;
    border: 0;
    background: none;
    color: var(--brand-red);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.dash-link:hover {
    text-decoration: underline;
}

.dash-todo-group {
    padding: 0.55rem 1rem 0.6rem;
    border-top: 1px solid var(--line);
}

.dash-todo-group h4 {
    margin: 0 0 0.2rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dash-todo-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.22rem 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    text-align: left;
}

button.dash-todo-row {
    cursor: pointer;
}

button.dash-todo-row:hover span {
    text-decoration: underline;
}

.dash-todo-row.is-action {
    color: var(--brand-red);
    font-weight: 600;
}

.dash-todo-row strong {
    white-space: nowrap;
    color: var(--ink);
}

.dash-accounts {
    display: grid;
}

.dash-account {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1rem;
    border: 0;
    border-top: 1px solid var(--line);
    background: none;
    font: inherit;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.dash-account:hover {
    background: var(--canvas);
}

.dash-account-icon {
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: var(--brand-red-soft);
    color: var(--brand-red);
}

.dash-account-icon svg,
.dash-chevron {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linejoin: round;
}

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

.dash-account-name {
    display: grid;
    min-width: 0;
}

.dash-account-name strong,
.dash-account-name small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-account-name small {
    color: var(--muted);
    font-size: 0.78rem;
}

.dash-account-balance {
    font-weight: 600;
    white-space: nowrap;
}

.dash-empty {
    padding: 0.4rem 1rem 0.6rem;
}

.dash-empty p {
    margin: 0 0 0.3rem;
}

.dash-vat {
    padding: 0 1rem 0.9rem;
}

.dash-vat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.dash-vat-row strong {
    font-size: 1.15rem;
}

.dash-vat p {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
}

.dash-overview {
    padding-bottom: 0.6rem;
}

.dash-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.2rem 1rem 0;
}

.dash-figures > div {
    display: grid;
    gap: 0.1rem;
}

.dash-figure-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.dash-figures strong {
    font-size: clamp(1.25rem, 2vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.dash-figure-diff {
    text-align: right;
}

.dash-figure-diff .dash-figure-label {
    justify-content: flex-end;
}

.dash-figures strong.is-negative {
    color: var(--brand-red);
}

.dash-caption {
    margin: 0.2rem 1rem 0;
    font-size: 0.8rem;
}

.dash-overview .finance-chart {
    padding: 0.2rem 0.6rem 0;
}

.dash-overview .finance-table {
    margin: 0.5rem 1rem 0;
}

.finance-chart .period-band {
    fill: var(--canvas);
}

.finance-chart .area-income {
    fill: var(--series-income);
    opacity: 0.1;
}

.finance-chart .area-expense {
    fill: var(--series-expense);
    opacity: 0.1;
}

.finance-chart .line-income,
.finance-chart .line-expense {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.finance-chart .line-income {
    stroke: var(--series-income);
}

.finance-chart .line-expense {
    stroke: var(--series-expense);
}

.finance-chart .hit .hit-area {
    fill: transparent;
}

.finance-chart .hit .hit-line,
.finance-chart .hit circle {
    opacity: 0;
}

.finance-chart .hit .hit-line {
    stroke: var(--line-strong);
    stroke-dasharray: 3 3;
}

.finance-chart .dot-income {
    fill: var(--series-income);
    stroke: var(--surface);
    stroke-width: 2;
}

.finance-chart .dot-expense {
    fill: var(--series-expense);
    stroke: var(--surface);
    stroke-width: 2;
}

.finance-chart .hit:hover .hit-line,
.finance-chart .hit:hover circle,
.finance-chart .hit.is-hover .hit-line,
.finance-chart .hit.is-hover circle {
    opacity: 1;
}

.dash-filters {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.3rem 1rem 0;
}

.dash-footnote {
    margin: 0.4rem 1rem 0;
    font-size: 0.75rem;
    text-align: center;
}

.dashboard-grid.finance-lists {
    margin-bottom: 1rem;
}

.dashboard-grid.finance-lists .dash-card > div:last-child {
    padding: 0 1rem 0.8rem;
}

/* Auge: Beträge verbergen */
.is-private .money,
.is-private .finance-chart .axis-y,
.is-private .finance-table td.align-right,
.is-private ~ .finance-tooltip .money {
    filter: blur(7px);
    user-select: none;
}

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

    .dash-overview {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .dash-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-figures {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-figure-diff {
        text-align: left;
    }

    .dash-figure-diff .dash-figure-label {
        justify-content: flex-start;
    }
}

/* KI-Hilfen im Angebot (Auftrag vorbereiten) und im Auftrag (abrechnen) */
.assist-card {
    display: grid;
    gap: 0.7rem;
    margin: 1rem 0 0.25rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--line-strong);
    border-left: 4px solid var(--brand-red);
    border-radius: 10px;
    background: linear-gradient(90deg, var(--brand-red-soft), var(--surface) 55%);
}

.assist-head {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.assist-head svg {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.1rem;
    fill: none;
    stroke: var(--brand-red);
    stroke-width: 1.6;
    stroke-linejoin: round;
}

.assist-head p {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
}

.assist-plan {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem 0.8rem;
    align-items: end;
}

.assist-span {
    grid-column: 1 / -1;
}

.assist-plan textarea {
    font-family: inherit;
    width: 100%;
}

.assist-effort {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.assist-hints {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.assist-check p {
    margin: 0 0 0.35rem;
}

.assist-verdict {
    font-weight: 700;
}

.assist-noch_nicht {
    color: var(--brand-red);
}

.assist-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 700px) {
    .assist-plan {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Dashboard-Widgets: frei anordnen, Breite, ein-/ausblenden */
.dash-widgets {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: 8px;
    grid-auto-flow: row dense;
    column-gap: 16px;
    row-gap: 0;
    align-items: start;
    margin-bottom: 1rem;
}

.dash-widget {
    grid-column: span 3;
    align-self: start;
    min-width: 0;
}

.dash-widget.has-height {
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.dash-widget.has-height > .dash-card-head,
.dash-widget.has-height > .dash-widget-tools {
    flex: none;
}

.dash-resize {
    position: absolute;
    right: 2px;
    bottom: 2px;
    z-index: 3;
    width: 22px;
    height: 22px;
    border-radius: 0 0 8px 0;
    background:
        linear-gradient(135deg, transparent 0 45%, var(--brand-red) 45% 52%, transparent 52% 64%, var(--brand-red) 64% 71%, transparent 71% 83%, var(--brand-red) 83% 90%, transparent 90%);
    cursor: nwse-resize;
    touch-action: none;
}

.dash-resize[hidden] {
    display: none;
}

.dash-widget.is-resizing {
    outline-color: var(--brand-red) !important;
    opacity: 1;
}

.dash-list-card > :last-child:not(header) {
    padding: 0 1rem 0.8rem;
}

.dash-pad {
    margin: 0;
    padding: 0.3rem 1rem 0.9rem;
}

.dash-today {
    display: grid;
    padding-bottom: 0.4rem;
}

.dash-today-row {
    display: grid;
    grid-template-columns: 6.6rem minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.45rem 1rem;
    border: 0;
    border-top: 1px solid var(--line);
    background: none;
    font: inherit;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.dash-today-row:hover {
    background: var(--canvas);
}

.dash-today-time {
    color: var(--brand-red);
    font-weight: 600;
    font-size: 0.85rem;
}

.dash-today-text {
    display: grid;
    min-width: 0;
}

.dash-today-text strong,
.dash-today-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-today-text small {
    color: var(--muted);
    font-size: 0.78rem;
}

.dash-tray {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1.5px dashed var(--brand-red);
    border-radius: 10px;
    background: var(--brand-red-soft);
}

.dash-tray p {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
}

.dash-tray-hidden {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dash-chip {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--brand-red);
    border-radius: 999px;
    background: var(--surface);
    color: var(--brand-red);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.dash-tray-actions {
    display: flex;
    gap: 0.5rem;
}

.dash-widget-tools {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px dashed var(--line-strong);
    background: var(--canvas);
    border-radius: 8px 8px 0 0;
}

.dash-widget-tools button {
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.dash-widget-tools button:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.dash-grip {
    color: var(--muted);
    cursor: grab;
}

.dash-widget-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
}

.dash-widgets.is-editing .dash-widget {
    touch-action: none;
    outline: 2px dashed var(--line-strong);
    outline-offset: 2px;
    cursor: grab;
}

.dash-widgets.is-editing .dash-widget > :not(.dash-widget-tools):not(.dash-resize) {
    pointer-events: none;
    opacity: 0.75;
}

.dash-widget.is-dragging {
    opacity: 0.4;
}

.dash-widget.drop-before {
    box-shadow: -4px 0 0 var(--brand-red);
}

.dash-widget.drop-after {
    box-shadow: 4px 0 0 var(--brand-red);
}

@media (max-width: 1250px) {
    .dash-widget[data-w="2"],
    .dash-widget[data-w="3"],
    .dash-widget[data-w="4"],
    .dash-widget[data-w="5"] {
        grid-column: span 6 !important;
    }

    .dash-widget[data-w="7"],
    .dash-widget[data-w="8"],
    .dash-widget[data-w="9"],
    .dash-widget[data-w="10"],
    .dash-widget[data-w="11"] {
        grid-column: 1 / -1 !important;
    }

    .dash-tray {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .dash-widgets {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-widget[data-w] {
        grid-column: 1 / -1 !important;
    }
}
