/* ---------- Dashboard ---------- */
.dm-segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); }
.dm-segmented a { padding: 5px 12px; font-weight: 600; font-size: 12.5px; border-radius: 7px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; transition: all .15s var(--ease); }
.dm-segmented a:hover { color: var(--text); background: var(--bg-hover); }
.dm-segmented a.active { background: var(--text); color: #fff; box-shadow: 0 2px 6px rgba(15,23,42,.25); }

.dm-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.dm-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.dm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dm-chart {
    display: flex; align-items: stretch; gap: 3px; height: 210px; padding-bottom: 24px; margin-top: 8px;
    border-bottom: 1px solid var(--border);
    background-image: repeating-linear-gradient(to top, transparent 0, transparent 45px, var(--border) 45px, var(--border) 46px);
    background-size: 100% calc(100% - 24px); background-repeat: no-repeat;
}
.dm-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.dm-bar-stack { display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 0; transition: filter .15s, transform .15s var(--ease); transform-origin: bottom; }
.dm-bar:hover .dm-bar-stack { filter: brightness(1.08); transform: scaleY(1.02); }
.dm-bar-stack span { display: block; min-height: 0; }
.dm-bar-label { position: absolute; bottom: -22px; left: 0; font-size: 10px; color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dm-bg-ok { background: linear-gradient(180deg, #34d399, #10b981); }
.dm-bg-warn { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.dm-bg-info { background: linear-gradient(180deg, #818cf8, #4f46e5); }
.dm-bg-danger { background: linear-gradient(180deg, #f87171, #ef4444); }
.dm-legend .dm-dot { box-shadow: none; }

.dm-todo { list-style: none; padding: 4px 0 8px; }
.dm-todo li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); transition: background .12s; }
.dm-todo li:hover { background: var(--bg-hover); }
.dm-todo li > div { flex: 1; min-width: 0; }
.dm-todo .dm-dot { margin-top: 7px; flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.dm-todo .dm-dot.dm-status-failed { color: var(--danger); }
.dm-todo .dm-dot.dm-status-needs_review, .dm-todo .dm-dot.dm-status-flagged, .dm-todo .dm-dot.dm-status-missing_image { color: var(--warn); }
.dm-card-head .dm-pill-count { background: var(--primary-soft); color: var(--primary); }

/* ---------- Expandable rows ---------- */
.dm-expandable { cursor: pointer; }
.dm-expandable:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: -2px; }
.dm-expandable td { vertical-align: middle; }
.dm-caret { width: 44px; padding-right: 0 !important; }
.dm-caret span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px;
    color: var(--text-faint); font-size: 16px; line-height: 1;
    transition: transform .2s var(--ease), color .2s, background .2s;
}
.dm-expandable:hover .dm-caret span { background: var(--bg-hover); color: var(--text-2); }
.dm-expandable[aria-expanded="true"] { background: var(--primary-soft); }
.dm-expandable[aria-expanded="true"]:hover { background: var(--primary-soft); }
.dm-expandable[aria-expanded="true"] td { border-bottom-color: transparent; }
.dm-expandable[aria-expanded="true"] .dm-caret span { transform: rotate(90deg); color: var(--primary); background: #fff; box-shadow: var(--shadow-xs); }
.dm-expandable[aria-expanded="true"] .dm-strong { color: var(--primary); }

.dm-detail-row > td { padding: 0 !important; background: var(--primary-soft); }
.dm-detail-row:hover { background: transparent; }
.dm-detail {
    margin: 0 20px 16px 44px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    color: var(--text-muted);
}
.dm-detail-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); font-size: 12px; }
.dm-detail-head strong { color: var(--text); font-weight: 600; }
.dm-detail-loading { padding: 16px; font-size: 12.5px; }
.dm-runs { list-style: none; }
.dm-runs li { display: grid; grid-template-columns: minmax(0, 1fr) 110px 100px 130px; align-items: center; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.dm-runs .dm-badge { justify-self: end; }
.dm-runs li:first-child { border-top: none; }
.dm-runs li:hover { background: var(--bg-hover); }
.dm-runs time { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.dm-runs .dm-err { grid-column: 1 / -1; margin-top: -4px; color: var(--danger); font-size: 12px; }

/* ---------- Modal ---------- */
.dm-modal {
    border: none; border-radius: var(--radius-lg); padding: 0;
    width: min(640px, calc(100vw - 32px)); margin: auto;
    box-shadow: var(--shadow-lg); color: var(--text);
    opacity: 0; transform: translateY(14px) scale(.97);
    transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.dm-modal.is-open { opacity: 1; transform: none; }
.dm-modal::backdrop { background: rgba(11,16,32,.55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .22s var(--ease); }
.dm-modal.is-open::backdrop { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .dm-modal, .dm-modal::backdrop { transition: none; } }
.dm-modal-inner { display: flex; flex-direction: column; }
.dm-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.dm-modal-head h2 { margin: 0; font-size: 16px; }
.dm-modal-close { background: none; border: none; width: 30px; height: 30px; border-radius: 8px; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; }
.dm-modal-close:hover { background: var(--bg-hover); color: var(--text); }
.dm-notice {
    margin: 20px 24px 0; padding: 12px 14px 12px 42px; border-radius: 10px; position: relative;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff); color: #3730a3; border: 1px solid #ddd6fe;
}
.dm-notice::before { content: "i"; position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.dm-notice strong { display: block; margin-bottom: 2px; color: #312e81; }
.dm-modal-body { border: none; padding: 20px 24px 6px; opacity: .55; filter: grayscale(.3); }
.dm-modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--bg-subtle); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.dm-modal-foot > div { display: flex; gap: 8px; }
.dm-dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 32px; text-align: center; display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; background: var(--bg-subtle); }
@media (max-width: 560px) { .dm-form-grid { grid-template-columns: 1fr; } }

/* ---------- Login ---------- */
.dm-login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background:
        radial-gradient(800px 400px at 10% 0%, rgba(99,102,241,.18), transparent 60%),
        radial-gradient(700px 400px at 100% 100%, rgba(139,92,246,.14), transparent 60%),
        var(--bg);
}
.dm-login-card { width: 100%; max-width: 400px; padding: 36px 36px 28px; box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); }
.dm-login-card .dm-muted { margin-bottom: 24px; }
.dm-alert { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; border: 1px solid rgba(220,38,38,.15); }
.dm-hint { margin-top: 18px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .dm-layout { flex-direction: column; }
    .dm-sidenav { width: 100%; height: auto; position: static; }
    .dm-menu { flex-direction: row; flex-wrap: wrap; padding-bottom: 12px; }
    .dm-menu a.active::before { display: none; }
    .dm-menu-label, .dm-sidenav-foot { display: none; }
    .dm-topbar { padding: 0 16px; }
    .dm-content { padding: 16px; }
    .dm-table th { position: static; }
    .dm-toolbar input[type="search"] { min-width: 0; flex: 1; }
    .dm-page-head { flex-direction: column; align-items: flex-start; }
}
