:root {
    --ink: #101322;
    --ink-soft: #474b5e;
    --muted: #74788b;
    --line: #e7e9f1;
    --surface: #ffffff;
    --surface-soft: #f6f7fb;
    --cyan: #18b7c1;
    --blue: #4776d0;
    --purple: #9c25ba;
    --purple-dark: #72228f;
    --orange: #f49b45;
    --green: #198b68;
    --red: #c84856;
    --gradient: linear-gradient(100deg, var(--cyan), var(--blue) 52%, var(--purple));
    --shadow: 0 22px 60px rgba(28, 32, 66, 0.10);
    --shadow-soft: 0 8px 26px rgba(28, 32, 66, 0.07);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--surface-soft);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

button {
    cursor: pointer;
}

.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;
}

.is-hidden {
    display: none !important;
}

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

.eyebrow {
    margin: 0 0 8px;
    color: var(--purple);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow.light {
    color: #9ef5fb;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-weight: 750;
    line-height: 1;
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:focus-visible,
.tab:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(24, 183, 193, 0.24);
    outline-offset: 2px;
}

.button-primary {
    color: #fff;
    background: var(--gradient);
    box-shadow: 0 9px 22px rgba(117, 43, 174, 0.20);
}

.button-secondary {
    color: var(--purple-dark);
    background: #fff;
    border-color: #d8c7e7;
}

.button-quiet {
    color: var(--ink-soft);
    background: transparent;
    border-color: var(--line);
}

.button-quiet-light {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.32);
}

.button-small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
}

.button-block {
    width: 100%;
    min-height: 48px;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 1.12fr) minmax(420px, 0.88fr);
}

.login-brand {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 9vw;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(11, 17, 38, 0.96), rgba(36, 19, 59, 0.98)),
        var(--ink);
}

.login-brand::after {
    position: absolute;
    inset: auto 0 0;
    height: 7px;
    content: "";
    background: var(--gradient);
}

.brand-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(1px);
    opacity: 0.25;
}

.brand-glow-one {
    top: -14vw;
    left: -8vw;
    width: 38vw;
    height: 38vw;
    background: radial-gradient(circle, var(--cyan), transparent 68%);
}

.brand-glow-two {
    right: -10vw;
    bottom: -13vw;
    width: 42vw;
    height: 42vw;
    background: radial-gradient(circle, var(--purple), transparent 70%);
}

.login-brand-content {
    position: relative;
    z-index: 1;
    max-width: 650px;
}

.login-logo {
    width: min(420px, 80%);
    margin: 0 0 56px;
    padding: 10px 16px;
    border-radius: 12px;
    background: #fff;
}

.login-brand h1 {
    max-width: 620px;
    margin: 0;
    font-size: clamp(2.5rem, 4.4vw, 5.2rem);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.login-lead {
    max-width: 580px;
    margin: 28px 0 36px;
    color: #c8ccdb;
    font-size: 1.12rem;
    line-height: 1.65;
}

.login-feature-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-feature-row span {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    color: #e7e9f3;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.82rem;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 54px;
    background:
        radial-gradient(circle at 90% 8%, rgba(156, 37, 186, 0.08), transparent 31%),
        #f8f8fb;
}

.login-card {
    width: min(440px, 100%);
    padding: 46px;
    border: 1px solid rgba(225, 226, 235, 0.88);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow);
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 2rem;
    letter-spacing: -0.035em;
}

.login-card > .muted {
    margin: 0 0 32px;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.field > span {
    color: var(--ink-soft);
    font-size: 0.84rem;
    font-weight: 700;
}

.field small {
    color: var(--muted);
    font-weight: 500;
}

.field input,
.field select,
.field textarea,
.search-box input,
.year-filter select {
    width: 100%;
    border: 1px solid #dfe1ea;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
}

.field input,
.field select {
    min-height: 44px;
    padding: 0 13px;
}

.field textarea {
    resize: vertical;
    padding: 12px 13px;
}

.alert {
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
}

.alert-error {
    color: #8f2330;
    background: #fff0f2;
    border: 1px solid #f5cbd1;
}

.app-header {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 10px clamp(22px, 4vw, 64px);
    border-bottom: 1px solid rgba(228, 229, 237, 0.9);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--ink);
    text-decoration: none;
}

.brand img {
    width: 230px;
    max-height: 48px;
    object-fit: contain;
}

.brand-divider {
    width: 1px;
    height: 30px;
    background: var(--line);
}

.brand-product {
    font-weight: 800;
}

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

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
}

.user-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--gradient);
}

.app-main {
    width: min(1500px, calc(100% - 44px));
    margin: 0 auto;
    padding: 50px 0 74px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 26px;
    margin-bottom: 30px;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.3rem);
    letter-spacing: -0.055em;
}

.page-heading .muted {
    margin: 10px 0 0;
}

.heading-actions {
    display: flex;
    gap: 10px;
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 105px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.stat-icon {
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px;
    font-weight: 900;
}

.stat-icon-cyan {
    color: #08727b;
    background: #dff7f8;
}

.stat-icon-purple {
    color: #7b248e;
    background: #f4e6f7;
}

.stat-icon-blue {
    color: #315aa5;
    background: #e7edfb;
}

.stat-icon-orange {
    color: #a65c1f;
    background: #fff0df;
}

.stat-label,
.stat-value {
    display: block;
}

.stat-label {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.stat-value {
    font-size: 1.65rem;
    letter-spacing: -0.035em;
}

.reminder-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(100deg, #232747, #64317e);
    box-shadow: var(--shadow-soft);
}

.reminder-strip > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.reminder-strip span:last-child {
    overflow: hidden;
    color: #d8d9e5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reminder-badge {
    padding: 5px 9px;
    border-radius: 999px;
    color: #0d5a60;
    background: #9ef5fb;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.workspace-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 70px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
}

.tabs {
    display: flex;
    align-self: stretch;
    gap: 24px;
}

.tab {
    position: relative;
    padding: 0 2px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-weight: 800;
}

.tab::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    content: "";
    opacity: 0;
    background: var(--gradient);
}

.tab.is-active {
    color: var(--ink);
}

.tab.is-active::after {
    opacity: 1;
}

.tab-count {
    display: inline-grid;
    min-width: 24px;
    height: 24px;
    margin-left: 5px;
    padding: 0 6px;
    place-items: center;
    border-radius: 999px;
    color: var(--purple-dark);
    background: #f3e8f6;
    font-size: 0.72rem;
}

.workspace-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    width: min(290px, 25vw);
    min-height: 40px;
    padding-left: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: var(--surface-soft);
}

.search-box input {
    min-width: 0;
    height: 38px;
    padding: 0 10px 0 8px;
    border: 0;
    background: transparent;
    outline: 0;
}

.year-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.year-filter select {
    min-height: 40px;
    padding: 0 28px 0 10px;
}

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

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

th {
    padding: 14px 16px;
    color: var(--muted);
    background: #fafafe;
    font-size: 0.69rem;
    font-weight: 850;
    letter-spacing: 0.055em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: 17px 16px;
    border-top: 1px solid #edeef4;
    vertical-align: middle;
}

tbody tr {
    transition: background 120ms ease;
}

tbody tr:hover {
    background: #fbfbfe;
}

tbody tr.is-reminder-due {
    background: #fffbf5;
}

.contact-cell strong,
.contact-cell span {
    display: block;
}

.contact-cell strong {
    margin-bottom: 4px;
}

.contact-cell span {
    max-width: 240px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.source-agile_unternehmen {
    color: #146f78;
    background: #e1f7f8;
    border-color: #c3edef;
}

.source-projektify {
    color: #75288a;
    background: #f4e7f7;
    border-color: #e7cfed;
}

.source-other,
.source-unknown {
    color: #5f6272;
    background: #f0f1f5;
    border-color: #e0e2e9;
}

.status-open,
.status-ordered {
    color: #216276;
    background: #e2f5f7;
}

.status-waiting {
    color: #8a5c16;
    background: #fff3d9;
}

.status-won,
.status-paid,
.status-completed {
    color: #17684f;
    background: #e1f4ec;
}

.status-lost,
.status-cancelled,
.status-ignored {
    color: #913340;
    background: #fdebee;
}

.price-cell strong {
    display: block;
    font-size: 1rem;
}

.price-cell small,
.subline {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.74rem;
}

.next-action {
    max-width: 230px;
    line-height: 1.4;
}

.toggle-mini {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.toggle-mini input {
    width: 36px;
    height: 20px;
    accent-color: var(--purple);
    cursor: pointer;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.row-button {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink-soft);
    background: #fff;
    font-size: 0.74rem;
    font-weight: 800;
}

.row-button-primary {
    color: var(--purple-dark);
    border-color: #ddc9e7;
    background: #fbf5fc;
}

.loading-cell,
.empty-cell {
    height: 180px;
    color: var(--muted);
    text-align: center;
}

.empty-cell strong {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 1rem;
}

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

.table-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    padding: 18px 20px;
    border-top: 1px solid var(--line);
    background: #fafafe;
}

.table-footer span {
    color: var(--muted);
    font-size: 0.8rem;
}

.table-footer strong {
    font-size: 1.16rem;
}

.modal {
    width: min(760px, calc(100% - 28px));
    max-height: calc(100vh - 40px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 30px 100px rgba(12, 16, 38, 0.28);
}

.modal::backdrop {
    background: rgba(15, 17, 34, 0.58);
    backdrop-filter: blur(4px);
}

.modal-card {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 26px 28px 20px;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.035em;
}

.icon-button {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    background: #fff;
    font-size: 1.4rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    padding: 24px 28px 8px;
}

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

.reminder-settings {
    margin: 2px 0 18px;
    padding: 16px;
    border: 1px solid #e9dfed;
    border-radius: 13px;
    background: #fcf9fd;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
}

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

.toggle-row strong {
    margin-bottom: 3px;
    font-size: 0.86rem;
}

.toggle-row small {
    color: var(--muted);
    font-size: 0.76rem;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-control {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #cfd1da;
    transition: background 160ms ease;
}

.toggle-control::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    content: "";
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: transform 160ms ease;
}

.toggle-input:checked + .toggle-control {
    background: var(--gradient);
}

.toggle-input:checked + .toggle-control::after {
    transform: translateX(20px);
}

.reminder-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.reminder-fields .field {
    margin: 0;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    color: var(--ink-soft);
    font-size: 0.86rem;
    font-weight: 650;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--purple);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 28px 24px;
    border-top: 1px solid var(--line);
}

.toast {
    position: fixed;
    z-index: 30;
    right: 24px;
    bottom: 24px;
    max-width: min(400px, calc(100% - 48px));
    padding: 14px 18px;
    border-radius: 12px;
    color: #fff;
    background: #22263c;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-error {
    background: #9d3441;
}

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

    .brand-product,
    .brand-divider {
        display: none;
    }

    .workspace-top {
        align-items: stretch;
        flex-direction: column;
        padding-top: 10px;
    }

    .tabs {
        min-height: 54px;
    }

    .workspace-tools {
        padding-bottom: 12px;
    }

    .search-box {
        width: 100%;
        max-width: 380px;
    }
}

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

    .login-brand {
        min-height: 340px;
        padding: 48px 30px;
    }

    .login-logo {
        width: min(360px, 88%);
        margin-bottom: 30px;
    }

    .login-brand h1 {
        font-size: clamp(2.35rem, 9vw, 4rem);
    }

    .login-panel {
        padding: 36px 20px 60px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions .button {
        flex: 1;
    }

    .app-header {
        padding-right: 20px;
        padding-left: 20px;
    }

    .brand img {
        width: 180px;
    }

    .user-pill {
        display: none;
    }
}

@media (max-width: 620px) {
    .app-main {
        width: min(100% - 24px, 1500px);
        padding-top: 30px;
    }

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

    .stat-card {
        min-height: 88px;
    }

    .heading-actions,
    .workspace-tools,
    .reminder-strip,
    .reminder-strip > div {
        align-items: stretch;
        flex-direction: column;
    }

    .workspace-tools {
        width: 100%;
    }

    .search-box {
        max-width: none;
    }

    .year-filter {
        justify-content: space-between;
    }

    .form-grid {
        grid-template-columns: 1fr;
        padding-right: 20px;
        padding-left: 20px;
    }

    .form-wide {
        grid-column: auto;
    }

    .reminder-fields {
        grid-template-columns: 1fr;
    }

    .modal-header,
    .modal-footer {
        padding-right: 20px;
        padding-left: 20px;
    }

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

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