/*
|--------------------------------------------------------------------------
| SONAVIS PORTAL V2 - MASTER STYLESHEET
|--------------------------------------------------------------------------
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* --- PREVENT HORIZONTAL SCROLL ---
   IMPORTANT: overflow-x: hidden on `html` causes left-side clipping of content
   in many browsers. Keep it only on body. */
html {
    scroll-behavior: smooth;
}

/* --- GLOBAL VARIABLES --- */
:root {
    --bg-body: #f4f6f8;
    --text-main: #1e2530;
    --bg-card: #ffffff;
    --border-color: #e2e6ea;
    --primary-color: #c0392b;
    --text-muted: #6c757d;
    --fill-red: #c0392b;
    --fill-yellow: #e67e22;
    --fill-green: #27ae60;
}

body.dark-mode {
    --bg-body: #111318;
    --text-main: #e0e0e0;
    --bg-card: #161b22;
    --border-color: #30363d;
    --text-muted: #8b95a1;
}

/* --- Base --- */
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    max-width: 100%;
    margin: 0 0 0 0;
    padding: 0;
    height: 100%;
    position: relative;
}

*, *::before, *::after { box-sizing: border-box; }

.container, .container-fluid {
    max-width: 100%;
    overflow-x: hidden;
}

main.page-content-full, main.page-content-wrapper {
    flex: 1;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-top: 1rem;
    padding-bottom: 80px;
    max-width: 100vw;
    overflow-x: hidden;
}

/* --- Typography --- */
p { margin: 0 0 10px; }

img { background-color: transparent; max-width: 100%; height: auto; }
.img-sonavis { box-shadow: 0px 0px 20px grey; margin: 20px 0; }
.img-fluid { width: 100%; max-width: 100%; height: auto; }

h5.a { color: #7f7f7f; font-weight: bold; margin-top: 0; font-size: 1.3em; }
h5.b { color: #c51625; font-weight: bold; font-size: 1.3em; margin-top: 0; }
h5.c { color: #7f7f7f; font-weight: bold; margin-top: 0; font-size: 1.0em; }

/* --- Info Box --- */
.info-box {
    border-radius: 10px;
    padding: 24px;
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
body.dark-mode .info-box { background-color: #161b22; color: #c9d1d9; border-color: #30363d; }
.info-box p { margin-bottom: 12px; }
.info-box a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.info-box a:hover { text-decoration: underline; }

/* --- Device comment card --- */
.device-comment-card {
    min-height: 20px;
    padding: 19px;
    margin-bottom: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.device-headline {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* --- Fill color helpers --- */
.fill-red    { color: var(--fill-red) !important; }
.fill-yellow { color: var(--fill-yellow) !important; }
.fill-green  { color: var(--fill-green) !important; }
.fill-red-bg    { background-color: var(--fill-red) !important; }
.fill-yellow-bg { background-color: var(--fill-yellow) !important; }
.fill-green-bg  { background-color: var(--fill-green) !important; }

/* ════════════════════════════════════════════════════
   LIST VIEW
   ════════════════════════════════════════════════════ */

.device-list-wrapper {
    margin: 0 16px;
}

/* Column header row */
.device-list-header {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1.4fr 2fr 1.6fr;
    gap:  20px;
    padding: 0 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
}

/* Device row */
.device-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1.4fr 2fr 1.6fr;
    gap: 20px;
    align-items: start;
    padding: 14px 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: grab;
    transition: border-left-color 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.device-row:hover {
    border-left-color: var(--primary-color);
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    transform: translateX(2px);
}

.device-row:active { cursor: grabbing; }

.device-row.dragging {
    opacity: 0.5;
    transform: scale(0.99);
}

body.dark-mode .device-row {
    background-color: #161b22;
    border-color: #30363d;
    border-left-color: transparent;
}

body.dark-mode .device-row:hover {
    border-left-color: var(--primary-color);
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}

/* Location column */
.dr-location {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dr-location > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dr-location > div:last-child {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-top: 6px;
}

.dr-standort {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dr-location .btn-dr {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
}

.dr-location-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.3;
}

.dr-shid {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Shared label/value pattern */
.dr-label {
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.dr-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
}

.dr-time {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Fill column */
.dr-fill {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dr-fill-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.dr-fill-pct {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.dr-fill-tons {
    font-size: 13.5px;
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
}

.dr-fill-bar-track {
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
    max-width: 140px;
}

.dr-fill-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Notes column */
.dr-notes {
    display: flex;
    flex-direction: column;
}

.dr-notes-text {
    font-size: 12.5px;
    color: var(--text-muted);
    max-height: 48px;
    overflow-y: auto;
    display: block;
    line-height: 1.5;
    padding-right: 2px;
}

.dr-notes-text::-webkit-scrollbar { width: 3px; }
.dr-notes-text::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* Actions column - moved into dr-location */
.dr-actions {
    display: none;
}

.btn-dr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    background: var(--primary-color);
    color: #fff;
    white-space: nowrap;
}

.btn-dr:hover { opacity: 0.85; color: #fff; text-decoration: none; }
.btn-dr:active { transform: scale(0.97); }

.btn-dr-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-dr-secondary:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

body.dark-mode .btn-dr-secondary {
    border-color: #30363d;
    color: #8b95a1;
}

body.dark-mode .btn-dr-secondary:hover {
    background: #0d1117;
    color: #e0e0e0;
}

/* Short/full text toggle */
.details-button-full-text  { display: inline; }
.details-button-short-text { display: none; }

@media (max-width: 900px) {
    .device-list-header { display: none; }
    .device-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .dr-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 576px) {
    .device-row { grid-template-columns: 1fr; }
    .details-button-full-text  { display: none; }
    .details-button-short-text { display: inline; }
}

/* ════════════════════════════════════════════════════
   KACHEL VIEW
   ════════════════════════════════════════════════════ */

.kachel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    padding: 0 16px 24px;
}

.kachel-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.2s;
    backface-visibility: hidden;
    overflow: hidden;
}

.kachel-box:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.kachel-box:active { cursor: grabbing; }

body.dark-mode .kachel-box {
    background-color: #161b22;
    border-color: #30363d;
}

/* Kachel header */
.kachel-header {
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .kachel-header { border-color: #30363d; }

.device-box-title {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.device-box-title:hover { color: var(--primary-color); text-decoration: none; }

/* Kachel body */
.kachel-body {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 14px 12px 10px;
    gap: 12px;
}

.kachel-bar-area {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

/* Progress bar container */
[id^="myProgress-"] {
    background-color: var(--border-color);
    height: 110px;
    width: 36px;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.bars {
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: height 0.6s cubic-bezier(0.4,0,0.2,1);
    min-height: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
}

.bar-percentage-text {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: 9px;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    writing-mode: vertical-rl;
    transform: rotate(180deg) translateY(50%);
    white-space: nowrap;
}

/* Kachel stats */
.kachel-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.kachel-pct {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.kachel-tons {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kachel-time {
    font-size: 11px;
    color: var(--text-main);
    margin-top: 4px;
    font-weight: 500;
}

/* Kachel footer */
.kachel-footer {
    display: flex;
    gap: 6px;
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border-color);
}

body.dark-mode .kachel-footer { border-color: #30363d; }

.btn-kachel {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    border-radius: 5px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    background: var(--primary-color);
    color: #fff;
    white-space: nowrap;
}

.btn-kachel:hover { opacity: 0.85; color: #fff; text-decoration: none; }

.btn-kachel-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color) !important;
}

.btn-kachel-secondary:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

body.dark-mode .btn-kachel-secondary { border-color: #30363d !important; color: #8b95a1; }
body.dark-mode .btn-kachel-secondary:hover { background: #0d1117; color: #e0e0e0; }

@media (max-width: 600px) {
    .kachel-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 10px 16px; }
}

/* ════════════════════════════════════════════════════
   MODERN CONTROL BAR
   ════════════════════════════════════════════════════ */

.modern-control-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 20px;
    margin: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    flex-wrap: wrap;
    gap: 10px;
}

body.dark-mode .modern-control-bar { background-color: #161b22; border-color: #30363d; }

.control-group-left, .control-group-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group-left .btn-group {
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.control-group-left .btn-group .btn {
    border-radius: 0;
    border: none;
    padding: 6px 16px;
    font-weight: 500;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.15s;
}

.control-group-left .btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.control-group-left .btn-group .btn:last-child  { border-radius: 0 6px 6px 0; }

.control-group-left .btn-secondary.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.control-group-left .btn-outline-secondary {
    background-color: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.control-group-left .btn-outline-secondary:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

.control-group-left .dropdown { display: inline-block; position: relative; }

.control-group-left .dropdown .btn {
    min-width: 160px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 7px;
    font-family: 'DM Sans', sans-serif;
}

.control-group-left .dropdown-menu { text-align: center; width: 100%; }

#custom-views-list {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    padding: 0;
}

#custom-views-list .dropdown-item {
    display: block !important;
    width: 100%;
    clear: both;
    text-align: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.control-group-right {
    flex-wrap: nowrap;
}

.control-group-right select,
.control-group-right .form-control {
    min-width: 180px;
    padding: 6px 10px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    height: 34px;
    box-sizing: border-box;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    background-color: var(--bg-card);
    color: var(--text-main);
    box-shadow: none;
}

.control-group-right select { width: 180px; max-width: 180px; }

.control-group-right select:focus,
.control-group-right .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(192,57,43,0.12);
    outline: none;
}

.control-group-right .input-group {
    width: 300px;
    border-radius: 7px;
    overflow: hidden;
    display: flex !important;
    flex-wrap: nowrap !important;
    height: 34px;
    border: 1px solid var(--border-color);
}

.control-group-right .input-group .form-control {
    border: none;
    flex: 1 1 auto;
    height: 100%;
    box-shadow: none;
}

.control-group-right .input-group .btn {
    border: none;
    border-left: 1px solid var(--border-color);
    background-color: var(--bg-card);
    padding: 0 12px;
    display: flex;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    transition: background 0.15s;
}

.control-group-right .input-group .btn:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

@media (max-width: 992px) {
    .modern-control-bar { flex-direction: column; align-items: stretch; margin: 12px 8px; }
    .control-group-left, .control-group-right { width: 100%; justify-content: center; }
    .control-group-right { flex-wrap: wrap; }
    .control-group-right select, .control-group-right .input-group { width: 100%; }
}

@media (max-width: 576px) {
    .modern-control-bar { padding: 10px 12px; margin: 8px 6px; }
}

/* ════════════════════════════════════════════════════
   DRAG & DROP EDITOR
   ════════════════════════════════════════════════════ */

.remove-item-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    padding: 0 6px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.15s;
}

.remove-item-btn:hover { color: #922b21; }

#customViewDropZone {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: none;
    z-index: 1100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

#customViewDropZone h5 {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

#customViewDropZone .mt-3.d-flex {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

#customViewDropZone .btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    min-width: 100px;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
}

#customViewDropZone .btn-success {
    background: #27ae60;
    color: white;
}

#customViewDropZone .btn-danger {
    background: #c0392b;
    color: white;
}

#customViewDropZone .btn-info {
    background: #3498db;
    color: white;
}

#customViewDropZone .btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

#customViewDropZone .ms-auto {
    margin-left: auto;
}

#customViewDropZone.drag-over {
    background-color: rgba(192,57,43,0.04);
    border: 1px solid var(--primary-color);
}

body.dark-mode #customViewDropZone {
    background-color: #161b22;
    border-color: #30363d;
}

#viewNameInput, #existingViewSelector {
    border-radius: 7px;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    background-color: var(--bg-card);
    color: var(--text-main);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    width: 100%;
}

body.dark-mode #viewNameInput,
body.dark-mode #existingViewSelector { background-color: #0d1117; color: #c9d1d9; border-color: #30363d; }

#customViewList {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    max-height: 280px;
    overflow-y: auto;
}

#customViewList::-webkit-scrollbar { width: 4px; }
#customViewList::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 2px; }

#customViewList li {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#customViewList li span { font-size: 13px; color: var(--text-main); }

body.dark-mode #customViewList li { background-color: #0d1117; border-color: #30363d; }

#dropZoneHelp {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 18px;
    border: 1px dashed var(--border-color);
    border-radius: 7px;
    margin: 10px 0;
    background: var(--bg-body);
    font-size: 12.5px;
}

body.dark-mode #dropZoneHelp { background: #0d1117; border-color: #30363d; }

@media (max-width: 576px) {
    #customViewDropZone { right: 10px; width: calc(100vw - 20px); }
}

/* ════════════════════════════════════════════════════
   DARK MODE - FORMS & COMPONENTS
   ════════════════════════════════════════════════════ */

body.dark-mode .form-control,
body.dark-mode select,
body.dark-mode .form-select,
body.dark-mode .custom-select,
body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-primary  { background-color: #0d1117; border-color: #30363d; color: #c9d1d9; }
body.dark-mode .form-control:focus   { background-color: #0d1117; border-color: #58a6ff; color: #c9d1d9; }
body.dark-mode .dropdown-menu        { background-color: #161b22; border-color: #30363d; }
body.dark-mode .dropdown-item        { color: #c9d1d9; }
body.dark-mode .dropdown-item:hover  { background-color: #21262d; color: #fff; }

/* ════════════════════════════════════════════════════
   DEVICE DETAILS PAGE
   ════════════════════════════════════════════════════ */

.dd-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 16px 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dd-top {
    display: grid;
    grid-template-columns: 2fr 1fr;
    align-items: start;
    gap: 16px;
}
.dd-chart-card, .dd-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}
/* Chart card */
.dd-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dd-chart-title {
    padding: 16px 20px 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dd-chart-canvas-wrap {
    padding: 12px 16px 0;
    position: relative;
    height: 320px;
}

.dd-chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Range buttons */
.dd-range-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.dd-range-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-right: 4px;
    white-space: nowrap;
}

.details-range-btn {
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 500;
    font-family: 'DM Sans', -apple-system, sans-serif;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.details-range-btn:hover {
    border-color: #c0392b;
    color: #c0392b;
    background: rgba(192,57,43,0.05);
}

.details-range-btn.active-range {
    background: #c0392b !important;
    color: #fff !important;
    border-color: #c0392b !important;
}

.dd-forecast-btn { margin-left: auto; }

/* Instrument panel */
.dd-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.dd-panel-header {
    background: #0f1117;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dd-panel-sn {
    font-size: 13px;
    font-weight: 600;
    color: #8b95a1;
    letter-spacing: 0.04em;
}

.dd-panel-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(39,174,96,0.15);
    color: #27ae60;
    border: 1px solid rgba(39,174,96,0.25);
}

.dd-panel-fill {
    padding: 20px 18px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
}

.dd-fill-bar-wrap {
    flex-shrink: 0;
    position: relative;
    width: 44px;
    height: 110px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.dd-fill-bar-wrap #myBar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transition: height 0.8s cubic-bezier(0.4,0,0.2,1);
}

.dd-fill-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dd-fill-pct {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
}

.dd-fill-tons {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.dd-fill-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.dd-meta {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.dd-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.dd-meta-key {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.dd-meta-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.dd-meta-divider {
    height: 1px;
    background: var(--border-color);
    margin: 2px 0;
}

.dd-panel-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 18px;
}

.dd-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    text-decoration: none;
    transition: all 0.15s;
}

.dd-settings-btn:hover {
    border-color: #c0392b;
    color: #c0392b;
    background: rgba(192,57,43,0.04);
    text-decoration: none;
}

/* Notes */
.dd-notes-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: stretch;
    margin-top: 0;
}

.dd-notes-label {
    padding: 0 20px;
    background: var(--bg-body);
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 120px;
}

.dd-notes-label span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.dd-notes-card textarea {
    flex: 1;
    border: none;
    padding: 14px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    color: var(--text-main);
    background: var(--bg-card);
    resize: none;
    min-height: 80px;
    line-height: 1.6;
    outline: none;
}

body.dark-mode .dd-notes-card textarea { background: #161b22; color: #c9d1d9; }

.dd-notes-save {
    padding: 0 20px;
    border-left: 1px solid var(--border-color);
    background: var(--bg-body);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.dd-save-btn {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.dd-save-btn:hover { opacity: 0.85; }

/* Dark mode */
body.dark-mode .dd-chart-card,
body.dark-mode .dd-panel,
body.dark-mode .dd-notes-card      { background: #161b22; border-color: #30363d; }
body.dark-mode .dd-panel-fill,
body.dark-mode .dd-range-bar,
body.dark-mode .dd-meta-divider    { border-color: #30363d; }
body.dark-mode .dd-notes-label,
body.dark-mode .dd-notes-save      { background: #0d1117; border-color: #30363d; }
body.dark-mode .details-range-btn  { background: #161b22; border-color: #30363d; color: #8b95a1; }
body.dark-mode .dd-fill-bar-wrap   { background: #2d3340; border-color: #30363d; }
body.dark-mode .dd-settings-btn    { border-color: #30363d; }

/* Responsive */
@media (max-width: 900px) {
    .dd-top { grid-template-columns: 1fr; }
    .dd-panel { display: grid; grid-template-columns: 1fr 1fr; }
    .dd-panel-header,
    .dd-panel-footer { grid-column: 1 / -1; }
    .dd-chart-canvas-wrap { height: 260px; }
}

@media (max-width: 600px) {
    .dd-page { padding: 12px 10px 24px; }
    .dd-panel { display: flex; flex-direction: column; }
    .dd-chart-canvas-wrap { height: 220px; }
    .dd-notes-card { flex-direction: column; }
    .dd-notes-label { padding: 12px 16px; min-width: unset; border-right: none; border-bottom: 1px solid var(--border-color); }
    .dd-notes-save { padding: 12px 16px; border-left: none; border-top: 1px solid var(--border-color); }
    .dd-save-btn { width: 100%; }
    .dd-fill-pct { font-size: 32px; }
}
/* ════════════════════════════════════════════════════
   SETTINGS / SHARE / PROFILE  (ds-* and ep-*)
   ════════════════════════════════════════════════════ */

.ds-page,
.ep-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ds-header, .ep-header { padding-bottom: 4px; }

.ds-title, .ep-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px;
}

.ep-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.ds-card, .ep-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

body.dark-mode .ds-card,
body.dark-mode .ep-card { background: #161b22; border-color: #30363d; }

.ds-card-label, .ep-card-label {
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .ds-card-label,
body.dark-mode .ep-card-label { background: #0d1117; border-color: #30363d; }

.ds-card-body, .ep-card-body { padding: 20px 24px; }

.ds-card-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 24px;
    text-align: center;
}

.ds-empty-text { font-size: 14px; color: var(--text-muted); }

.ds-share-regen { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.ds-actions, .ep-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Shared button base */
.ds-btn-primary,
.ds-btn-secondary,
.ds-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
}

.ds-btn-primary  { background: #c0392b; color: #fff; }
.ds-btn-secondary { background: transparent; color: var(--text-muted); border: 1px solid var(--border-color); }
.ds-btn-danger   { background: transparent; color: #c0392b; border: 1px solid rgba(192,57,43,0.3); }

.ds-btn-primary:hover   { opacity: 0.85; color: #fff; text-decoration: none; }
.ds-btn-secondary:hover { background: var(--bg-body); color: var(--text-main); text-decoration: none; }
.ds-btn-danger:hover    { background: rgba(192,57,43,0.06); color: #c0392b; text-decoration: none; }

.ds-btn-primary:active,
.ds-btn-secondary:active,
.ds-btn-danger:active   { transform: scale(0.97); }

body.dark-mode .ds-btn-secondary { border-color: #30363d; }
body.dark-mode .ds-btn-danger    { border-color: rgba(192,57,43,0.4); }

/* Modal */
.ds-modal { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
body.dark-mode .ds-modal { background: #161b22; border-color: #30363d; }

.ds-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}
body.dark-mode .ds-modal-header { border-color: #30363d; }

.ds-modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 0; }
.ds-modal-close:hover { color: var(--text-main); }

.ds-modal-body { padding: 20px; font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }

.ds-modal-footer {
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border-color);
}
body.dark-mode .ds-modal-footer { border-color: #30363d; }

@media (max-width: 600px) {
    .ds-page, .ep-page { padding: 12px 10px 32px; }
    .ds-card-body, .ep-card-body { padding: 16px; }
    .ds-actions, .ep-actions { flex-direction: column; align-items: stretch; }
    .ds-btn-primary, .ds-btn-secondary, .ds-btn-danger { width: 100%; justify-content: center; }
}
/* --- Footer --- */
.snv-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #0f1117;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.snv-footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.snv-footer-links a {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
    text-decoration: none;
    transition: color 0.15s;
}

.snv-footer-links a:hover { color: #c0392b; }
.snv-footer-dot { color: #2d3340; font-size: 12px; }

main.page-content-full,
main.page-content-wrapper {
    padding-bottom: 60px;
}

/* --- Home page --- */
.snv-hero {
    display: flex;
    align-items: center;
    gap: 48px;
    padding: 56px 48px 40px;
}

.snv-hero-text { flex: 1; max-width: 520px; }

.snv-hero-eyebrow {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 14px;
}

.snv-hero-title {
    font-size: clamp(26px, 3.5vw, 40px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin: 0 0 16px;
}

.snv-hero-brand { color: var(--primary-color); }

.snv-hero-sub {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text-muted);
    margin: 0 0 28px;
    max-width: 440px;
}

.snv-hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.snv-home-btn-primary {
    background: var(--primary-color);
    color: #fff;
    padding: 10px 26px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.15s;
    display: inline-block;
}

.snv-home-btn-primary:hover {
    opacity: 0.88;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.snv-home-btn-ghost {
    color: var(--primary-color);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
    padding: 4px 0;
}

.snv-home-btn-ghost:hover {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
}

.snv-hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.snv-image-frame {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    max-width: 400px;
    width: 100%;
}

.snv-sensor-img { width: 100%; height: auto; display: block; border-radius: 8px; }

.snv-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 0 48px 40px;
    margin-bottom: 0;
}

.snv-feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 22px 18px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.snv-feature-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    transform: translateY(-2px);
}

.snv-feature-icon { font-size: 22px; margin-bottom: 10px; }

.snv-feature-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.snv-feature-desc { font-size: 12px; line-height: 1.55; color: var(--text-muted); }

.snv-info-strip {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 14px 48px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: center;
}

.snv-info-strip a { color: var(--primary-color); text-decoration: none; }
.snv-info-strip a:hover { text-decoration: underline; }

/* --- Login page --- */
.snv-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 16px;
}

.snv-login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.snv-login-header { text-align: center; margin-bottom: 24px; }
.snv-login-icon { font-size: 26px; margin-bottom: 10px; }

.snv-login-title {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin: 0 0 8px;
}

.snv-login-sub { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }

.snv-login-error {
    background: rgba(192,57,43,0.07);
    border: 1px solid rgba(192,57,43,0.2);
    border-left: 3px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 18px;
}

.snv-login-btn {
    width: 100%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: opacity 0.15s;
    margin-top: 8px;
}

.snv-login-btn:hover { opacity: 0.88; }

.snv-login-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.snv-login-footer a { color: var(--primary-color); text-decoration: none; }
.snv-login-footer a:hover { text-decoration: underline; }
.snv-login-sep { margin: 0 8px; color: var(--border-color); }

/* --- Responsive --- */
@media (max-width: 900px) {
    .snv-hero { flex-direction: column; padding: 36px 20px 28px; gap: 28px; }
    .snv-hero-image { width: 100%; }
    .snv-features { grid-template-columns: repeat(2, 1fr); padding: 0 20px 28px; }
    .snv-info-strip { padding: 14px 20px; }
}

@media (max-width: 540px) {
    .snv-features { grid-template-columns: 1fr; }
    .snv-login-card { padding: 28px 20px; }
}

.dlh-location-anlage, .dlh-location-standort,
.dr-location-anlage, .dr-location-standort {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dlh-location-anlage,
.dlh-location-standort {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dr-location-anlage .dr-label,
.dr-location-standort .dr-label {
    font-size: 10px;
    margin-bottom: 2px;
}