/*
 * SVA Client Styles — App-Specific Overrides
 *
 * Requires sva_base.css loaded first.
 * Defines blue accent colour and client-only components.
 */

/* ===================================================================
   1. CLIENT COLOR OVERRIDES
   =================================================================== */

:root {
    --color-primary: #1a56db;
    --color-primary-dark: #1244af;
    --color-primary-light: #e8effc;
    --shadow-ring: 0 0 0 3px rgba(26, 86, 219, 0.15);
    --content-max-width: 800px;
}

/* Client dark — brighter blue for dark backgrounds */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --color-primary: #4a8af4;
        --color-primary-dark: #3b7ae0;
        --color-primary-light: #1a2640;
        --shadow-ring: 0 0 0 3px rgba(74, 138, 244, 0.25);
    }
}
html[data-theme="dark"] {
    --color-primary: #4a8af4;
    --color-primary-dark: #3b7ae0;
    --color-primary-light: #1a2640;
    --shadow-ring: 0 0 0 3px rgba(74, 138, 244, 0.25);
}

/* ===================================================================
   1b. CSS TOOLTIPS — general-purpose, works on any element
   =================================================================== */

[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 100;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
    opacity: 1;
}

/* ===================================================================
   2. CLIENT BUTTON OVERRIDES (larger touch targets)
   =================================================================== */

button {
    padding: 12px 24px;
    font-size: 16px;
    min-height: 48px;
    margin-right: 8px;
    margin-top: 8px;
}

button.secondary {
    background: var(--color-secondary);
}

button.secondary:hover {
    background: var(--color-secondary-dark);
}

button.danger {
    background: var(--color-danger);
}

button.danger:hover {
    background: var(--color-danger-dark);
}

button.warning {
    background: var(--color-warning);
    color: var(--color-text);
}

button.warning:hover {
    background: var(--color-warning-dark);
}

/* ===================================================================
   3. HEADER EXTRAS
   =================================================================== */

.header-right {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
}

.header-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    padding: 6px;
    background-clip: content-box;
}

/* Header tooltips appear below (above would clip at viewport top) */
.header-right [data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 6px);
}

.header-settings-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text);
    padding: 0;
    margin: 0;
}

.header-settings-btn:hover {
    background: var(--color-bg);
}

/* Help button + dropdown menu */
.header-help-wrap {
    position: relative;
}

.header-help-btn {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-text-secondary);
    padding: 0;
    margin: 0;
    transition: background 0.15s;
}

.header-help-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.header-help-btn .material-symbols-outlined {
    font-size: 22px;
}

.header-help-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg, 0 4px 12px rgba(0,0,0,0.15));
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
}

.header-help-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}

.header-help-menu-item:hover {
    background: var(--color-bg);
}

.header-help-menu-item .material-symbols-outlined {
    font-size: 20px;
    color: var(--color-text-secondary);
}

/* ===================================================================
   4. STATUS INDICATORS
   =================================================================== */

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.header-key-health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s ease;
    padding: 6px;
    background-clip: content-box;
}

/* Shared status dot colors (used by both platform + key health dots) */
.status-ok           { background: var(--color-success); }
.status-error        { background: var(--color-danger); }

.key-health-ok      { background: var(--color-success); }
.key-health-warning  { background: var(--color-warning); }
.key-health-danger   { background: var(--color-danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

.status-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text);
}

.status-detail {
    margin-top: 8px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* ===================================================================
   5. CRUD PATTERN
   =================================================================== */

.crud-view {
    position: relative;
}

.crud-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.crud-item {
    background: var(--color-surface);
    padding: 12px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.1s ease;
    box-shadow: var(--shadow-sm);
}

.crud-item:active {
    transform: scale(var(--card-press-scale));
}

/* CRUD Action Bar (replaces single FAB) */
.crud-action-bar {
    position: fixed;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 90;
}

.crud-action-btn {
    height: 48px;
    padding: 0 16px;
    border-radius: 24px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: opacity 0.2s, transform 0.15s;
    min-height: auto;
    margin: 0;
    white-space: nowrap;
}

.crud-action-btn:active:not(:disabled) {
    transform: scale(var(--fab-press-scale));
}

.crud-action-create { background: var(--color-primary); color: #fff; }
.crud-action-blt-send { background: var(--color-success); color: #fff; }
.crud-action-blt-receive { background: var(--color-success); color: #fff; }
.crud-action-btn:disabled { background: var(--color-disabled); color: var(--color-disabled-text); opacity: 0.6; cursor: default; }

/* Assets tab — BLA/BLT section layout */
.assets-bla-section {
    position: relative;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--color-text-muted);
}
.assets-blt-section {
    padding-top: var(--space-sm);
}
.assets-section-fab {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-sm);
}

.crud-back-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin: 0;
    margin-right: 8px;
    min-height: auto;
    color: var(--color-text);
}

.crud-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* CRUD Toolbar */
.crud-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.crud-home-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    margin: 0;
    min-height: auto;
    color: var(--color-primary);
    border-radius: var(--radius-sm);
}

.crud-home-btn:hover {
    background: var(--color-bg);
}

.crud-home-btn:active {
    transform: none;
}

.crud-toolbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}

.crud-toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.crud-toolbar-actions button {
    font-size: 13px;
    padding: 6px 12px;
    min-height: 36px;
    margin: 0;
}

/* CRUD Detail View */
.crud-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.crud-detail-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.crud-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.crud-detail-actions button {
    font-size: 13px;
    padding: 8px 16px;
}

.crud-detail-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--color-disabled); border-radius: var(--radius-2xl); transition: 0.2s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Segment Control */
.segment-control {
    display: flex;
    gap: 0;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 2px;
    margin-bottom: 12px;
}

.segment-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
    margin: 0;
}

.segment-btn:hover {
    background: transparent;
}

.segment-btn:active {
    transform: none;
}

.segment-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.segment-panel {
    display: none;
}

.segment-panel.active {
    display: block;
}

/* Hide inner tab-nav when CRUD toolbar is present */
.crud-view .tab-nav {
    display: none;
}

/* ===================================================================
   6. SHORTCUT TILES (DASHBOARD)
   =================================================================== */

.shortcut-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.shortcut-tile {
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
}

.shortcut-tile:active {
    transform: scale(var(--btn-press-scale));
}

/* First-action CTA cards (dashboard onboarding prompts) */
.first-action-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    cursor: pointer;
    border: 2px dashed var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.first-action-cta:active {
    transform: scale(var(--card-press-scale));
}
.first-action-cta-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.first-action-cta-text {
    flex: 1;
    min-width: 0;
}
.first-action-cta-text strong {
    font-size: 15px;
    color: var(--color-text-primary);
}
.first-action-cta-arrow {
    font-size: 22px;
    color: var(--color-primary);
    flex-shrink: 0;
    font-weight: bold;
}

/* ===================================================================
   7. VALIDATION SCORE RING
   =================================================================== */

.validation-status-card {
    text-align: center;
    padding: 20px;
}

.validation-score-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 8px solid;
    transition: all 0.3s ease;
}

.validation-score-ring.status-green {
    border-color: var(--color-success);
    background: var(--color-success-light);
}

.validation-score-ring.status-yellow {
    border-color: var(--color-warning);
    background: var(--color-warning-light);
}

.validation-score-ring.status-red {
    border-color: var(--color-danger);
    background: var(--color-danger-light);
}

.validation-score-ring.status-gray {
    border-color: var(--color-secondary);
    background: var(--color-secondary-light);
}

.validation-score-value {
    font-size: 28px;
    font-weight: bold;
}

.validation-score-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.validation-status-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.validation-status-detail {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* ===================================================================
   8. INFO GRID
   =================================================================== */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.info-item label {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.info-item value {
    display: block;
    font-size: 14px;
    color: var(--color-text);
    word-break: break-all;
}

/* ===================================================================
   9. ALGORITHM TOGGLE
   =================================================================== */

.algo-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.algo-toggle label {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
}

.algo-btn {
    padding: 8px 16px;
    font-size: 14px;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    color: var(--color-text);
}

.algo-btn:hover {
    border-color: var(--color-primary);
}

.algo-btn.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.algo-btn.active:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

.algo-info {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: auto;
}

/* ===================================================================
   10. TAB NAVIGATION (Inner tabs within views)
   =================================================================== */

.tab-nav {
    display: flex;
    flex-direction: row;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
    margin-right: 0;
    margin-top: 0;
}

.tab-btn:hover {
    color: var(--color-text);
    background: transparent;
}

.tab-btn:active {
    transform: none;
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: transparent;
}

/* ===================================================================
   11. PEER ITEM STYLES
   =================================================================== */

.peer-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border-left: 4px solid var(--color-secondary);
    transition: transform 0.1s ease;
}

.peer-item:active {
    transform: scale(var(--card-press-scale));
}

.peer-item.peer-green  { border-left-color: var(--color-success); }
.peer-item.peer-yellow { border-left-color: var(--color-warning); }
.peer-item.peer-red    { border-left-color: var(--color-danger); }

/* ===================================================================
   12. NETWORK BAR
   =================================================================== */

.network-bar {
    background: var(--color-warning-light);
    color: var(--color-warning);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.network-bar.error {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.network-bar.success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.network-bar.retrying {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.network-bar-icon {
    flex-shrink: 0;
}

.network-bar-text {
    flex: 1;
}

.network-bar-dismiss {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    flex-shrink: 0;
}
.network-bar-dismiss:hover { opacity: 1; }

/* ===================================================================
   13. KEY INFO STYLES
   =================================================================== */

.key-info-item {
    padding: 10px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.key-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.key-value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text);
    word-break: break-all;
}

.key-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.key-status-active  { background: var(--color-success); }
.key-status-partial { background: var(--color-warning); }
.key-status-missing { background: var(--color-danger); }

.key-info-link {
    color: var(--color-primary);
    cursor: pointer;
    font-size: 11px;
    text-decoration: underline;
}

.key-info-link:hover {
    color: var(--color-primary-dark);
}

#keyChainSelect optgroup {
    font-weight: bold;
    font-size: 13px;
}

/* ===================================================================
   14. FILTER ROW
   =================================================================== */

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-row label {
    display: block;
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.filter-row select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    min-height: auto;
}

/* ===================================================================
   15. CONFIG SECTION
   =================================================================== */

.config-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.config-section label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.config-section input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 16px;
}

/* ===================================================================
   16. LOG CONTAINER
   =================================================================== */

.log-container {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-family: var(--font-mono);
    font-size: 12px;
}

.log-entry {
    margin: 4px 0;
    padding: 2px 0;
}

.log-entry.info    { color: #9cdcfe; }
.log-entry.success { color: #4ec9b0; }
.log-entry.error   { color: #f14c4c; }
.log-entry.warn    { color: #cca700; }

/* ===================================================================
   17. ENTITY COMPONENTS (shared list/detail cards)
   =================================================================== */

/* Entity Card */
.entity-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    transition: transform 0.1s ease;
}

.entity-card:active {
    transform: scale(var(--card-press-scale));
}

/* Highlight animation for newly created items */
.entity-card-highlight {
    animation: entity-highlight-fade 2s ease-out;
}

@keyframes entity-highlight-fade {
    0% { background: var(--color-primary-light); border-color: var(--color-primary); }
    100% { background: var(--color-surface); border-color: var(--color-border); }
}

/* Card layout: icon/status + content + actions */
.entity-card-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.entity-card-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.entity-card-content {
    flex: 1;
    min-width: 0;
}

.entity-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.entity-card-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.entity-card-detail {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.entity-card-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

/* Compact action buttons inside entity cards */
.entity-card-actions button,
.entity-action-btn {
    font-size: 12px;
    padding: 6px 12px;
    min-height: auto;
    margin: 0;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    letter-spacing: 0.01em;
}

.entity-card-actions button:active,
.entity-action-btn:active {
    transform: scale(var(--btn-press-scale));
}

.entity-card-actions button .material-symbols-outlined,
.entity-action-btn .material-symbols-outlined {
    font-size: 15px;
}

/* Higher specificity to override .entity-card-actions button base rule */
.entity-card-actions .entity-action-btn-primary {
    background: var(--color-primary);
    color: #fff;
    font-size: 16px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius-md);
}
.entity-action-btn-secondary { background: var(--color-secondary); color: #fff; }
.entity-action-btn-danger { background: var(--color-danger); color: #fff; }
.entity-action-btn-warning { background: var(--color-warning); color: #fff; }
.entity-action-btn-info { background: var(--color-info); color: #fff; }

.entity-action-btn-secondary:hover { background: var(--color-secondary-dark); }
.entity-action-btn-danger:hover { background: var(--color-danger-dark); }
.entity-action-btn-info:hover { background: var(--color-info-dark); }

/* Status Badges */
.entity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
    vertical-align: middle;
}

.entity-badge-success { background: var(--color-success-light); color: var(--color-success); }
.entity-badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.entity-badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.entity-badge-info { background: var(--color-info-light); color: var(--color-info); }
.entity-badge-muted { background: var(--color-border); color: var(--color-secondary); }

/* Solid badges (white text, colored background) */
.entity-badge-solid-success { background: var(--color-success); color: #fff; }
.entity-badge-solid-warning { background: var(--color-warning); color: #fff; }
.entity-badge-solid-danger { background: var(--color-danger); color: #fff; }
.entity-badge-solid-info { background: var(--color-primary); color: #fff; }
.entity-badge-solid-muted { background: var(--color-secondary); color: #fff; }

/* Entity search bar */
.entity-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
.entity-search-icon {
    font-size: 20px;
    color: var(--color-text-muted);
}
.entity-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--color-text);
    outline: none;
    min-height: auto;
    padding: 4px 0;
}
.entity-search-input::placeholder {
    color: var(--color-text-muted);
}

/* Empty state */
.entity-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--color-text-muted);
}

.entity-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.entity-empty-text {
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.entity-empty-action {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-height: auto;
    margin: 0;
}

.entity-empty-action:active {
    transform: scale(var(--btn-press-scale));
}

/* Entity section header (grouped list divider) */
.entity-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 4px 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
}

/* Entity role box (peer role summary) */
/* Legacy role box (kept for backward compat) */
.entity-role-box {
    font-size: 11px;
    margin-top: 6px;
    padding: 6px;
    background: var(--color-surface);
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
}

.entity-role-row {
    margin-bottom: 4px;
}

.entity-role-row:last-child {
    margin-bottom: 0;
}

.entity-role-label {
    font-weight: 500;
}

/* Role tags — horizontal pill layout */
.entity-role-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.entity-role-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.3px;
}

.entity-role-tag-me {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.entity-role-tag-peer {
    background: var(--color-secondary-light);
    color: var(--color-text-secondary);
}

.entity-role-tag-warn {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.entity-role-tag-score {
    background: var(--color-success-light, #e8f5e9);
    color: var(--color-success, #2e7d32);
}

/* Permissions — compact inline row */
.entity-perm-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    padding: 6px 0;
    border-top: 1px solid var(--color-border);
}

/* Action buttons — full-width row at bottom */
.entity-card-actions-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

/* Legacy permissions grid (kept for other views) */
.entity-permissions {
    background: var(--color-surface);
    padding: 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    font-size: 11px;
    margin-top: 8px;
}

.entity-perm-title {
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.entity-perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.entity-perm-col {
    padding: 6px;
    background: var(--color-bg);
    border-radius: var(--radius-xs);
}

.entity-perm-heading {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.entity-perm-items {
    display: flex;
    gap: 8px;
}

.entity-perm-yes { color: var(--color-success); }
.entity-perm-no { color: var(--color-text-muted); }

.entity-perm-summary {
    font-size: 9px;
    margin-top: 6px;
    padding: 4px;
    background: var(--color-bg);
    border-radius: 3px;
}

/* Thumbprint display */
.entity-thumbprints {
    background: var(--color-surface);
    padding: 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    font-family: var(--font-mono);
    font-size: 10px;
    margin-top: 4px;
}

.entity-thumb-row {
    margin-bottom: 4px;
}

.entity-thumb-row:last-child {
    margin-bottom: 0;
}

.entity-thumb-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.entity-thumb-value {
    cursor: help;
}

.entity-thumb-my { color: var(--color-primary); }
.entity-thumb-peer { color: var(--color-warning); }

.hash-toggle {
    cursor: pointer;
    text-decoration: underline dotted;
}
.hash-toggle:hover {
    color: var(--color-primary, #1a73e8);
}

.entity-thumb-copy {
    margin-left: 4px;
    padding: 2px 6px;
    font-size: 10px;
    cursor: pointer;
    background: var(--color-bg-secondary, #f0f0f0);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    min-height: auto;
    color: var(--color-text-secondary, #555);
}
.entity-thumb-copy:hover {
    background: var(--color-border, #ddd);
}

/* Detail view */
.entity-detail {
    padding: 4px 0;
}

.entity-detail-header {
    margin-bottom: 12px;
}

.entity-detail-body {
    margin-bottom: 12px;
}

.entity-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.entity-action {
    font-size: 14px;
    padding: 10px 18px;
    min-height: 42px;
    margin: 0;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    letter-spacing: 0.01em;
}

.entity-action:hover {
    box-shadow: var(--shadow-sm);
}

.entity-action:active {
    transform: scale(var(--btn-press-scale));
}

.entity-action:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.entity-action .material-symbols-outlined {
    font-size: 18px;
}

.entity-action-primary { background: var(--color-primary); color: #fff; }
.entity-action-primary:hover { background: var(--color-primary-dark); }
.entity-action-secondary { background: var(--color-secondary); color: #fff; }
.entity-action-secondary:hover { background: var(--color-secondary-dark); }
.entity-action-danger { background: var(--color-danger); color: #fff; }
.entity-action-danger:hover { background: var(--color-danger-dark); }
.entity-action-warning { background: var(--color-warning); color: #fff; }
.entity-action-warning:hover { background: var(--color-warning-dark); }
.entity-action-info { background: var(--color-info); color: #fff; }
.entity-action-info:hover { background: var(--color-info-dark); }

/* Info rows (for detail view) */
.entity-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-bg);
}

.entity-info-row:last-child {
    border-bottom: none;
}

.entity-info-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.entity-info-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.entity-info-mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

/* BLT two-column layout */
.entity-blt-columns {
    display: flex;
    gap: 12px;
}

.entity-blt-column {
    flex: 1;
    min-width: 0;
}

.entity-blt-header {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid currentColor;
}

.entity-blt-header-sent { color: var(--color-primary); }
.entity-blt-header-received { color: var(--color-success); }

/* ===================================================================
   18. RESPONSIVE — TABLET (>= 768px)
   =================================================================== */

@media (min-width: 768px) {

    /* Tab bar becomes a side rail on the left */
    #tabBar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: auto;
        width: 80px;
        height: 100%;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 16px;
        padding-bottom: var(--safe-bottom);
        border-top: none;
        border-right: 1px solid var(--color-border);
    }

    .tab-bar-item {
        width: 100%;
        padding: 12px 8px;
    }

    /* Labels hidden on tablet — just icons */
    .tab-bar-label {
        font-size: 9px;
    }

    .tab-bar-badge {
        top: 6px;
        right: 10px;
    }

    /* Header shifts right to accommodate side rail */
    #appHeader {
        margin-left: 80px;
    }

    /* Content shifts right, no bottom padding needed */
    #appContent {
        margin-left: 80px;
        padding-bottom: 24px;
        padding-left: 24px;
        padding-right: 24px;
    }

    /* Action bar adjusts for side rail */
    .crud-action-bar {
        bottom: 24px;
        right: 24px;
    }

    /* Shortcut grid gets 3 columns */
    .shortcut-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Info grid stays 2-col but gets more room */
    .info-grid {
        gap: 16px;
    }
}

/* ===================================================================
   19. RESPONSIVE — DESKTOP (>= 1024px)
   =================================================================== */

@media (min-width: 1024px) {

    /* Tab bar widens with visible labels */
    #tabBar {
        width: 200px;
    }

    .tab-bar-item {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
    }

    .tab-bar-icon {
        font-size: 18px;
        margin-bottom: 0;
    }

    .tab-bar-label {
        font-size: 13px;
    }

    .tab-bar-badge {
        position: static;
        margin-left: auto;
    }

    /* Header and content shift for wider rail */
    #appHeader {
        margin-left: 200px;
    }

    #appContent {
        margin-left: 200px;
        max-width: calc(var(--content-max-width) + 48px);
    }

    /* Shortcut grid gets 4 columns */
    .shortcut-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Wider info grid */
    .info-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Cards get a max-width for readability on wide screens */
    .card {
        max-width: var(--content-max-width);
    }

    /* Log container can be taller on desktop */
    .log-container {
        max-height: 400px;
    }
}

/* ===================================================================
   20. CRUD VIEW STYLES
   =================================================================== */

.crud-view-container {
    position: relative;
    min-height: calc(100vh - var(--header-height) - var(--safe-top) - var(--tab-bar-height) - 16px);
}

/* List panel */
.crud-list-panel {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.crud-list-panel.crud-panel-hidden {
    display: none;
}

.crud-header-content {
    margin-bottom: var(--space-lg);
}

/* Detail panel */
.crud-detail-panel {
    display: none;
}

.crud-detail-panel.crud-panel-visible {
    display: block;
    animation: crudSlideIn 0.25s ease-out;
}

/* Tablet: side-by-side list + detail */
@media (min-width: 768px) {
    .crud-list-panel.crud-panel-hidden {
        display: block;
    }
    .crud-detail-panel {
        display: block;
    }
    .crud-detail-panel.has-content {
        display: block;
    }
    .crud-back-btn {
        display: none;
    }
}

@keyframes crudSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.crud-detail-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.crud-back-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    min-height: 36px;
    transition: background 0.15s ease;
}

.crud-back-btn:hover {
    background: var(--color-primary-light);
}

.crud-back-btn svg {
    flex-shrink: 0;
}

.crud-detail-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Floating Action Button — pill shape with label text */
.crud-fab {
    position: fixed;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 20px);
    right: 20px;
    height: 48px;
    padding: 0 20px;
    border-radius: 24px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg), 0 2px 12px rgba(26, 86, 219, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    z-index: 50;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.crud-fab:active {
    transform: scale(var(--fab-press-scale));
}

.crud-fab:hover {
    box-shadow: var(--shadow-lg), 0 4px 20px rgba(26, 86, 219, 0.4);
}

/* Tablet: FAB adjusts for side rail */
@media (min-width: 768px) {
    .crud-fab {
        bottom: 24px;
        right: 24px;
    }
}

/* ===================================================================
   21. DASHBOARD V2 STYLES
   =================================================================== */

/* Validation hero card */
.dash-validation-card {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    position: relative;
}

.dash-validation-card .card-section-title {
    text-align: left;
    margin-bottom: var(--space-lg);
}

/* Validation timeline bar */
.dash-timeline-bar-wrap {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto var(--space-md);
}

.dash-timeline-bar-svg {
    width: 100%;
    height: 60px;
    display: block;
}

.dash-timeline-baseline {
    stroke: var(--color-text-muted);
    stroke-width: 1;
    opacity: 0.4;
}

.dash-timeline-strong {
    fill: var(--color-text-muted);
    fill-opacity: 0.35;
    transition: fill 0.3s ease;
}
.dash-timeline-strong.timeline-green { fill: var(--color-success); }
.dash-timeline-strong.timeline-yellow { fill: var(--color-warning); }
.dash-timeline-strong.timeline-red { fill: var(--color-danger); }
.dash-timeline-strong.timeline-gray { fill: var(--color-text-muted); }

.dash-timeline-surplus {
    fill: var(--color-text-muted);
    fill-opacity: 0.12;
    transition: fill 0.3s ease;
}
.dash-timeline-surplus.timeline-green { fill: var(--color-success); }
.dash-timeline-surplus.timeline-yellow { fill: var(--color-warning); }
.dash-timeline-surplus.timeline-red { fill: var(--color-danger); }
.dash-timeline-surplus.timeline-gray { fill: var(--color-text-muted); }

.dash-timeline-stroke {
    fill: none;
    stroke: var(--color-text-muted);
    stroke-width: 1.5;
    transition: stroke 0.3s ease;
}
.dash-timeline-stroke.timeline-green { stroke: var(--color-success); }
.dash-timeline-stroke.timeline-yellow { stroke: var(--color-warning); }
.dash-timeline-stroke.timeline-red { stroke: var(--color-danger); }
.dash-timeline-stroke.timeline-gray { stroke: var(--color-text-muted); }

.dash-timeline-threshold {
    stroke: var(--color-text-muted);
    stroke-width: 1;
    stroke-dasharray: 4 3;
    opacity: 0.5;
}
.dash-timeline-threshold.timeline-green { stroke: var(--color-success); }
.dash-timeline-threshold.timeline-yellow { stroke: var(--color-warning); }
.dash-timeline-threshold.timeline-red { stroke: var(--color-danger); }

.dash-timeline-label {
    font-size: 9px;
    fill: var(--color-text-muted);
    font-family: var(--font-sans);
}

.dash-timeline-revalidate {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-danger-light);
    border-radius: var(--radius-md);
    color: var(--color-danger);
    font-weight: 700;
    font-size: var(--font-size-lg);
    letter-spacing: 0.5px;
    pointer-events: none;
}

.dash-score-summary {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.dash-score-number {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.dash-score-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tap affordance on validation card */
.dash-validation-card {
    cursor: pointer;
}
.dash-validation-tap-hint {
    font-size: 11px;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-sm);
    font-style: italic;
}

/* Expanded validation detail view */
.dash-expanded-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.dash-expanded-back-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
    font-weight: 600;
}
.dash-expanded-back-btn:active {
    opacity: 0.7;
}
.dash-expanded-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text);
}
.dash-expanded-chart-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-sm) 0;
}
.dash-expanded-chart-svg {
    width: 100%;
    min-width: 300px;
    display: block;
}
.dash-expanded-peer-label {
    font-size: 11px;
    font-weight: 700;
    fill: var(--color-text);
    font-family: var(--font-sans);
}
.dash-expanded-score-label {
    font-size: 9px;
    fill: var(--color-text-muted);
    font-family: var(--font-sans);
}
.dash-expanded-bar-bg {
    fill: var(--color-border);
    opacity: 0.3;
}
.dash-expanded-bar-fill {
    fill: var(--color-text-muted);
    transition: fill 0.3s ease;
}
.dash-expanded-bar-fill.timeline-green { fill: var(--color-success); }
.dash-expanded-bar-fill.timeline-yellow { fill: var(--color-warning); }
.dash-expanded-bar-fill.timeline-red { fill: var(--color-danger); }
.dash-expanded-bar-fill.timeline-gray { fill: var(--color-text-muted); opacity: 0.4; }
.dash-expanded-hint {
    font-size: 11px;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-sm);
    font-style: italic;
}

/* Quick actions row */
.dash-quick-actions {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    scrollbar-width: none;
}

.dash-quick-actions::-webkit-scrollbar {
    display: none;
}

.dash-quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font: inherit;
    border-radius: var(--radius-lg);
    cursor: pointer;
    flex: 1;
    min-width: 0;
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.dash-quick-action-btn:active {
    transform: scale(var(--btn-press-scale));
}

.dash-quick-action-btn:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.dash-quick-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.dash-quick-action-icon.action-success {
    color: var(--color-success);
    background: var(--color-success-light);
}

.dash-quick-action-icon.action-warning {
    color: var(--color-warning);
    background: var(--color-warning-light);
}

.dash-quick-action-label {
    font-size: var(--font-size-xs);
    color: var(--color-text);
    font-weight: 500;
    white-space: nowrap;
}

/* Entity summary row */
.dash-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.dash-summary-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.dash-summary-card:active {
    transform: scale(var(--btn-press-scale));
}

.dash-summary-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.dash-summary-count {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.dash-summary-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
    letter-spacing: 0.5px;
}

/* System Topology graph */
.dash-topology-refresh {
    margin-left: auto;
    background: none;
    font: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
    display: flex;
    align-items: center;
}
.dash-topology-refresh:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.dash-topology-wrap {
    position: relative;
    overflow: hidden;
    padding: 0;
}
.dash-topology-svg {
    width: 100%;
    height: auto;
    display: block;
}
.dash-topology-svg [data-node-type]:hover rect:first-of-type {
    opacity: 0.2;
}
@media (max-height: 700px) {
    .dash-topology-svg {
        max-height: 200px;
    }
}

/* Topology action menu (floating context menu on node click) */
.topo-action-menu {
    position: absolute;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 4px;
    z-index: 100;
    min-width: 140px;
}
.topo-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    min-height: auto;
    margin: 0;
}
.topo-action-btn:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}
.topo-action-btn .material-symbols-outlined {
    font-size: 16px;
}

/* Section title with tooltip */
.card-section-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--space-md) 0;
    display: flex;
    align-items: center;
}

/* First-action CTA V2 */
.dash-cta-card {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--color-primary-light);
    border: 1px dashed var(--color-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.1s ease;
    margin-bottom: var(--space-md);
}

.dash-cta-card:active {
    transform: scale(var(--card-press-scale));
}

.dash-cta-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-cta-text {
    flex: 1;
    min-width: 0;
}

.dash-cta-text strong {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    margin-bottom: 2px;
}

.dash-cta-text span {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.dash-cta-arrow {
    color: var(--color-primary);
    flex-shrink: 0;
}

/* ===================================================================
   22. STATUS LINE
   =================================================================== */

.status-line {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    margin: var(--space-sm) 0;
    max-height: 80px;
    overflow-y: auto;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
}

.status-line-entry {
    padding: 1px 0;
    color: var(--color-text-muted);
}

.status-line-info .status-line-entry { color: var(--color-text-muted); }
.status-line-success .status-line-entry:last-child { color: var(--color-success); }
.status-line-error .status-line-entry:last-child { color: var(--color-danger); }
.status-line-progress .status-line-entry:last-child { color: var(--color-primary); }

/* ===================================================================
   23. DASHBOARD COMPACT MODE — Height-based media queries
   =================================================================== */

/* Tier 1: phones <=700px viewport height (e.g. iPhone SE at 667px) */
@media (max-height: 700px) {
    .dash-validation-card {
        padding: 12px;
    }

    .dash-validation-card .card-section-title {
        margin-bottom: 8px;
    }

    .dash-timeline-bar-wrap {
        margin-bottom: 6px;
    }

    .dash-timeline-bar-svg {
        height: 48px;
    }

    .dash-score-number {
        font-size: 20px;
    }

    .validation-status-text {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .validation-status-detail {
        font-size: 11px;
    }

    .card {
        margin-bottom: 8px;
    }

    .dash-quick-actions {
        padding: 4px 0;
    }

    .dash-expanded-toolbar {
        margin-bottom: 6px;
    }
    .dash-expanded-title {
        font-size: 15px;
    }
    .dash-expanded-hint {
        font-size: 10px;
    }

    .dash-journey-card {
        padding: 12px;
    }
    .dash-journey-step {
        padding: 10px 0;
    }
    .dash-journey-marker {
        width: 30px;
        height: 30px;
    }
}

/* Tier 2: very small phones <=570px viewport height */
@media (max-height: 570px) {
    .dash-validation-card {
        padding: 8px;
    }

    .dash-timeline-bar-wrap {
        margin-bottom: 4px;
    }

    .dash-timeline-bar-svg {
        height: 40px;
    }

    .dash-score-number {
        font-size: 18px;
    }

    .card {
        margin-bottom: 4px;
    }

    .dash-expanded-toolbar {
        margin-bottom: 4px;
    }
    .dash-expanded-title {
        font-size: 14px;
    }

    .dash-journey-card {
        padding: 8px;
    }
    .dash-journey-step {
        padding: 8px 0;
    }
    .dash-journey-marker {
        width: 28px;
        height: 28px;
    }
    .dash-journey-step-why {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* ===================================================================
   24. JOURNEY GUIDE
   =================================================================== */

/* Restore chip (shown when guide is dismissed) */
.dash-journey-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: var(--space-md);
    transition: background 0.15s ease;
}
.dash-journey-chip:active {
    background: var(--color-primary);
    color: #fff;
}
.dash-journey-chip-icon {
    font-size: 16px;
}

/* Card wrapper */
.dash-journey-card {
    margin-bottom: var(--space-md);
}

/* Header row */
.dash-journey-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}
.dash-journey-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}
.dash-journey-header-icon {
    font-size: 20px;
    color: var(--color-primary);
}
.dash-journey-header-text {
    display: flex;
    flex-direction: column;
}
.dash-journey-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.2;
}
.dash-journey-progress-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}
.dash-journey-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* Progress bar (inline in header) */
.dash-journey-progress-bar {
    width: 60px;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.dash-journey-progress-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Dismiss X */
.dash-journey-dismiss {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.dash-journey-dismiss:hover {
    color: var(--color-text);
}

/* Intro animation */
.dash-intro-animation-wrap {
    position: relative;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-sm);
}
.dash-intro-animation-svg {
    width: 100%;
    height: auto;
    max-height: 260px;
    display: block;
}
.dash-intro-controls {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    padding: 0 4px;
}
.dash-intro-ctrl-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.dash-intro-ctrl-btn .material-symbols-outlined {
    font-size: 18px;
}
.dash-intro-ctrl-btn:hover {
    color: var(--color-text);
    background: var(--color-border);
}

/* Steps container */
.dash-journey-steps {
    padding-top: var(--space-md);
}

/* Single step row */
.dash-journey-step {
    display: flex;
    gap: var(--space-sm);
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
}
.dash-journey-step:first-child {
    border-top: none;
}

/* Step marker circle */
.dash-journey-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
}
.dash-journey-marker-icon {
    font-size: 18px;
    color: var(--color-text-muted);
}

/* Status variants */
.dash-journey-step-complete .dash-journey-marker {
    background: var(--color-success-light);
    border-color: var(--color-success);
    cursor: pointer;
}
.dash-journey-step-complete .dash-journey-marker-icon {
    color: var(--color-success);
}
.dash-journey-step-current .dash-journey-marker {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}
.dash-journey-step-current .dash-journey-marker-icon {
    color: var(--color-primary);
}
.dash-journey-step-locked {
    opacity: 0.5;
}

/* Step content */
.dash-journey-step-content {
    flex: 1;
    min-width: 0;
}
.dash-journey-step-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}
.dash-journey-step-desc {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* "Why" explanation box (current step) */
.dash-journey-step-why {
    margin-top: var(--space-sm);
    padding: 8px 12px;
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--color-primary-dark);
    line-height: 1.5;
}

/* "Why" reveal for completed step */
.dash-journey-accomplished {
    margin-top: var(--space-sm);
    padding: 8px 12px;
    background: var(--color-success-light);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Action button */
.dash-journey-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: var(--space-sm);
    padding: 6px 14px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.dash-journey-action-btn:active {
    background: var(--color-primary-dark);
}
.dash-journey-action-arrow {
    font-size: 14px;
}

/* Sub-step pills (App Guides) */
.dash-journey-substeps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-sm);
}
.dash-journey-substep {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.dash-journey-substep.done {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: var(--color-success);
}
.dash-journey-substep-icon {
    font-size: 12px;
}

/* ===================================================================
   NOTIFICATION STACK — session-transient alert cards on home screen
   =================================================================== */

.notif-stack {
    margin: var(--space-sm) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.notif-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border-left: 3px solid transparent;
    animation: notifSlideIn 0.25s ease-out;
}

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Level color variants */
.notif-info {
    background: var(--color-primary-light);
    border-left-color: var(--color-primary);
}
.notif-warn {
    background: var(--color-warning-light);
    border-left-color: var(--color-warning);
}
.notif-error {
    background: var(--color-danger-light);
    border-left-color: var(--color-danger);
}
.notif-success {
    background: var(--color-success-light);
    border-left-color: var(--color-success);
}

/* Icon inherits level color */
.notif-card-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}
.notif-info .notif-card-icon    { color: var(--color-primary); }
.notif-warn .notif-card-icon    { color: var(--color-warning); }
.notif-error .notif-card-icon   { color: var(--color-danger); }
.notif-success .notif-card-icon { color: var(--color-success); }

/* Body text */
.notif-card-body {
    flex: 1;
    min-width: 0;
}
.notif-card-message {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.35;
}
.notif-card-detail {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}
.notif-card-time {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Dismiss button */
.notif-card-dismiss {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    line-height: 1;
}
.notif-card-dismiss .material-symbols-outlined {
    font-size: 18px;
}
.notif-card-dismiss:hover {
    background: var(--color-secondary-light);
    color: var(--color-text);
}

/* ===================================================================
   FIELD VALIDATION — inline error states
   =================================================================== */

.field-invalid {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 1px var(--color-danger) !important;
    animation: field-shake 0.4s ease-out;
}
.field-error {
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
}
.field-error::before {
    content: 'error';
    font-family: 'Material Symbols Outlined';
    font-size: 14px;
    flex-shrink: 0;
}

@keyframes field-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

/* ===================================================================
   OTC INPUT — PIN-style digit entry boxes
   =================================================================== */

.otc-input-wrap {
    margin: 8px 0;
}
.otc-input-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary, #555);
    margin-bottom: 8px;
}
.otc-input-boxes {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.otc-input-box {
    width: 48px;
    height: 56px;
    text-align: center;
    font-family: monospace;
    font-size: 28px;
    font-weight: 700;
    border: 2px solid var(--color-outline, #ccc);
    border-radius: var(--radius-md, 8px);
    background: var(--color-surface, #fff);
    color: var(--color-text, #1a1a1a);
    caret-color: var(--color-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}
.otc-input-box:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light, rgba(26, 86, 219, 0.15));
}
.otc-input-box.otc-input-filled {
    border-color: var(--color-primary);
    background: var(--color-primary-light, #f0f6ff);
    color: var(--color-primary);
}
.otc-input-complete .otc-input-box {
    border-color: var(--color-success, #28a745);
    background: var(--color-success-light, #d4edda);
    color: var(--color-success, #28a745);
}
.otc-input-box.otc-input-shake {
    animation: field-shake 0.4s ease-out;
    border-color: var(--color-danger) !important;
}
.otc-input-status {
    text-align: center;
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
    transition: color 0.15s ease;
}
.otc-input-status--error {
    color: var(--color-danger);
}
.otc-input-status--ok {
    color: var(--color-success, #28a745);
}
