/*
 * Hagner Lagerverwaltung
 * Copyright (c) 2026 Marc Hagner. Alle Rechte vorbehalten.
 */

:root {
    --excel-green: #217346;
    --excel-green-dark: #185c37;
    --excel-green-light: #e2f0d9;
    --grid: #d0d0d0;
    --grid-dark: #a6a6a6;
    --sheet-bg: #ffffff;
    --header-bg: #f3f3f3;
    --text: #202020;
    --muted: #666666;
    --danger: #c42b1c;
    --warning: #fff4ce;
    --selection: #107c41;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #e9e9e9;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
}

button,
input {
    font: inherit;
}

a {
    color: var(--excel-green-dark);
}

.excel-titlebar {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 16px;
    background: var(--excel-green);
    color: #fff;
}

.excel-logo {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .16);
    border: 1px solid rgba(255, 255, 255, .35);
    font-size: 20px;
    font-weight: 700;
}

.workbook-title {
    min-width: 0;
}

.workbook-title strong,
.excel-titlebar strong {
    display: block;
    font-size: 16px;
}

.titlebar-subtitle {
    display: block;
    font-size: 12px;
    opacity: .84;
}

.titlebar-status {
    margin-left: auto;
    font-size: 13px;
    opacity: .9;
}

.excel-ribbon-tabs {
    display: flex;
    gap: 2px;
    min-height: 38px;
    padding: 0 12px;
    background: #f7f7f7;
    border-bottom: 1px solid var(--grid);
}

.excel-ribbon-tabs a {
    display: flex;
    align-items: center;
    padding: 0 17px;
    color: #222;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}

.excel-ribbon-tabs a:hover,
.excel-ribbon-tabs a.active {
    color: var(--excel-green-dark);
    border-bottom-color: var(--excel-green);
    background: #fff;
}

.excel-ribbon {
    min-height: 76px;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--grid-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
}

.ribbon-group {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 0 12px;
    border-right: 1px solid var(--grid);
}

.ribbon-command {
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 8px;
    color: #222;
    text-align: center;
    text-decoration: none;
    font-size: 12px;
}

.ribbon-command:hover {
    background: #e8f3ec;
    outline: 1px solid #b7d7c4;
}

.command-icon {
    font-size: 23px;
    line-height: 1;
    color: var(--excel-green-dark);
}

.ribbon-hint {
    align-self: center;
    margin-left: auto;
    padding: 0 16px;
    color: var(--muted);
    font-size: 13px;
}

.flash {
    max-width: 1400px;
    margin: 12px auto 0;
    padding: 11px 15px;
    border: 1px solid;
    font-weight: 600;
}

.flash.success {
    color: #155724;
    background: #dff0d8;
    border-color: #a8d08d;
}

.flash.error {
    color: #8a1f11;
    background: #fce8e6;
    border-color: #e6aaa4;
}

.workbook {
    max-width: 1400px;
    margin: 14px auto 42px;
    background: var(--sheet-bg);
    border: 1px solid var(--grid-dark);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .11);
}

.formula-bar {
    min-height: 38px;
    display: grid;
    grid-template-columns: 92px 42px 1fr;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--grid-dark);
}

.name-box,
.fx,
.formula-value {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 6px 10px;
    border-right: 1px solid var(--grid);
}

.name-box {
    justify-content: center;
    font-size: 13px;
}

.fx {
    justify-content: center;
    color: var(--muted);
    font-style: italic;
    font-weight: 700;
}

.formula-value {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sheet {
    background: #fff;
}

.column-letters {
    display: grid;
    min-height: 27px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--grid-dark);
}

.scan-columns,
.form-columns {
    grid-template-columns: 46px minmax(180px, .75fr) minmax(280px, 2fr);
}

.column-letters span {
    display: grid;
    place-items: center;
    border-right: 1px solid var(--grid);
    color: #555;
    font-size: 12px;
    font-weight: 600;
}

.sheet-row {
    display: grid;
    min-height: 46px;
}

.scan-entry-row,
.result-row,
.form-row {
    grid-template-columns: 46px minmax(180px, .75fr) minmax(280px, 2fr);
}

.sheet-row > * {
    min-width: 0;
    border-right: 1px solid var(--grid);
    border-bottom: 1px solid var(--grid);
}

.row-number {
    display: grid;
    place-items: center;
    background: var(--header-bg);
    color: #555;
    font-size: 12px;
    font-weight: 400;
    user-select: none;
}

.scan-entry-row label,
.form-row label,
.header-cell,
.action-label,
.result-label {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    font-weight: 600;
    background: #fafafa;
}

.scan-entry-row input,
.form-row input {
    width: 100%;
    min-height: 45px;
    border: 0;
    border-radius: 0;
    padding: 8px 11px;
    outline: none;
    background: #fff;
}

.scan-entry-row input:focus,
.form-row input:focus,
.grid-input:focus {
    box-shadow: inset 0 0 0 2px var(--selection);
}

.cell-with-button {
    display: grid;
    grid-template-columns: 1fr auto;
}

.cell-button {
    min-width: 96px;
    border: 0;
    border-left: 1px solid var(--grid-dark);
    background: var(--excel-green);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.cell-button:hover {
    background: var(--excel-green-dark);
}

.result-value,
.result-location {
    display: flex;
    align-items: center;
    padding: 9px 12px;
}

.result-location {
    min-height: 68px;
    color: var(--excel-green-dark);
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 700;
}

.result-row.found .result-value,
.result-row.found .result-location {
    background: #e2f0d9;
}

.result-row.missing .result-value,
.result-row.missing .result-location {
    background: #fce8e6;
    color: #a4262c;
}

.result-row.waiting .result-value,
.result-row.waiting .result-location {
    background: #fff4ce;
    color: #5c4b00;
}

.sheet-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
}

.excel-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid #8a8a8a;
    border-radius: 2px;
    background: #f7f7f7;
    color: #222;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}

.excel-button:hover {
    background: #e9e9e9;
    border-color: #666;
}

.excel-button.primary {
    color: #fff;
    background: var(--excel-green);
    border-color: var(--excel-green-dark);
}

.excel-button.primary:hover {
    background: var(--excel-green-dark);
}

.excel-button.danger {
    color: #fff;
    background: var(--danger);
    border-color: #8f1f15;
}

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

.delete-strip {
    display: flex;
    justify-content: flex-end;
    padding: 12px;
    background: #fafafa;
    border-top: 1px solid var(--grid);
}

.table-toolbar {
    padding: 10px;
    background: #fafafa;
    border-bottom: 1px solid var(--grid-dark);
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-form label {
    font-weight: 600;
}

.filter-form input {
    flex: 1 1 320px;
    min-height: 35px;
    padding: 6px 9px;
    border: 1px solid var(--grid-dark);
}

.spreadsheet-scroll {
    max-height: 66vh;
    overflow: auto;
}

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

.spreadsheet-table th,
.spreadsheet-table td {
    height: 37px;
    padding: 0;
    border-right: 1px solid var(--grid);
    border-bottom: 1px solid var(--grid);
    text-align: left;
    vertical-align: middle;
}

.spreadsheet-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.column-letter-row th,
.table-header-row th {
    background: var(--header-bg);
    text-align: center;
    color: #444;
}

.column-letter-row th {
    height: 26px;
    font-size: 12px;
    font-weight: 500;
}

.table-header-row th {
    height: 34px;
    padding: 5px 8px;
    font-weight: 700;
}

.spreadsheet-table .corner-cell,
.spreadsheet-table .row-number {
    width: 46px;
    text-align: center;
    background: var(--header-bg);
}

.spreadsheet-table th:nth-child(2),
.spreadsheet-table td:nth-child(2) {
    width: 180px;
}

.spreadsheet-table th:nth-child(3),
.spreadsheet-table td:nth-child(3) {
    width: 210px;
}

.spreadsheet-table th:nth-child(5),
.spreadsheet-table td:nth-child(5) {
    width: 150px;
}

.spreadsheet-table th:nth-child(6),
.spreadsheet-table td:nth-child(6) {
    width: 156px;
}

.spreadsheet-table tbody tr:hover td {
    background: #f4fbf7;
}

.article-cell,
.date-cell,
.empty-cell {
    padding: 7px 9px !important;
}

.article-cell {
    font-weight: 600;
}

.date-cell {
    color: var(--muted);
    font-size: 13px;
}

.grid-input {
    width: 100%;
    height: 36px;
    padding: 6px 8px;
    border: 0;
    outline: none;
    background: transparent;
}

.action-cell {
    padding: 3px 5px !important;
    white-space: nowrap;
}

.table-action {
    display: inline-flex;
    padding: 4px 7px;
    border: 1px solid #aaa;
    background: #f6f6f6;
    color: #222;
    text-decoration: none;
    cursor: pointer;
    font-size: 12px;
}

.table-action.save {
    color: #fff;
    background: var(--excel-green);
    border-color: var(--excel-green-dark);
}

.import-panel {
    padding: 11px 14px;
    background: #fafafa;
    border-top: 1px solid var(--grid-dark);
}

.import-panel summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--excel-green-dark);
}

.import-panel form {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding-top: 12px;
}

.import-panel p {
    width: 100%;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.excel-statusbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 26px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 4px 13px;
    background: var(--excel-green);
    color: #fff;
    font-size: 12px;
    z-index: 20;
}

.excel-statusbar span:last-child {
    margin-left: auto;
}

/* Installer */
.installer-page {
    background: #ededed;
}

.installer-shell {
    max-width: 920px;
    margin: 34px auto;
    padding: 0 16px;
}

.installer-card {
    padding: 28px;
    background: #fff;
    border: 1px solid var(--grid-dark);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .13);
}

.installer-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--grid);
}

.installer-heading h1 {
    margin: 0;
    font-size: 30px;
}

.installer-heading p {
    margin: 8px 0 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--excel-green-dark) !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
    font-weight: 700;
}

.step-badge {
    flex: 0 0 auto;
    align-self: start;
    padding: 8px 11px;
    background: var(--excel-green-light);
    color: var(--excel-green-dark);
    font-weight: 700;
}

.installer-card h2 {
    margin: 24px 0 10px;
    font-size: 19px;
}

.check-table {
    border: 1px solid var(--grid-dark);
}

.check-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    min-height: 58px;
    border-bottom: 1px solid var(--grid);
}

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

.check-icon {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
}

.check-icon.ok {
    background: var(--excel-green);
}

.check-icon.fail {
    background: var(--danger);
}

.check-row strong,
.check-row span {
    display: block;
}

.check-row span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.installer-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.installer-form > input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--grid-dark);
}

.field-help,
.help-text {
    color: var(--muted);
    font-size: 13px;
}

.readonly-field,
.finish-cell {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 12px;
    background: #f6f6f6;
    border: 1px solid var(--grid);
}

.installer-actions {
    display: flex;
    gap: 9px;
    margin-top: 20px;
}

.notice {
    margin: 18px 0;
    padding: 13px 15px;
    border: 1px solid;
}

.notice.success {
    background: #e2f0d9;
    border-color: #a8d08d;
    color: #155724;
}

.notice.error {
    background: #fce8e6;
    border-color: #e6aaa4;
    color: #8a1f11;
}

.notice.warning {
    background: var(--warning);
    border-color: #e5cc75;
    color: #5c4b00;
}

.finish-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.finish-cell {
    display: block;
}

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

.finish-cell span {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 4px;
}

@media (max-width: 720px) {
    .titlebar-status,
    .ribbon-hint {
        display: none;
    }

    .excel-ribbon {
        overflow-x: auto;
    }

    .ribbon-group {
        padding: 0 5px;
    }

    .workbook {
        margin: 8px 6px 42px;
    }

    .scan-columns,
    .form-columns,
    .scan-entry-row,
    .result-row,
    .form-row {
        grid-template-columns: 40px minmax(125px, .8fr) minmax(190px, 1.4fr);
    }

    .formula-bar {
        grid-template-columns: 62px 38px 1fr;
    }

    .installer-card {
        padding: 18px;
    }

    .installer-heading,
    .readonly-field {
        display: block;
    }

    .step-badge {
        margin-top: 14px;
        display: inline-block;
    }

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

    .excel-statusbar {
        gap: 10px;
    }
}


/* Copyright-Anzeige */
.excel-statusbar .copyright {
    margin-left: auto;
    white-space: nowrap;
}

.installer-copyright {
    padding: 18px 20px 28px;
    color: #666;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 760px) {
    .excel-statusbar .copyright {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }
}
