/* device-details.css — Styles extracted from device_details.html */

/* ── Drive bay rebuild animation ── */
@property --race-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@keyframes drive-rebuild-race {
  to { --race-angle: 360deg; }
}
.drive-rebuilding {
  position: relative;
  border-radius: 6px;
  padding: 0.5rem;
  border: 1px solid #374151;
}
.drive-rebuilding::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  padding: 2px;
  background: conic-gradient(from var(--race-angle),
    transparent 0%, transparent 72%,
    #f59e0b44 78%, #fbbf24 85%, #fffbeb 88%, #fbbf24 91%, #f59e0b44 97%,
    transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
  animation: drive-rebuild-race 2s linear infinite;
}
.drive-scrubbing {
  position: relative;
  border-radius: 6px;
  padding: 0.5rem;
  border: 1px solid #374151;
}
.drive-scrubbing::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  padding: 2px;
  background: conic-gradient(from var(--race-angle),
    transparent 0%, transparent 72%,
    #6366f144 78%, #818cf8 85%, #e0e7ff 88%, #818cf8 91%, #6366f144 97%,
    transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
  animation: drive-rebuild-race 2s linear infinite;
}

#terminal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    padding: 2rem;
}

#terminal-overlay.open {
    display: flex;
    flex-direction: column;
}

#terminal-overlay .terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: white;
}

#terminal-overlay .terminal-header h3 {
    margin: 0;
    font-size: 1rem;
}

#terminal-overlay .terminal-close-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

#terminal-container {
    flex: 1;
    border-radius: 6px;
    overflow: hidden;
}
.username-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    cursor: pointer;
    transition: background-color 0.2s;
}

.username-badge:hover {
    background-color: rgba(139, 92, 246, 0.25);
}

.username-badge.disabled {
    cursor: default;
    pointer-events: none;
}

.username-badge svg {
    width: 0.9rem;
    height: 0.9rem;
    opacity: 0.7;
}

.username-badge.not-set {
    background-color: rgba(107, 114, 128, 0.15);
    color: #6b7280;
    font-style: italic;
}


@keyframes fan-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Fan mode switcher */
.fan-mode-switcher {
    display: inline-flex;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.fan-mode-btn {
    padding: 0.25rem 0.65rem;
    border: none;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: background 0.15s, opacity 0.15s;
}

.fan-mode-btn.active {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-color);
    opacity: 1;
}

.fan-mode-btn:not(.active):hover {
    background: rgba(var(--accent-rgb), 0.08);
    opacity: 0.75;
}

.fan-mode-btn + .fan-mode-btn {
    border-left: 1px solid rgba(var(--accent-rgb), 0.2);
}
#thermal-fan-blades {
    transform-origin: 0 0;
    --fan-speed: 2s;
}
#thermal-fan-blades.spinning {
    animation: fan-spin var(--fan-speed) linear infinite;
}

.health-issue {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.health-issue.sos {
    background: rgba(239, 68, 68, 0.15);
    border-left: 3px solid #ef4444;
}

.health-issue.warn {
    background: rgba(245, 158, 11, 0.15);
    border-left: 3px solid #f59e0b;
}

.live-events-log {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

/* ZeroTier network rows */
.zt-network {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
}

.zt-network:last-child {
    border-bottom: none;
}

.zt-leave-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.zt-leave-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.zt-join-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(var(--accent-rgb), 0.1);
}

.zt-join-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    border: none;
    background: var(--accent-color);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
}

.zt-join-btn:hover {
    opacity: 0.85;
}

/* Sync table — workspace rows */
.sync-table {
    margin-top: 0.25rem;
}

/* Production header */
.production-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-top: 1rem;
    cursor: pointer;
}

.production-header:first-child {
    margin-top: 0;
}

.production-header:hover {
    opacity: 0.85;
}

.production-header h2 {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.production-header .chevron {
    transition: transform 0.2s ease;
    opacity: 0.4;
    font-size: 0.7rem;
}

.prod-group.collapsed .production-header .chevron {
    transform: rotate(-90deg);
}

/* Override dashboard.css indent for sync card */
.prod-group .prod-group-content {
    padding-left: 0;
}

.production-header .ws-count {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.5;
}

.production-header .prod-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.production-header .prod-actions button {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0.25rem;
    color: inherit;
}

.production-header .prod-actions button:hover {
    opacity: 1;
}

/* Row-wide progress fill: a left-to-right accent tint on the <tr>
   that grows with --ws-progress, mirrors connect-client. The old
   2px line-style bar inside the first cell is gone. */
.sync-table tbody tr.workspace-row.ws-syncing,
.table tbody tr.workspace-row.ws-syncing {
    background-image: linear-gradient(
        to right,
        rgba(var(--accent-rgb), 0.18) 0%,
        rgba(var(--accent-rgb), 0.18) var(--ws-progress, 0%),
        transparent var(--ws-progress, 0%)
    );
    transition: background-image 0.3s ease;
}
.sync-table tbody tr.workspace-row.ws-indeterminate,
.table tbody tr.workspace-row.ws-indeterminate {
    animation: ws-row-pulse 2.2s ease-in-out infinite;
}
@keyframes ws-row-pulse {
    0%, 100% { background-color: rgba(var(--accent-rgb), 0.05); }
    50%      { background-color: rgba(var(--accent-rgb), 0.14); }
}

.sync-table .workspace-total-size {
    font-size: 0.8rem;
}

.sync-table .workspace-files-dirs {
    font-size: 0.7rem;
    opacity: 0.7;
}

.sync-table .workspace-peers {
    font-size: 0.7rem;
    opacity: 0.5;
}

/* NX column in sync table */
.sync-table .bridge-col {
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    color: #9ca3af;
    transition: color 0.25s ease;
}

.sync-table .bridge-col.bridge-col-unlinked {
    color: #94a3b8;
}

.sync-table .bridge-col.bridge-col-setup {
    color: #60a5fa;
}

/* Workspace row pause/resume animation */
.table tbody tr.workspace-row {
    transition: opacity 0.4s ease-in-out;
}

.table tbody tr.workspace-row.workspace-paused {
    opacity: 0.5;
}

.table tbody tr.workspace-row.workspace-paused td,
.table tbody tr.workspace-row.workspace-paused td * {
    transition: opacity 0.4s ease-in-out, color 0.3s ease-in-out;
}

.table tbody tr.workspace-row:not(.workspace-paused) td,
.table tbody tr.workspace-row:not(.workspace-paused) td * {
    transition: opacity 0.4s ease-in-out, color 0.3s ease-in-out;
}

/* Marker warning sub-row */
.workspace-warning-row td {
    border-top: none !important;
}

/* Sync pause button */
.sync-pause-btn {
    background: rgba(var(--accent-rgb), 0.08);
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: opacity 0.15s ease, background 0.15s ease;
    color: var(--text-color, #ccc);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sync-pause-btn:hover {
    opacity: 1;
    background: rgba(var(--accent-rgb), 0.2);
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}
.btn-spinner::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-left: 0.4rem;
}

/* Badge variants for sync status — colours mirror connect-client (avid.html) */
.badge-ghost {
    background: rgba(107, 114, 128, 0.15) !important;
    border: 1px solid rgba(107, 114, 128, 0.25) !important;
    color: #9ca3af;
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-error {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
    color: #ef4444;
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
    color: #f59e0b;
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
    color: #10b981;
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.15) !important;
    border: 1px solid rgba(var(--accent-rgb, 99, 102, 241), 0.25) !important;
    color: var(--accent-color, #6366f1);
    box-shadow: 0 2px 4px -1px rgba(var(--accent-rgb, 99, 102, 241), 0.2), inset 0 1px 0 0 rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Reserve the gap between a state label and its trailing %. Inline-block
   dial-windows collapse adjacent whitespace, so add it back as margin. */
.dial-pct { margin-left: 0.35em; }

/* config-busy: the device's sync service is mid-flight on a config-mutating
   REST call. Fade buttons that would race with that write so two operators
   can't stomp each other. Pure CSS; the boolean comes from sync.state. */
@keyframes config-busy-spin { to { transform: rotate(360deg); } }
.config-action { transition: opacity 0.18s ease, filter 0.18s ease; }
body.config-busy .config-action,
body.config-busy .config-action * { pointer-events: none !important; }
body.config-busy .config-action {
    opacity: 0.35 !important;
    filter: saturate(0.6);
    cursor: not-allowed !important;
}

/* Watch-calendar-dial value swap (mirrors connect-client).
   line-height/height pinned to 1em with vertical-align:middle so the
   inline-block doesn't inflate the parent's line box and trigger any
   surrounding height transition on every tick. */
.dial-window {
    display: inline-block;
    position: relative;
    overflow: hidden;
    vertical-align: middle;
    line-height: 1;
    height: 1em;
    min-width: 1ch;
}
.dial-cell {
    display: block;
    height: 1em;
    line-height: 1;
    white-space: nowrap;
    will-change: transform, opacity;
}
.dial-swap {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    overflow: hidden;
}
.dial-swap-cell {
    display: block;
    will-change: transform, opacity;
}
.dial-entering { animation: dial-enter 0.35s cubic-bezier(0.4, 0, 0.2, 1) both; }
.dial-leaving {
    position: absolute !important;
    top: 0; left: 0;
    animation: dial-leave 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes dial-enter {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes dial-leave {
    from { transform: translateY(0);     opacity: 1; }
    to   { transform: translateY(-100%); opacity: 0; }
}

.peer-devices {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}


.storage-bar {
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.storage-bar .used {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.storage-bar.warning .used {
    background: #f59e0b;
}

.storage-bar.critical .used {
    background: #ef4444;
}

.net-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.net-row {
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
    transition: background 0.15s ease;
}

.net-row:hover {
    background: rgba(var(--accent-rgb), 0.08);
}

.net-row td {
    padding: 0.35rem;
    height: 3rem;
    vertical-align: middle;
    white-space: nowrap;
}

.net-col-dot {
    width: 1.25rem;
    padding-left: 0.5rem !important;
}

.net-col-dot .iface-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.net-col-name {
    width: 15%;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.2;
}

.net-col-ip {
    width: 14%;
    opacity: 0.7;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
}

.net-col-type {
    width: 16%;
    opacity: 0.55;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.net-col-flags {
    width: 5%;
    white-space: nowrap;
}

.net-badge {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    vertical-align: middle;
    margin-right: 0.2rem;
}

.net-badge-ad {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.net-badge-pt {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.net-badge-br {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.net-col-link {
    width: 14%;
    opacity: 0.45;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.net-edit-form {
    display: none;
    padding: 0.75rem;
    margin: 0.25rem 0 0.5rem 0;
    border-radius: 6px;
    background: rgba(var(--accent-rgb), 0.06);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
}

.net-edit-form.open {
    display: block;
}

.net-edit-form label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.2rem;
    margin-top: 0.5rem;
}

.net-edit-form label:first-child {
    margin-top: 0;
}

.net-edit-form select,
.net-edit-form input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.85rem;
    box-sizing: border-box;
}

.net-edit-form .net-save-btn {
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    border: none;
    background: var(--accent-color);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
}

.net-edit-form .net-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.net-edit-form .net-save-feedback {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.net-col-tp {
    width: 30%;
    position: relative;
    text-align: right;
    padding-right: 0.5rem !important;
    overflow: hidden;
}

.net-col-tp canvas {
    display: block;
    margin-left: auto;
    border-radius: 4px;
    background: rgba(var(--accent-rgb), 0.05);
}

.tp-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.1rem;
    line-height: 1;
}

.tp-speeds {
    font-size: 0.65rem;
    font-family: monospace;
    opacity: 0.7;
    white-space: nowrap;
}

.tp-totals {
    font-size: 0.65rem;
    font-family: monospace;
    opacity: 0.45;
    white-space: nowrap;
}

.tp-watermark {
    position: absolute;
    bottom: calc(100% + 2px);
    right: 0.5rem;
    font-size: 0.65rem;
    font-family: monospace;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.9);
    color: #e5e7eb;
    border-radius: 4px;
    pointer-events: none;
    display: none;
    z-index: 10;
}

.net-col-tp:hover .tp-watermark {
    display: block;
}

.bridge-chassis {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
}

.bridge-chassis-header .chassis-name {
    font-weight: 600;
    margin-right: 0.5rem;
}

.bridge-chassis-header .chassis-detail {
    opacity: 0.7;
    font-size: 0.85rem;
}

.bridge-chassis .version-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
    margin-left: 0.4rem;
    vertical-align: middle;
}

.bridge-section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.5;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.bridge-section-label:first-child {
    margin-top: 0;
}

.bridge-chassis-expandable {
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.bridge-chassis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.bridge-chassis-header:hover {
    background: rgba(var(--accent-rgb), 0.08);
}

.bridge-chassis-header .expand-icon {
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.bridge-chassis-header.expanded .expand-icon {
    transform: rotate(180deg);
}

.bridge-chassis-body {
    display: none;
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid rgba(var(--accent-rgb), 0.1);
}

.bridge-chassis-body.open {
    display: block;
}

.bridge-status-lights {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.bridge-status-light {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    opacity: 0.8;
}

.bridge-status-light .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.bridge-user-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
}

.bridge-user-item:last-child {
    border-bottom: none;
}

.bridge-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.bridge-user-header:hover {
    opacity: 0.8;
}

.bridge-workspaces {
    display: none;
    margin-top: 0.5rem;
    margin-left: 1rem;
}

.bridge-workspaces.open {
    display: block;
}

.bridge-workspace-item {
    padding: 0.5rem;
    background: rgba(var(--accent-rgb), 0.05);
    border-radius: 6px;
    margin-bottom: 0.35rem;
}

.bridge-workspace-item:last-child {
    margin-bottom: 0;
}

.bridge-workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.bridge-workspace-name {
    font-weight: 500;
}

.bridge-workspace-outid {
    font-size: 0.7rem;
    opacity: 0.5;
    font-family: monospace;
}

.bridge-workspace-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.bridge-workspace-bar .used {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.bridge-workspace-bar.warning .used {
    background: #f59e0b;
}

.bridge-workspace-bar.critical .used {
    background: #ef4444;
}

.bridge-workspace-bar.float .used {
    background: #10b981;
}

.bridge-workspace-capacity {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 0.2rem;
}

.bridge-configure-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.bridge-configure-btn:hover {
    background: var(--accent-color);
    color: white;
}

.bridge-edit-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.bridge-edit-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.bridge-remove-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bridge-remove-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.bridge-prod-btn {
    background: rgba(139, 92, 246, 0.15);
    border: none;
    cursor: pointer;
    width: 28px;
    height: 22px;
    padding: 0;
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: opacity 0.15s ease, background 0.15s ease;
    color: #a78bfa;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bridge-prod-btn:hover {
    opacity: 1;
    background: rgba(139, 92, 246, 0.3);
}

/* NX Modal */
.bridge-modal-overlay {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.bridge-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.bridge-modal {
    background: rgba(10, 10, 10, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    min-width: 400px;
    max-width: 500px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.2s ease-out;
}

.bridge-modal-overlay.open .bridge-modal {
    transform: scale(1) translateY(0);
}

html[data-theme="light"] .bridge-modal {
    background: rgba(255, 255, 255, 0.95);
}

.bridge-modal h3 {
    margin: 0 0 1rem 0;
    color: var(--accent-color);
}

.bridge-modal label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

.bridge-modal label:first-of-type {
    margin-top: 0;
}

.bridge-modal input[type="text"],
.bridge-modal input[type="password"] {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.bridge-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.bridge-modal-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
}

.bridge-modal-btn.primary {
    background: var(--accent-color);
    color: white;
}

.bridge-modal-btn.secondary {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--text-color);
}

.bridge-modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bridge-modal-btn .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bridge-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.35rem;
}

@keyframes bridge-spin {
    to { transform: rotate(360deg); }
}

.bridge-modal-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(var(--accent-rgb), 0.15);
}

.bridge-modal-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.bridge-modal input[type="number"] {
    width: 80px;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.85rem;
    box-sizing: border-box;
}

.bridge-modal-step { display: none; }
.bridge-modal-step.active { display: block; }

.bridge-modal .bridge-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.bridge-perm-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.bridge-perm-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.bridge-perm-badge.yes {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.bridge-feature-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.bridge-feature-row label {
    margin: 0 !important;
    display: inline !important;
    opacity: 1 !important;
    font-size: 0.85rem !important;
    cursor: pointer;
}

.bridge-feature-row input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.bridge-user-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-color);
}

.bridge-feature-tag {
    display: inline-block;
    font-size: 0.6rem;
    padding: 0.08rem 0.25rem;
    border-radius: 3px;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    margin-left: 0.2rem;
}

/* NX Bridge modal styles */
.bridge-ws-list {
    max-height: 450px;
    overflow-y: auto;
}

.bridge-section {
    margin-bottom: 0.75rem;
}

.bridge-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
    cursor: pointer;
    user-select: none;
}

.bridge-section-header .section-arrow {
    font-size: 0.6rem;
    transition: transform 0.15s;
}

.bridge-section.collapsed .section-arrow {
    transform: rotate(-90deg);
}

.bridge-section.collapsed .bridge-section-rows {
    display: none;
}

.bridge-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    background: rgba(var(--accent-rgb), 0.04);
    border: 1px solid rgba(var(--accent-rgb), 0.08);
    border-left: 3px solid transparent;
    font-size: 0.82rem;
    transition: opacity 0.2s ease, transform 0.25s ease, border-left-color 0.3s ease;
}

.bridge-ws-list.transitioning .bridge-row {
    opacity: 0;
    transform: translateY(-6px);
}

.bridge-section {
    transition: opacity 0.2s ease;
}

.bridge-ws-list.transitioning .bridge-section {
    opacity: 0;
}

@keyframes bridgeRowIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.bridge-row.row-enter {
    opacity: 0;
    animation: bridgeRowIn 0.25s ease forwards;
}

.bridge-row.status-linked { border-left-color: #10b981; }
.bridge-row.status-nx_only { border-left-color: #f59e0b; }
.bridge-row.status-connect_only { border-left-color: #3b82f6; }

.bridge-row .ws-name {
    flex: 1;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bridge-row .ws-name .ws-subname {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.5;
    margin-left: 0.4rem;
}

.bridge-row .ws-size {
    font-size: 0.72rem;
    opacity: 0.6;
    min-width: 55px;
    text-align: right;
}

.bridge-row .ws-action {
    min-width: 90px;
    text-align: right;
}

.bridge-row .ws-action .badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.bridge-row .ws-action .badge-linked {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.bridge-row .ws-action .badge-renamed {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.bridge-row .ws-action .badge-no-rw {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 600;
}

.bridge-row.no-rw {
    opacity: 0.7;
}

.bridge-row .ws-action button {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 500;
}

.bridge-row .ws-action button.promote {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.bridge-row .ws-action button.create {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.bridge-row .ws-action button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.bridge-row .ws-action .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(var(--accent-rgb), 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: bridge-spin 0.6s linear infinite;
}

@keyframes bridge-spin {
    to { transform: rotate(360deg); }
}

@keyframes bridge-row-appear {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.bridge-row { animation: bridge-row-appear 0.25s ease; }

.bridge-summary-bar {
    display: flex;
    height: 22px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    font-size: 0.68rem;
    font-weight: 600;
}

.bridge-summary-bar .seg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    white-space: nowrap;
    min-width: 70px;
    padding: 0 0.5rem;
    overflow: visible;
}

.bridge-summary-bar .seg-linked { background: #10b981; }
.bridge-summary-bar .seg-nx_only { background: #f59e0b; }
.bridge-summary-bar .seg-connect_only { background: #3b82f6; }

/* Encryption form styles */
.encryption-form-group {
    margin-bottom: 1rem;
}

.encryption-form-group label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
    margin-top: 0.5rem;
}

.encryption-form-group label:first-child {
    margin-top: 0;
}

.encryption-form-group input[type="password"],
.encryption-form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.encryption-form-group textarea {
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 80px;
}

.encryption-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}

.encryption-error.visible {
    display: block;
}

.mnemonic-display {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    padding: 1rem;
    background: rgba(var(--accent-rgb), 0.08);
    border-radius: 8px;
    line-height: 1.8;
    user-select: all;
    -webkit-user-select: all;
    word-spacing: 0.3rem;
}

.mnemonic-warning {
    padding: 0.75rem 1rem;
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 0 6px 6px 0;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.encryption-section-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    gap: 1rem;
}

.encryption-section-divider::before,
.encryption-section-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid rgba(var(--accent-rgb), 0.2);
}

.encryption-section-divider span {
    opacity: 0.5;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Stored Keys Dropdown */
.stored-keys-wrapper {
    position: relative;
    display: inline-block;
}

.stored-keys-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 260px;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 8px;
    padding: 0.25rem 0;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

html[data-theme="light"] .stored-keys-menu {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stored-keys-menu.open {
    display: block;
}

.stored-keys-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-color);
    transition: background 0.15s;
}

.stored-keys-item:hover {
    background: rgba(var(--accent-rgb), 0.1);
}

.stored-keys-item.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

.stored-keys-item .stored-keys-hint {
    display: block;
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 2px;
}

/* Floating device hero */
.device-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 320px;
    margin-bottom: 0.5rem;
    overflow: visible;
}

.device-hero-cloud {
    position: absolute;
    width: 520px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.18) 0%, rgba(139, 92, 246, 0.06) 50%, transparent 70%);
    filter: blur(18px);
    bottom: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease-in;
}

.device-hero-cloud.visible {
    opacity: 1;
}

.device-hero-float {
    position: relative;
    z-index: 1;
    animation: deviceFloat 6s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.6s ease-in;
}

.device-hero-float.visible {
    opacity: 1;
}

@keyframes deviceFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.device-hero-svg {
    width: 320px;
    height: 280px;
    display: block;
    filter: drop-shadow(0 8px 24px rgba(139, 92, 246, 0.25));
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #fff;
    background: rgba(30, 30, 40, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 320px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.hide { opacity: 0; transform: translateX(20px); }

/* Card fade-in on page load */
.card.mb-4 {
    opacity: 0;
    transform: translateY(8px);
    animation: cardFadeIn 0.35s ease forwards;
}

@keyframes cardFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

/* Stagger cards in left and right columns */
.card.mb-4:nth-child(1) { animation-delay: 0.04s; }
.card.mb-4:nth-child(2) { animation-delay: 0.08s; }
.card.mb-4:nth-child(3) { animation-delay: 0.12s; }
.card.mb-4:nth-child(4) { animation-delay: 0.16s; }
.card.mb-4:nth-child(5) { animation-delay: 0.20s; }
.card.mb-4:nth-child(6) { animation-delay: 0.24s; }
.card.mb-4:nth-child(7) { animation-delay: 0.28s; }

/* Smooth card height transitions */
.card-content {
    overflow: hidden;
}

/* Standalone spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(var(--accent-rgb), 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: bridge-spin 0.6s linear infinite;
    vertical-align: middle;
}

/* ── Timeline Modal ── */

.timeline-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.15);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.timeline-tab {
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 6px;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
}

.timeline-tab:hover {
    opacity: 0.85;
    background: rgba(var(--accent-rgb), 0.08);
}

.timeline-tab.active {
    opacity: 1;
    background: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Range selector pills */
.timeline-range-selector {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.timeline-range-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    border-radius: 4px;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0.5;
}

.timeline-range-btn.active {
    opacity: 1;
    background: rgba(var(--accent-rgb), 0.12);
    border-color: var(--accent-color);
}

/* Overall view — production bars */
.timeline-overall {
    position: relative;
    min-height: 60px;
}

.timeline-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    opacity: 0.5;
    margin-bottom: 0.5rem;
    padding: 0 2px;
}

.timeline-bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.timeline-bar-label {
    font-size: 0.75rem;
    min-width: 120px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.8;
}

.timeline-bar-track {
    flex: 1;
    height: 22px;
    background: rgba(var(--accent-rgb), 0.05);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.timeline-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    min-width: 3px;
    cursor: default;
}

.timeline-bar.active {
    background: var(--accent-color);
    opacity: 0.9;
}

.timeline-bar.deactivated {
    background: var(--accent-color);
    opacity: 0.3;
}

.timeline-bar-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    white-space: nowrap;
    pointer-events: none;
    display: none;
    z-index: 10;
}

.timeline-bar:hover .timeline-bar-tooltip {
    display: block;
}

/* Session heatmap */
.timeline-heatmap {
    overflow-x: auto;
}

.timeline-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.timeline-stat-value {
    font-weight: 600;
    color: var(--accent-color);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: 80px repeat(24, 1fr);
    gap: 1px;
    font-size: 0.6rem;
}

.heatmap-header {
    text-align: center;
    opacity: 0.5;
    padding: 2px;
    font-size: 0.6rem;
}

.heatmap-date {
    padding: 2px 4px;
    opacity: 0.6;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
}

.heatmap-cell {
    aspect-ratio: 1;
    min-height: 14px;
    border-radius: 2px;
    background: rgba(var(--accent-rgb), 0.04);
    position: relative;
    cursor: default;
}

.heatmap-cell.connected {
    background: #22c55e;
    opacity: 0.75;
}

.heatmap-cell.partial {
    background: #22c55e;
    opacity: 0.4;
}

.heatmap-cell-tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.25rem 0.4rem;
    border-radius: 3px;
    font-size: 0.6rem;
    white-space: nowrap;
    pointer-events: none;
    display: none;
    z-index: 10;
}

.heatmap-cell:hover .heatmap-cell-tooltip {
    display: block;
}

.timeline-empty {
    text-align: center;
    padding: 2rem;
    opacity: 0.5;
    font-size: 0.85rem;
}

.timeline-loading {
    text-align: center;
    padding: 2rem;
}

html[data-theme="light"] .timeline-bar-tooltip,
html[data-theme="light"] .heatmap-cell-tooltip,
html[data-theme="light"] .tp-watermark {
    background: rgba(30, 30, 30, 0.95);
}
