/* dNewsroom – Stylesheet */
:root {
    --bg: #ffffff; --bg-secondary: #f7f7f5; --bg-tertiary: #efefed;
    --border: #e0e0de; --text: #1a1a18; --text-secondary: #6b6b6b;
    --text-tertiary: #9b9b9b; --accent: #2563eb; --green: #16a34a; --red: #dc2626;
    --nav-bg: #1a1a18; --nav-text: #e8e8e6; --nav-hover: #2e2e2c;
    --nav-h: 48px; --radius: 6px; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
[data-theme="dark"] {
    --bg: #141414; --bg-secondary: #1c1c1c; --bg-tertiary: #242424;
    --border: #2a2a2a; --text: #e8e8e6; --text-secondary: #a0a0a0;
    --text-tertiary: #555; --accent: #60a5fa; --green: #22c55e; --red: #f87171;
    --nav-bg: #0a0a0a; --nav-text: #e8e8e6; --nav-hover: #1e1e1e;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select, button { font: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── Navigation ── */
nav { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 2px; height: var(--nav-h); padding: 0 16px; background: var(--nav-bg); color: var(--nav-text); flex-wrap: nowrap; overflow: visible; }
.nav-brand { font-weight: 700; font-size: 16px; color: var(--nav-text); margin-right: 8px; white-space: nowrap; text-decoration: none; }
.nav-brand span { color: var(--accent); }
.nav-item { padding: 6px 10px; border-radius: var(--radius); color: var(--nav-text); font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s; }
.nav-item:hover { background: var(--nav-hover); text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-spacer { flex: 1; }
.nav-user { font-size: 13px; color: var(--text-tertiary); padding: 0 8px; }
.theme-btn { background: none; border: 1px solid #444; border-radius: var(--radius); padding: 4px 8px; cursor: pointer; color: var(--nav-text); font-size: 14px; }

/* Nav Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-menu { display: none; position: absolute; top: var(--nav-h); left: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,.12); min-width: 180px; z-index: 200; }
.nav-dropdown-right .nav-dropdown-menu { left: auto; right: 0; }
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu-inner { padding: 4px; }
.nav-dropdown-item { display: block; padding: 7px 12px; border-radius: 4px; color: var(--text); font-size: 13px; text-decoration: none; }
.nav-dropdown-item:hover { background: var(--bg-secondary); text-decoration: none; }

/* ── Flash Messages ── */
.flash-messages { position: fixed; top: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 10px; width: 520px; max-width: calc(100vw - 32px); }
.flash { padding: 14px 18px; border-radius: var(--radius); font-size: 15px; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.12); animation: slideIn .2s ease; display: flex; align-items: center; gap: 12px; text-align: center; justify-content: center; }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; opacity: .6; flex-shrink: 0; }
.flash-close:hover { opacity: 1; }
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.flash-warning { background: #fef9c3; color: #713f12; border: 1px solid #fef08a; }
.flash-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }
@keyframes slideIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* ── Main Layout ── */
main { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.breadcrumb .crumb { color: var(--accent); }
.breadcrumb .sep { color: var(--text-tertiary); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--bg-secondary); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { background: #15803d; }
.btn-red, .btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-red:hover, .btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label, label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=file], textarea, select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); color: var(--text); font-size: 14px; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.select-inline { width: auto; padding: 6px 10px; }

/* ── Tables ── */
.tbl-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table th { background: var(--bg-secondary); padding: 9px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); }
table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--bg-secondary); }
.text-right { text-align: right; }

/* ── Cards ── */
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-title { font-weight: 600; margin-bottom: 8px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.b-green { background: #dcfce7; color: #14532d; }
.b-red { background: #fee2e2; color: #7f1d1d; }
.b-gray { background: var(--bg-tertiary); color: var(--text-secondary); }
.b-blue { background: #dbeafe; color: #1e3a8a; }
.b-yellow { background: #fef9c3; color: #713f12; }
.warn { color: #d97706; }

/* ── Filter Bar ── */
.filter-bar { margin-bottom: 16px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap input { padding-left: 30px; }
.search-icon { position: absolute; left: 8px; font-size: 13px; color: var(--text-tertiary); }

/* ── Grid & Flex Utilities ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-tertiary); margin-bottom: 6px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state p { margin-bottom: 12px; }
.empty { padding: 20px; text-align: center; color: var(--text-tertiary); }
.empty-icon { font-size: 32px; margin-bottom: 8px; }

/* ── Login ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-secondary); }
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-brand { text-align: center; font-size: 28px; font-weight: 800; margin-bottom: 24px; color: var(--text); }
.login-brand span { color: var(--accent); }
.login-form { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }

/* ── Show Detail ── */
.block-wrap { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.block-wrap.drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.block-head { background: var(--bg-secondary); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.block-body { padding: 0; }
.article-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.drag-handle { cursor: grab; color: var(--text-tertiary); font-size: 16px; }
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ── Script ── */
.script-area { font-family: monospace; font-size: 14px; line-height: 1.7; white-space: pre-wrap; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

/* ── Article Editor ── */
.editor-toolbar { display: flex; gap: 4px; margin-bottom: 4px; }
.tbtn { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); cursor: pointer; font-size: 13px; }
.tbtn:hover { background: var(--bg-secondary); }
.editor-body { min-height: 200px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; outline: none; background: var(--bg); line-height: 1.7; }
.editor-body:focus { border-color: var(--accent); }
.live-stats { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); margin-top: 6px; padding: 6px 0; border-top: 1px solid var(--border); }
.version-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 8px 14px; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-secondary); }
.tab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ── Plausibility ── */
.plaus-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif { padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 6px; }
.notif-ok { background: #dcfce7; color: #14532d; }
.notif-err { background: #fee2e2; color: #7f1d1d; }
.notif-info { background: #dbeafe; color: #1e3a8a; }

/* ── Modal ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 300; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg); border-radius: 10px; padding: 24px; min-width: 320px; max-width: 560px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,.16); }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Misc ── */
.qr-box { text-align: center; }
.link { color: var(--accent); }
.big-plus { font-size: 24px; color: var(--accent); text-decoration: none; }

/* ── Article Source Item Cards ── */
.si-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.si-card-header { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--bg-secondary); }
.si-card-summary { font-size: 12px; line-height: 1.5; padding: 8px 10px; color: var(--text); }

/* ── Dashboard ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-top: 8px;
}
.widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.widget-placeholder { opacity: 0.55; }
.widget-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.widget-title { font-weight: 600; font-size: 14px; }
.widget-sub { font-size: 11px; color: var(--text-tertiary); }
.widget-count { font-size: 36px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.widget-empty { font-size: 13px; color: var(--text-tertiary); padding: 12px 0; }
.widget-list { display: flex; flex-direction: column; gap: 6px; }
.widget-list-item { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.widget-list-meta { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.widget-list-more { font-size: 12px; margin-top: 4px; }
.widget-list-more a { color: var(--accent); }

/* Wetter */
.weather-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.weather-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.weather-city { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.weather-condition { font-size: 13px; margin-bottom: 4px; }
.weather-temp { font-size: 28px; font-weight: 700; }
.weather-details { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Aktien */
.stock-list { display: flex; flex-direction: column; gap: 6px; }
.stock-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; }
.stock-name { color: var(--text); }
.stock-price { font-variant-numeric: tabular-nums; }
.stock-change { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.stock-up { color: var(--green); }
.stock-down { color: var(--red); }

/* Energie & Rohstoffe */
.energy-section-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }

/* Kraftstoff */
.fuel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fuel-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; }
.fuel-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.fuel-price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Show Detail Layout ── */
.show-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.show-main { min-width: 0; }
.show-sidebar { position: sticky; top: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); overflow: hidden; }

/* Sidebar Tabs */
.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border); }
.sidebar-tab { flex: 1; padding: 10px 8px; font-size: 13px; font-weight: 500; background: none; border: none; cursor: pointer; color: var(--text-secondary); transition: color .15s, background .15s; }
.sidebar-tab:hover { background: var(--bg); color: var(--text); }
.sidebar-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -1px; background: var(--card-bg); }

/* Sidebar Content */
.sidebar-tab-content { padding: 12px; max-height: calc(100vh - 200px); overflow-y: auto; }
.sidebar-empty { font-size: 13px; color: var(--text-tertiary); padding: 12px 0; text-align: center; }
.sidebar-section-label { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 6px; }
.sidebar-list { display: flex; flex-direction: column; gap: 6px; }
.sidebar-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.sidebar-item--used { opacity: .5; }
.sidebar-item-name { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item-meta { font-size: 11px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
.sidebar-article-item { flex-wrap: wrap; }

/* Block collapsed state */
.block-collapsed .block-body { display: none; }
.block-collapsed .block-head span:last-child { transform: rotate(-90deg); display: inline-block; }

@media (max-width: 900px) {
    .show-layout { grid-template-columns: 1fr; }
    .show-sidebar { position: static; }
}

/* ── Import Log Widget ── */
.importlog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.importlog-session { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--bg); }
.importlog-session--latest { border-color: var(--accent); }
.importlog-session-header { font-weight: 600; font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.importlog-section-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 4px; }
.importlog-sources { display: flex; flex-direction: column; gap: 3px; }
.importlog-row { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 6px; font-size: 12px; padding: 3px 6px; border-radius: 4px; }
.importlog-row--error   { background: color-mix(in srgb, var(--red) 8%, transparent); }
.importlog-row--warning { background: color-mix(in srgb, var(--yellow, #f59e0b) 8%, transparent); }
.importlog-row--idle    { opacity: .6; }
.importlog-icon  { font-size: 11px; text-align: center; }
.importlog-name  { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.importlog-stats { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.importlog-errormsg { font-size: 11px; color: var(--red); padding: 2px 6px 2px 32px; word-break: break-all; }
.importlog-warning  { font-size: 11px; color: var(--orange, #f59e0b); padding: 2px 6px 2px 32px; }
.importlog-summary  { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }

/* ── Paginierung ── */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.pagination-btn { min-width: 36px; text-align: center; text-decoration: none; }
.pagination-btn-active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; cursor: default; }
.pagination-btn-disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.pagination-info { margin-left: 8px; font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    main { padding: 16px 12px; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
