:root {
    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-border: #e2e4e9;
    --color-text: #1c1e21;
    --color-text-muted: #6b7280;
    --color-primary: #1f4e8c;
    --color-primary-hover: #163a68;
    --color-error: #b3261e;
    --shadow-tile: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-tile-hover: 0 4px 10px rgba(0, 0, 0, 0.1);
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
}

.topbar__brand {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-text);
    text-decoration: none;
}

.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px 64px;
}

.page-title {
    font-size: 1.6rem;
    margin: 0 0 8px;
}

.page-subtitle {
    color: var(--color-text-muted);
    margin: 0 0 32px;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

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

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.messages__item {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.messages__item--error {
    background: #fdecea;
    color: var(--color-error);
    border: 1px solid #f5c6c2;
}

/* Kacheln */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-tile);
    padding: 28px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tile:hover {
    box-shadow: var(--shadow-tile-hover);
    transform: translateY(-2px);
}

.tile__logo-wrap {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.tile__logo {
    max-height: 64px;
    max-width: 100%;
    object-fit: contain;
}

.tile__name {
    font-weight: 600;
    margin-bottom: 4px;
}

.tile__format {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Login */
.login {
    display: flex;
    justify-content: center;
    padding-top: 60px;
}

.login__form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-tile);
    padding: 32px;
    width: 100%;
    max-width: 340px;
}

.login__title {
    margin: 0 0 4px;
    font-size: 1.3rem;
}

.login__hint {
    color: var(--color-text-muted);
    margin: 0 0 20px;
    font-size: 0.9rem;
}

.login__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 16px;
}

.login__submit { width: 100%; }

/* Upload */
.upload-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}

.upload-header__logo {
    max-height: 48px;
    max-width: 140px;
    object-fit: contain;
}

.upload-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-tile);
    padding: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.upload-form__input { flex: 1; min-width: 220px; }

.result-placeholder {
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--color-text-muted);
}

.result-placeholder--error {
    border-style: solid;
    border-color: #f5c6c2;
    background: #fdecea;
    color: var(--color-error);
}

/* BOM-Tabelle */
.bom-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-tile);
    overflow-x: auto;
}

.bom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.bom-table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.bom-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    white-space: nowrap;
}

.bom-row:last-child td { border-bottom: none; }

.bom-row[data-level='2'] .bom-row__text { padding-left: 16px; }
.bom-row[data-level='3'] .bom-row__text { padding-left: 32px; }

.bom-row__id-cell,
.bom-row__menge-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bom-row__id { font-variant-numeric: tabular-nums; }

.copy-btn {
    flex: none;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: #e2e4e9;
    color: #374151;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.copy-btn:hover { background: #d3d6dc; }

.copy-btn.is-copied {
    background: #1a7f37;
    color: #ffffff;
}

.copy-btn.is-copied:hover { background: #166a2e; }

/* Buttons */
.btn {
    display: inline-block;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}

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

.btn--primary:hover { background: var(--color-primary-hover); }
