:root {
    --wsim-bg: #111827;
    --wsim-panel: rgba(17, 24, 39, 0.82);
    --wsim-panel-strong: rgba(31, 41, 55, 0.94);
    --wsim-text: #f9fafb;
    --wsim-muted: #cbd5e1;
    --wsim-border: rgba(255, 255, 255, 0.14);
    --wsim-accent: #f59e0b;
    --wsim-good: #22c55e;
    --wsim-bad: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--wsim-text);
    background: radial-gradient(circle at top left, #334155 0, var(--wsim-bg) 42%, #020617 100%);
}

a {
    color: inherit;
}

.wsim-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 12px 18px;
    background: rgba(2, 6, 23, 0.92);
    border-bottom: 1px solid var(--wsim-border);
    backdrop-filter: blur(10px);
}

.wsim-brand {
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.wsim-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.wsim-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    text-decoration: none;
    color: var(--wsim-muted);
    white-space: nowrap;
}

.wsim-nav-link:hover,
.wsim-nav-link.is-active {
    color: var(--wsim-text);
    border-color: var(--wsim-border);
    background: rgba(255, 255, 255, 0.08);
}

.wsim-userbox {
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
    color: var(--wsim-muted);
}

.wsim-userbox strong {
    color: var(--wsim-accent);
}

.wsim-main {
    width: min(1180px, calc(100% - 28px));
    margin: 28px auto;
}

.wsim-card,
.wsim-hero,
.wsim-grid-card {
    background: var(--wsim-panel);
    border: 1px solid var(--wsim-border);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.wsim-hero {
    padding: 34px;
}

.wsim-hero h1,
.wsim-card h1,
.wsim-card h2,
.wsim-grid-card h2 {
    margin-top: 0;
}

.wsim-card {
    padding: 22px;
    margin-bottom: 18px;
}

.wsim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.wsim-grid-card {
    padding: 18px;
    text-decoration: none;
    min-height: 150px;
}

.wsim-grid-card:hover {
    transform: translateY(-2px);
    border-color: rgba(245, 158, 11, 0.55);
}

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

.wsim-button,
button.wsim-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 12px;
    background: var(--wsim-accent);
    color: #111827;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.wsim-button.secondary {
    background: rgba(255, 255, 255, 0.12);
    color: var(--wsim-text);
}

.wsim-form {
    display: grid;
    gap: 14px;
    max-width: 460px;
}

.wsim-form label {
    display: grid;
    gap: 6px;
    color: var(--wsim-muted);
}

.wsim-form input,
.wsim-form select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--wsim-border);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.72);
    color: var(--wsim-text);
}

.wsim-flash {
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 14px;
    background: var(--wsim-panel-strong);
    border: 1px solid var(--wsim-border);
}

.wsim-flash-error {
    border-color: rgba(239, 68, 68, 0.55);
}

.wsim-flash-success {
    border-color: rgba(34, 197, 94, 0.55);
}

.wsim-footer {
    width: min(1180px, calc(100% - 28px));
    margin: 30px auto;
    color: var(--wsim-muted);
}

@media (max-width: 820px) {
    .wsim-topbar {
        grid-template-columns: 1fr;
    }

    .wsim-userbox {
        justify-content: space-between;
    }
}

.wsim-storage-summary .wsim-grid-card {
    min-height: 130px;
}

.wsim-big-number {
    display: block;
    margin: 6px 0;
    font-size: 2.2rem;
    color: var(--wsim-accent);
}

.wsim-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
}

.wsim-tab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--wsim-border);
    border-radius: 999px;
    color: var(--wsim-muted);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
}

.wsim-tab:hover,
.wsim-tab.is-active {
    color: var(--wsim-text);
    border-color: rgba(245, 158, 11, 0.65);
    background: rgba(245, 158, 11, 0.14);
}

.wsim-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.wsim-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

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

.wsim-table th {
    color: var(--wsim-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.wsim-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid var(--wsim-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--wsim-text);
    white-space: nowrap;
}

.wsim-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.wsim-inline-form select,
.wsim-small-input {
    min-height: 38px;
    padding: 8px 9px;
    border: 1px solid var(--wsim-border);
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.72);
    color: var(--wsim-text);
}

.wsim-small-input {
    width: 76px;
}

.wsim-price-input {
    width: 112px;
    min-height: 38px;
    padding: 8px 9px;
    border: 1px solid var(--wsim-border);
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.72);
    color: var(--wsim-text);
}

.wsim-table td strong + .wsim-muted {
    display: inline-block;
    margin-top: 2px;
}

.wsim-flash-info {
    border-color: rgba(125, 211, 252, 0.55);
}

.wsim-section-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.wsim-section-head h2,
.wsim-section-head p {
    margin-top: 0;
}

.wsim-job-list {
    display: grid;
    gap: 14px;
}

.wsim-job-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--wsim-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

.wsim-job-card h3 {
    margin: 0 0 6px;
}

.wsim-job-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.wsim-progress {
    width: 100%;
    height: 14px;
    margin: 10px 0 6px;
    overflow: hidden;
    border: 1px solid var(--wsim-border);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.65);
}

.wsim-progress-bar {
    height: 100%;
    min-width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    transition: width 0.25s ease;
}

.wsim-button:disabled,
button.wsim-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (max-width: 760px) {
    .wsim-section-head,
    .wsim-job-card {
        grid-template-columns: 1fr;
    }

    .wsim-job-actions {
        justify-content: flex-start;
    }
}

/* Patch 010 - WiSim-Markt */
.wsim-market-table {
    min-width: 1120px;
}

.wsim-market-table td {
    vertical-align: top;
}

.wsim-market-news-list {
    display: grid;
    gap: 10px;
}

.wsim-market-news-item {
    display: grid;
    gap: 3px;
    padding: 12px 14px;
    border: 1px solid var(--wsim-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
}

.wsim-market-news-good {
    border-color: rgba(34, 197, 94, 0.45);
}

.wsim-market-news-bad {
    border-color: rgba(239, 68, 68, 0.45);
}

.wsim-market-pagination {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

@media (max-width: 760px) {
    .wsim-market-pagination {
        justify-content: flex-start;
    }
}

/* Patch 011 - globale Materialanforderungen */
.wsim-material-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.wsim-material-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    font-size: 0.82rem;
    color: var(--wsim-text);
    white-space: nowrap;
}

.wsim-material-pill.is-missing {
    border-color: rgba(239, 68, 68, 0.65);
    background: rgba(127, 29, 29, 0.35);
}

.wsim-material-pill.is-reserved {
    border-color: rgba(59, 130, 246, 0.65);
    background: rgba(30, 64, 175, 0.30);
}

.wsim-material-pill.is-done {
    border-color: rgba(34, 197, 94, 0.65);
    background: rgba(20, 83, 45, 0.32);
}

/* Patch 012 - Farm und Industrieproduktion */
.wsim-production-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.wsim-production-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--wsim-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

.wsim-production-card h3,
.wsim-production-card p {
    margin-top: 0;
}

.wsim-production-action {
    margin-top: 6px;
}

.wsim-production-card .wsim-material-list,
.wsim-job-card .wsim-material-list {
    margin-top: 6px;
}

/* Patch 013 - Wirtschaftszentrale und Cronstatus */
.wsim-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.wsim-mini-list {
    display: grid;
    gap: 9px;
}

.wsim-mini-row {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 13px;
    background: rgba(15, 23, 42, 0.48);
}

.wsim-mini-row strong {
    color: var(--wsim-text);
}

.wsim-mini-row span,
.wsim-mini-row small {
    color: var(--wsim-muted);
}

.wsim-copy-input {
    width: 100%;
    min-height: 42px;
    margin: 8px 0 12px;
    padding: 9px 11px;
    border: 1px solid var(--wsim-border);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.75);
    color: var(--wsim-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.86rem;
}

/* Patch 138: Werkstatt-Arbeitsschritte */
.wsim-workshop-steps {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.wsim-workshop-step {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.52);
}

.wsim-workshop-step.is-active {
    border-color: rgba(56, 189, 248, 0.55);
    background: rgba(14, 116, 144, 0.16);
}

.wsim-workshop-step.is-done {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(22, 101, 52, 0.13);
}

.wsim-workshop-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.wsim-workshop-step .wsim-progress {
    margin-top: 10px;
}
