:root {
    --ink: #14202b;
    --muted: #66717d;
    --line: #dfe5ea;
    --surface: #ffffff;
    --canvas: #f3f6f8;
    --nav: #111c26;
    --nav-soft: #1c2a36;
    --accent: #e94f37;
    --accent-dark: #ca3825;
    --success: #178b60;
    --warning: #ad6b00;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(24, 38, 49, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
a { color: #1f5f88; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; line-height: 1.03; }
h2 { margin-bottom: .25rem; font-size: 1.2rem; letter-spacing: -.015em; }
p { color: var(--muted); line-height: 1.65; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .82rem; }
.block { display: block; margin-top: .25rem; color: var(--muted); }
.right { text-align: right; }
.eyebrow { display: block; margin-bottom: .4rem; color: var(--accent); font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 1.0rem 1.1rem; background: var(--nav); color: #fff; }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; }
.brand:hover { color: inherit; }
.brand img { width: 56px; height: 56px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; line-height: 0.8; }
.brand strong { font-size: 1.25rem; letter-spacing: .14em; }
.brand small { margin-top: .35rem; color: #a9bac7; font-size: .69rem; letter-spacing: .17em; text-transform: uppercase; }
.nav { display: grid; gap: .35rem; margin-top: 2.6rem; }
.nav a { padding: .8rem .9rem; border-radius: 10px; color: #bfccd5; font-weight: 650; }
.nav a:hover, .nav a.active { background: var(--nav-soft); color: #fff; }
.nav a.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-note { margin-top: auto; padding: 1rem; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.04); }
.sidebar-note p { margin: 0; color: #aebcc6; font-size: .82rem; line-height: 1.45; }

.main-content { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 1rem 2.4rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.topbar strong { display: block; font-size: .98rem; }
.topbar .eyebrow { margin-bottom: .2rem; font-size: .62rem; }
.user-menu { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .9rem; }
.user-menu form { margin: 0; }
.page { max-width: 1480px; min-height: calc(100vh - 130px); margin: 0 auto; padding: 2.25rem 2.4rem 3.5rem; }
.footer { padding: 1rem 2.4rem 1.5rem; color: #8a949d; font-size: .75rem; text-align: right; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin-bottom: 1.8rem; }
.page-heading p { margin-bottom: 0; }
.breadcrumbs { display: flex; gap: .5rem; margin-bottom: 1.2rem; color: var(--muted); font-size: .82rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-card { position: relative; overflow: hidden; padding: 1.25rem 1.35rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgba(24,38,49,.04); }
.metric-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: #8da0ad; content: ""; }
.metric-card.success-line::before { background: var(--success); }
.metric-card.warning-line::before { background: #e0a526; }
.metric-card.danger-line::before { background: var(--danger); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-size: .8rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { display: block; margin: .55rem 0 .35rem; font-size: 2rem; }
.metric-card small { font-size: .78rem; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 1rem; margin-bottom: 1rem; }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { margin-bottom: 1rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgba(24,38,49,.035); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.card-header h2 { margin: 0; }
.card-header .eyebrow { margin-bottom: .25rem; }
.empty-state { padding: 2.2rem 1rem; border: 1px dashed #cbd5dc; border-radius: 12px; text-align: center; }
.empty-state p { margin: .4rem 0 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .82rem .75rem; border-bottom: 1px solid #e7ecef; text-align: left; vertical-align: middle; }
th { color: #75818a; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }

.badge { display: inline-flex; align-items: center; padding: .35rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.badge.success { background: #e6f5ef; color: #08724b; }
.badge.warning { background: #fff3d6; color: #8a5700; }
.badge.danger { background: #fdeceb; color: #a42017; }
.badge.muted { background: #edf1f3; color: #5a6770; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 9px; font-weight: 750; transition: .15s ease; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }
.button.secondary { border-color: #cbd5dc; background: #fff; color: var(--ink); }
.button.secondary:hover { border-color: #9dacb6; color: var(--ink); }
.button.small { min-height: 34px; padding: .45rem .7rem; font-size: .78rem; }
.button.full { width: 100%; }
.danger-button { border-color: #f0b7b2; background: #fff4f3; color: var(--danger); }
.link-button { padding: 0; border: 0; background: transparent; color: #1f5f88; }
.link-button:hover { color: var(--accent); }
.danger-text { color: var(--danger); }

.alert { margin-bottom: 1rem; padding: .8rem 1rem; border: 1px solid #c9d7e0; border-radius: 10px; background: #eff6fa; color: #295774; line-height: 1.45; }
.alert.success { border-color: #a9dcc8; background: #eaf8f2; color: #116947; }
.alert.danger { border-color: #efb4ae; background: #fff0ef; color: #96251d; }
.alert.warning { border-color: #efd293; background: #fff8e9; color: #77500a; }

.activity-list { display: grid; gap: 0; margin: 0; padding: 0; font-size:0.85rem; list-style: none; }
.activity-list li { display: grid; grid-template-columns: 10px 1fr; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #edf1f3; }
.activity-list li:last-child { border-bottom: 0; }
.activity-list small { display: block; margin-top: .2rem; color: var(--muted); }
.activity-dot { width: 8px; height: 8px; margin-top: .35rem; border-radius: 50%; background: #8da0ad; }
.activity-dot.success { background: var(--success); }
.activity-dot.denied, .activity-dot.error { background: var(--danger); }

.roadmap-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 1rem; padding: 1.2rem; border-radius: 14px; background: var(--nav); color: #fff; }
.roadmap-strip > div { position: relative; display: grid; grid-template-columns: 34px 1fr; column-gap: .65rem; padding: .35rem .75rem; }
.roadmap-strip > div:not(:last-child) { border-right: 1px solid rgba(255,255,255,.12); }
.roadmap-strip .step { grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #334451; color: #aebcc6; font-weight: 800; }
.roadmap-strip .step.active { background: var(--accent); color: #fff; }
.roadmap-strip strong { font-size: .83rem; }
.roadmap-strip small { color: #91a3af; }

.form-card { scroll-margin-top: 2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
label { display: block; margin-bottom: .4rem; color: #3e4c57; font-size: .8rem; font-weight: 750; }
input, select { width: 100%; min-height: 44px; padding: .7rem .8rem; border: 1px solid #cbd5dc; border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 3px solid rgba(233,79,55,.14); border-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.inline-form { display: grid; grid-template-columns: minmax(150px, 1fr) auto; align-items: end; gap: .8rem; }
.inline-form label { grid-column: 1 / -1; margin-bottom: -.35rem; }
.state-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.state-actions form { margin: 0; }

.details-list { margin: 0; }
.details-list > div { display: grid; grid-template-columns: minmax(140px, .8fr) 1.2fr; gap: 1rem; padding: .68rem 0; border-bottom: 1px solid #edf1f3; }
.details-list > div:last-child { border-bottom: 0; }
.details-list dt { color: var(--muted); font-size: .8rem; }
.details-list dd { margin: 0; font-weight: 650; }
.info-box { margin-top: 1rem; padding: .9rem 1rem; border-left: 3px solid #7e919e; background: #f5f8fa; }
.info-box p { margin: .3rem 0 0; font-size: .85rem; line-height: 1.5; }
.activation-reveal { margin-bottom: 1rem; padding: 1.4rem; border: 1px solid #efb56f; border-radius: 14px; background: linear-gradient(135deg, #fff8eb, #fff); box-shadow: var(--shadow); }
.activation-reveal code { display: block; overflow-wrap: anywhere; padding: 1rem; border: 1px dashed #d99a50; border-radius: 8px; background: #fff; color: #6b3e08; font-size: 1rem; letter-spacing: .04em; }

.login-body { background: var(--nav); }
.login-shell { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr); min-height: 100vh; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 6vw, 6rem); }
.intro-panel { position: relative; overflow: hidden; color: #fff; background: radial-gradient(circle at 15% 15%, #2f4657, var(--nav) 55%); }
.intro-panel::after { position: absolute; right: -20%; bottom: -28%; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.015); content: ""; }
.intro-panel .brand { position: absolute; top: 2.5rem; left: clamp(2rem, 6vw, 6rem); z-index: 1; }
.brand.large img { width: 52px; height: 52px; }
.brand.large strong { font-size: 1.65rem; }
.intro-panel h1 { position: relative; z-index: 1; max-width: 650px; margin: 0 0 1.2rem; font-size: clamp(2.7rem, 5vw, 5.5rem); }
.intro-panel p { position: relative; z-index: 1; max-width: 580px; color: #b9c7d0; font-size: 1.05rem; }
.login-url { position: relative; z-index: 1; margin-top: 2rem; color: #f29b8c; font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.form-panel { background: var(--canvas); }
.login-card { width: min(100%, 470px); margin: 0 auto; padding: 2.2rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 .35rem; font-size: 2rem; }
.login-card label { margin-top: 1rem; }
.login-card .button { margin-top: 1.35rem; }
.security-note { margin: 1.1rem 0 0; color: #84909a; font-size: .76rem; text-align: center; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .intro-panel { min-height: 42vh; }
    .intro-panel .brand { position: static; margin-bottom: 3rem; }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 1rem; }
    .sidebar-note { display: none; }
    .nav { grid-template-columns: repeat(2, 1fr); margin-top: 1rem; }
    .topbar { align-items: flex-start; padding: 1rem; }
    .user-menu { align-items: flex-end; flex-direction: column; gap: .35rem; }
    .page { padding: 1.4rem 1rem 2.5rem; }
    .page-heading { flex-direction: column; }
    .metric-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .roadmap-strip { grid-template-columns: 1fr 1fr; }
    .roadmap-strip > div { border-right: 0 !important; }
    .login-panel { padding: 2rem 1.2rem; }
    .intro-panel { min-height: 50vh; }
    .login-card { padding: 1.5rem; }
    .inline-form { grid-template-columns: 1fr; }
    .details-list > div { grid-template-columns: 1fr; gap: .2rem; }
}


/* Sprint 2: Sortiment, Feed-/API-Verwaltung */
.metric-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compact-card { padding-bottom: 1rem; }
.filter-form, .token-form { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(260px, 1.2fr) auto; gap: 1rem; align-items: end; }
.filter-submit { display: flex; align-items: end; }
.table-subline { display: block; margin-top: .25rem; color: var(--muted); font-size: .72rem; font-weight: 500; }
.muted-text { color: var(--muted); font-size: .78rem; }
.warning-text { color: #8a5700; }
.row-details { position: relative; }
.row-details summary { cursor: pointer; color: #1f5f88; font-size: .78rem; font-weight: 700; }
.row-edit-form { position: absolute; z-index: 5; right: 0; width: 320px; margin-top: .5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); text-align: left; }
.row-edit-form label { margin-bottom: .75rem; }
.endpoint-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.endpoint-grid > div { min-width: 0; padding: .8rem .9rem; border: 1px solid #e2e8ec; border-radius: 10px; background: #f9fbfc; }
.endpoint-grid strong { display: block; margin-bottom: .35rem; font-size: .78rem; }
.endpoint-grid code { display: block; overflow-wrap: anywhere; color: #3b5464; font-size: .72rem; }
.token-form { margin-top: 1rem; grid-template-columns: minmax(220px, 1fr) minmax(190px, .7fr) auto; }
.compact-empty { margin-top: 1rem; padding: 1.2rem; }

@media (max-width: 900px) {
    .metric-grid-three, .endpoint-grid { grid-template-columns: 1fr; }
    .filter-form, .token-form { grid-template-columns: 1fr; }
    .row-edit-form { position: static; width: min(100%, 320px); }
}
