:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #182230;
    --muted: #68758a;
    --border: #dce3ef;
    --primary: #1769d2;
    --primary-dark: #0d4f9e;
    --danger: #d92d20;
    --danger-dark: #b42318;
    --work-bg: #ecfdf3;
    --work-border: #12b76a;
    --wait-bg: #fffaeb;
    --wait-border: #f79009;
    --pause-bg: #eef4ff;
    --pause-border: #1769d2;
    --stop-bg: #f8fafc;
    --stop-border: #98a2b3;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-size: 13px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

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

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 18px 50px rgba(16, 24, 40, .08);
}


.app-logo {
    display: block;
    height: auto;
    object-fit: contain;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.login-logo {
    max-width: 230px;
    width: 72%;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-logo {
    width: 230px;
    max-height: 48px;
    flex: 0 0 auto;
}

.brand-block > div {
    min-width: 0;
}

.login-card h1,
.topbar h1 {
    margin: 0 0 6px;
    letter-spacing: -.03em;
}

.login-card form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
    outline: none;
}

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

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 105, 210, .12);
}

button, .top-button, .logout {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    background: #eef4ff;
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 650;
    white-space: nowrap;
}

button:hover, .top-button:hover, .logout:hover { filter: brightness(.97); }
button:disabled { opacity: .55; cursor: not-allowed; }

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

.danger {
    background: #fff1f0;
    color: var(--danger-dark);
}

.danger:hover {
    background: #fee4e2;
}

.alert {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid #fecdca;
    background: #fffbfa;
    color: var(--danger-dark);
    border-radius: 10px;
}

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

.hint {
    margin-bottom: 0;
    font-size: 12px;
}

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

.app {
    padding: 18px 22px;
    display: grid;
    gap: 16px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) 120px 140px 70px;
    gap: 12px;
    align-items: stretch;
}

.summary-card,
.add-button,
.control-button {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .05);
}

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

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

.summary-card strong {
    font-size: clamp(22px, 2.4vw, 32px);
    letter-spacing: -.04em;
}

.waiting-summary {
    border-color: #fedf89;
}

.add-button {
    font-size: 42px;
    line-height: 1;
    color: #fff;
    background: var(--primary);
    display: grid;
    place-items: center;
    padding: 0;
}

.control-button {
    display: grid;
    place-items: center;
    text-align: center;
    padding: 0 12px;
    min-height: 80px;
}

.pause-button {
    background: #eef4ff;
    color: var(--primary-dark);
}

.pause-button.is-paused {
    background: var(--primary);
    color: #fff;
}

.stop-button {
    background: #fff1f0;
    color: var(--danger-dark);
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .05);
}

.tracker-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1180px;
    table-layout: fixed;
}

.col-status { width: 95px; }
.col-customer { width: 170px; }
.col-note { width: auto; }
.col-work { width: 105px; }
.col-wait { width: 105px; }
.col-log { width: 320px; }
.col-actions { width: 185px; }

.tracker-table th, .tracker-table td {
    padding: 8px 9px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.tracker-table th {
    background: #f8fafc;
    color: var(--muted);
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    position: static;
    z-index: auto;
}

.entry-row {
    border-left: 5px solid transparent;
}

.entry-row.working td:first-child { border-left: 6px solid var(--work-border); }
.entry-row.waiting td:first-child { border-left: 6px solid var(--wait-border); }
.entry-row.paused td:first-child { border-left: 6px solid var(--pause-border); }
.entry-row.stopped td:first-child { border-left: 6px solid var(--stop-border); }

.entry-row.working { background: var(--work-bg); }
.entry-row.waiting { background: var(--wait-bg); }
.entry-row.paused { background: var(--pause-bg); }
.entry-row.stopped { background: var(--stop-bg); }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.8);
    font-size: 12px;
    font-weight: 700;
}

.status-cell { width: 95px; }
.customer-cell { width: 170px; }
.note-cell { width: auto; }
.log-cell { width: 320px; }
.actions-cell { width: 185px; }

.actions-cell button {
    display: block;
    width: 100%;
    margin-bottom: 7px;
}

.actions-cell button:last-child {
    margin-bottom: 0;
}

.time-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 17px;
    white-space: nowrap;
}


.note-input {
    min-height: 112px;
    width: 100%;
}

.note-cell textarea,
.log-cell textarea {
    display: block;
}

.time-cell {
    width: 105px;
    min-width: 105px;
}

.actions-cell button {
    padding: 8px 9px;
    font-size: 13px;
}

.log-output {
    min-height: 112px;
    font-size: 12px;
    color: #344054;
    background: rgba(255,255,255,.7);
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 28px !important;
}

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

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .48);
}

.modal-backdrop[hidden] {
    display: none !important;
}

.modal-card {
    width: min(520px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.small-modal .modal-card {
    width: min(620px, 100%);
}

.modal-card h2 {
    margin: 0 0 8px;
    letter-spacing: -.02em;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.stacked-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.stacked-actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
}

.timeout-bar {
    height: 8px;
    margin-top: 14px;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
}

.timeout-bar span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

@keyframes shrinkWidth {
    from { width: 100%; }
    to { width: 0%; }
}

@media (max-width: 1300px) {
    .summary-grid {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
    .control-button,
    .add-button {
        min-height: 64px;
    }
}

@media (max-width: 900px) {
    .topbar, .app { padding: 16px; }
    .summary-grid {
        grid-template-columns: 1fr;
    }
    .modal-actions {
        display: grid;
    }
    .stacked-actions {
        grid-template-columns: 1fr;
    }
}

/* Adminbereich */
.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.top-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    border: 1px solid transparent;
}

.admin-button {
    background: #f4ebff;
    color: #6941c6;
    border-color: #e9d7fe;
}

.dashboard-button {
    background: #eef4ff;
    color: var(--primary-dark);
    border-color: #d1e0ff;
}

.logout {
    background: #eef4ff;
    color: var(--primary-dark);
}

select,
.form-control {
    min-height: 37px;
    height: 37px;
    padding: 8px 34px 8px 10px;
    background-color: #fff;
    background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select::-ms-expand {
    display: none;
}

.password-suggest-wrap {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.password-suggest-wrap input[type="text"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .02em;
}

.suggest-password {
    padding: 8px 10px;
    font-size: 12px;
    background: #f2f4f7;
    color: #344054;
    border: 1px solid var(--border);
}

.compact-password {
    grid-template-columns: minmax(220px, 1fr) auto;
}

.compact-password .suggest-password {
    width: auto;
}

.admin-page {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.admin-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .05);
    padding: 18px;
}

.admin-card h2 {
    margin: 0 0 16px;
    letter-spacing: -.02em;
}

.admin-form {
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) minmax(180px, 1fr) minmax(330px, 1.35fr) minmax(130px, .65fr) auto;
    gap: 12px;
    align-items: end;
}

.admin-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.admin-table {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table th,
.admin-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
    min-width: 390px;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
    width: 145px;
    min-width: 145px;
}

.role-select {
    display: block;
}

.admin-actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.notice {
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 650;
}

.notice.success {
    border: 1px solid #abefc6;
    background: #ecfdf3;
    color: #067647;
}

.notice.error {
    border: 1px solid #fecdca;
    background: #fffbfa;
    color: var(--danger-dark);
}

.admin-hint {
    margin: 12px 0 0;
    font-size: 12px;
}

@media (max-width: 1000px) {
    .admin-form {
        grid-template-columns: 1fr;
    }
    .top-actions {
        flex-wrap: wrap;
    }
}


.form-errors,
.inline-form-errors {
    border: 1px solid #fecdca;
    background: #fffbfa;
    color: var(--danger-dark);
    border-radius: 10px;
    font-weight: 650;
}

.form-errors {
    grid-column: 1 / -1;
    padding: 10px 12px;
}

.inline-form-errors {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    white-space: normal;
    font-size: 12px;
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(217, 45, 32, .12);
}


.admin-delete-modal .modal-card {
    width: min(460px, 100%);
}

.admin-delete-modal p {
    margin: 10px 0 0;
    line-height: 1.45;
}

#deleteUserName {
    color: var(--danger-dark);
}
