:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

body.app-shell {
    display: block;
    padding: 24px 24px 40px;
    overflow-y: auto;
}

body.centered {
    display: flex;
    justify-content: center;
    align-items: center;
}

body.auth-shell {
    padding: 24px;
}

.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0f172a 100%);
    z-index: -1;
}

.glow-circle {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--primary);
    filter: blur(150px);
    opacity: 0.15;
    border-radius: 50%;
    animation: drift 20s infinite alternate linear;
}

.glow-circle-left {
    top: -10%;
    left: -10%;
}

.glow-circle-right {
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes drift {
    from { transform: translate(-10%, -10%); }
    to { transform: translate(10%, 10%); }
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: fadeIn 0.8s ease-out;
}

.auth-card {
    max-width: 440px;
    padding: 36px 34px;
}

.auth-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 28px;
}

.auth-title {
    margin-bottom: 0;
}

.auth-subtitle {
    margin-bottom: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-caption {
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    color: #dbe4f3;
}

.auth-caption-muted {
    color: var(--text-muted);
}

.auth-qr-frame {
    margin: 20px auto 24px;
    background: #ffffff;
    padding: 10px;
    border-radius: 12px;
    width: max-content;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
}

.auth-submit {
    margin-top: 4px;
}

.page-shell {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
}

.page-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-header {
    position: static;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.18);
}

.page-header.compact {
    padding: 18px 22px;
}

.page-title-block {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    min-height: 108px;
    min-width: 0;
}

.page-eyebrow {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.9);
    font-weight: 700;
}

.page-title-block h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    text-align: left;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    max-width: 68ch;
    min-height: 3.2em;
}

.page-header-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-intro-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: -6px;
}

.page-intro-meta a {
    color: #cbd5e1;
    text-decoration: none;
}

.page-intro-meta a:hover {
    color: var(--text-main);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.page-split {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.dashboard-overview-grid {
    align-items: stretch;
}

.stack-grid {
    display: grid;
    gap: 16px;
}

.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.dashboard-card,
.form-card,
.surface-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.14);
}

.dashboard-overview-grid .dashboard-card {
    display: flex;
    flex-direction: column;
    min-height: 276px;
}

.dashboard-chart-area {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-height: 220px;
    height: 220px;
}

.dashboard-chart-area canvas {
    width: 100% !important;
    height: 100% !important;
}

.dashboard-chart-area-centered {
    justify-content: center;
}

.surface-card.tight {
    padding: 20px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading h2,
.section-heading h3,
.section-heading h4 {
    margin: 0;
}

.section-meta {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.82);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.form-grid .full-span {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.inline-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.helper-text {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 8px;
}

.text-muted {
    color: var(--text-muted);
}

.text-accent {
    color: #60a5fa;
}

.text-success {
    color: #34d399;
}

.text-danger {
    color: #fca5a5;
}

.text-strong {
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.page-notice {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.68);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.12);
}

.page-notice strong {
    font-size: 14px;
    line-height: 1.4;
}

.page-notice p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.page-notice-danger {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.22);
}

.page-notice-danger strong {
    color: #fca5a5;
}

.page-notice-success {
    border-color: rgba(52, 211, 153, 0.28);
    background: rgba(6, 95, 70, 0.22);
}

.page-notice-success strong {
    color: #6ee7b7;
}

.stack-note {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.stack-space-sm {
    margin-top: 12px;
}

.page-notice-info {
    border-color: rgba(96, 165, 250, 0.28);
    background: rgba(30, 64, 175, 0.22);
}

.page-notice-info strong {
    color: #93c5fd;
}

.app-btn,
a.app-btn,
button.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    margin: 0;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.app-btn:hover,
a.app-btn:hover,
button.app-btn:hover {
    transform: translateY(-1px);
}

.app-btn:active,
a.app-btn:active,
button.app-btn:active {
    transform: translateY(0);
}

.app-btn-block {
    width: 100%;
}

.app-btn-small {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
}

.app-btn-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 12px;
    position: relative;
    overflow: visible;
}

.app-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.app-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-btn-icon[data-tooltip]::after,
.app-btn-icon[data-tooltip]::before {
    position: absolute;
    left: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 40;
}

.app-btn-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(4px);
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.32);
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 600;
    white-space: nowrap;
}

.app-btn-icon[data-tooltip]::before {
    content: "";
    bottom: calc(100% + 6px);
    transform: translateX(-50%) translateY(4px);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(15, 23, 42, 0.96);
}

.app-btn-icon[data-tooltip]:hover::after,
.app-btn-icon[data-tooltip]:hover::before,
.app-btn-icon[data-tooltip]:focus-visible::after,
.app-btn-icon[data-tooltip]:focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.app-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.22);
}

.app-btn-primary:hover {
    background: linear-gradient(135deg, #5b61f6, #7c3aed);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.28);
}

.app-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.08);
}

.app-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.16);
}

.app-btn-danger {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.3);
}

.app-btn-danger:hover {
    background: rgba(239, 68, 68, 0.24);
    border-color: rgba(248, 113, 113, 0.4);
}

.app-btn-warning {
    background: rgba(251, 191, 36, 0.16);
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.3);
}

.app-btn-warning:hover {
    background: rgba(251, 191, 36, 0.24);
    border-color: rgba(251, 191, 36, 0.42);
}

.app-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.26);
    box-shadow: none;
}

.app-btn-ghost:hover {
    color: var(--text-main);
    border-color: rgba(148, 163, 184, 0.38);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: none;
}

.app-tab {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--glass-border);
    box-shadow: none;
}

.app-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

.app-tab.active,
.app-tab[aria-pressed="true"] {
    background: rgba(99, 102, 241, 0.16);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.38);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.08);
}

.inline-input-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.inline-input-row > * {
    margin-top: 0 !important;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #dbeafe;
    font-size: 13px;
    line-height: 1.4;
}

.app-chip-remove {
    cursor: pointer;
    color: #fca5a5;
    font-weight: 700;
}

.surface-pre {
    background: rgba(0, 0, 0, 0.24);
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 13px;
    color: #a78bfa;
}

.surface-pre-break {
    white-space: pre-wrap;
    word-break: break-word;
}

.surface-pre-compact {
    font-size: 12px;
    padding: 12px 14px;
}

.surface-pre-tall {
    max-height: 400px;
    overflow-y: auto;
}

.surface-pre-note {
    color: #c4b5fd;
}

.dialog-header,
.dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dialog-footer {
    margin-top: 20px;
}

.modal-dialog-card {
    background: rgba(15, 23, 42, 0.96);
}

.modal-dialog-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.modal-dialog-copy h2,
.modal-dialog-copy h3 {
    margin: 0;
}

.modal-dialog-note {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.mono-pill,
code {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 4px 10px;
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.4;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    word-break: break-all;
}

.mono-block {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    overflow-wrap: anywhere;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.status-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.status-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.status-info {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.2);
}

.status-neutral {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.2);
}

.check-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.check-toggle-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}

.check-toggle-box {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 7px;
    border: 2px solid rgba(148, 163, 184, 0.55);
    background: rgba(15, 23, 42, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.check-toggle-box::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid transparent;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0.8);
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.check-toggle-text {
    display: inline-flex;
    align-items: center;
    min-width: 78px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.check-toggle:hover .check-toggle-box {
    border-color: rgba(129, 140, 248, 0.8);
    transform: translateY(-1px);
}

.check-toggle-input:focus-visible + .check-toggle-box {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.9);
}

.check-toggle.is-checked .check-toggle-box {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: rgba(165, 180, 252, 0.95);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.22);
}

.check-toggle.is-checked .check-toggle-box::after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
    border-color: #ffffff;
}

.check-toggle.is-checked .check-toggle-text {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.42);
    color: #e0e7ff;
}

.check-toggle.is-unchecked .check-toggle-text {
    background: rgba(15, 23, 42, 0.7);
    color: #94a3b8;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 16px;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.textarea-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    color: #a5b4fc;
    background: rgba(0, 0, 0, 0.3);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
}

select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

/* Hide number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

button:active {
    transform: translateY(0);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 24px;
    text-align: center;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.info-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 24px;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

/* Toast System */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.5s ease;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid var(--primary); }

.toast.fade-out {
    opacity: 0;
    transform: translateX(40px);
}

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

/* Validation Styles */
input:invalid:not(:placeholder-shown) {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

input:invalid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.detail-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-row {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.detail-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    width: 160px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.detail-value {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    font-weight: 500;
}

.detail-value-strong {
    font-weight: 700;
}

.detail-value-accent {
    color: #60a5fa;
}

.detail-subsection-title {
    margin: 24px 0 16px;
    font-size: 16px;
    font-weight: 600;
}

.detail-empty-copy {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.status-text-info {
    color: #60a5fa;
}

.status-text-success {
    color: #34d399;
}

.status-text-danger {
    color: #f87171;
}

.status-text-neutral {
    color: var(--text-main);
}

.code-disclosure {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.code-disclosure summary {
    cursor: pointer;
    color: var(--text-muted);
    outline: none;
}

.timeline {
    position: relative;
    padding-left: 22px;
    margin-top: 10px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

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

.timeline-item::before {
    content: "";
    position: absolute;
    left: -26px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #60a5fa;
    border: 2px solid var(--bg-dark);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-title {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.timeline-meta {
    color: #64748b;
    font-weight: 400;
    font-size: 12px;
}

.timeline-desc {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
    line-height: 1.6;
}

.audit-details {
    display: none;
    margin-top: 12px;
}
/* Table & Management Styles */
.table-shell,
.glass-table-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 24px;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.14);
}

.table-shell-flush {
    margin-top: 0;
}

.entity-layout {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.entity-form-card {
    height: fit-content;
}

.entity-form-grid {
    display: grid;
    gap: 18px;
}

.entity-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.entity-toolbar-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entity-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.table-caption {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 22px 0;
}

.table-caption-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-caption-copy h2,
.table-caption-copy h3 {
    margin: 0;
    font-size: 18px;
}

.table-toolbar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 22px 0;
}

.dashboard-filter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-filter-label-row,
.dashboard-filter-control-row {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(260px, 320px) auto;
    gap: 14px 16px;
}

.dashboard-filter-label-row {
    align-items: end;
}

.dashboard-filter-control-row {
    align-items: start;
}

.dashboard-filter-head {
    display: flex;
    align-items: center;
    min-height: 20px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: rgba(203, 213, 225, 0.86);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.dashboard-filter-head-actions {
    justify-content: flex-end;
}

.dashboard-filter-control-slot {
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.dashboard-filter-control-slot > input {
    height: 50px;
    border-radius: 16px;
    font-size: 14px;
    box-sizing: border-box;
}

.dashboard-filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
}

.dashboard-filter-check input {
    width: auto;
    margin: 0;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    min-height: 50px;
}

.dashboard-filter-actions-cell {
    min-width: 0;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.filter-actions .app-btn {
    width: auto;
    margin-top: 0;
}

.dashboard-filter-action-btn {
    height: 50px;
    min-height: 50px;
    padding: 0 18px;
    border-radius: 16px;
    box-sizing: border-box;
}

.dashboard-calendar {
    position: relative;
    width: 100%;
}

.dashboard-calendar-trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    height: 50px;
    margin: 0;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dashboard-calendar-trigger:hover,
.dashboard-calendar.is-open .dashboard-calendar-trigger {
    border-color: rgba(129, 140, 248, 0.42);
    background: rgba(99, 102, 241, 0.08);
}

.dashboard-calendar-trigger-copy {
    display: flex;
    align-items: center;
    min-width: 0;
}

.dashboard-calendar-trigger-copy strong {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-calendar-trigger-copy span {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.dashboard-calendar-trigger-icon {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 14px;
    transition: transform 0.15s ease;
}

.dashboard-calendar.is-open .dashboard-calendar-trigger-icon {
    transform: rotate(180deg);
}

.dashboard-calendar-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(14, 18, 29, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.38);
}

.dashboard-calendar-panel[hidden] {
    display: none;
}

.dashboard-calendar-toolbar,
.dashboard-calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.dashboard-calendar-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-calendar-summary strong {
    font-size: 14px;
    color: var(--text-main);
}

.dashboard-calendar-summary span {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.dashboard-calendar-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-calendar-nav strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.dashboard-calendar-nav .app-btn {
    width: auto;
    margin-top: 0;
}

.dashboard-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 2px;
}

.dashboard-calendar-day {
    min-height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.dashboard-calendar-day:hover {
    border-color: rgba(129, 140, 248, 0.45);
    background: rgba(99, 102, 241, 0.1);
}

.dashboard-calendar-day.is-in-range {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(129, 140, 248, 0.28);
}

.dashboard-calendar-day.is-start,
.dashboard-calendar-day.is-end,
.dashboard-calendar-day.is-single {
    background: rgba(99, 102, 241, 0.82);
    border-color: rgba(129, 140, 248, 0.95);
    color: #fff;
}

.dashboard-calendar-day-empty {
    visibility: hidden;
    pointer-events: none;
}

.dashboard-toolbar-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 4px;
    padding-bottom: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.dashboard-json-dialog {
    width: 100%;
    max-width: 800px;
    margin: auto;
}

.dashboard-json-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-json-dialog-header h3 {
    margin: 0;
    font-size: 18px;
}

.page-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.page-chip-row .mono-pill,
.page-chip-row .table-option-chip {
    min-width: 40px;
    min-height: 32px;
    box-sizing: border-box;
}

.table-option-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.table-option-chip:hover {
    color: var(--text-main);
    border-color: rgba(129, 140, 248, 0.45);
}

.table-pagination {
    display: flex;
    justify-content: flex-end;
    padding: 18px 22px 22px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.table-caption-copy p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 720px;
}

th {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: top;
    position: static;
}

td {
    padding: 16px 18px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    vertical-align: top;
}

tbody td {
    vertical-align: middle;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
    width: auto;
    margin: 0;
    white-space: nowrap;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Navigation Menu Buttons */
.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 10px !important;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.lang-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background 0.2s ease, color 0.2s ease;
}

.lang-switch a:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.lang-switch a.active,
.lang-switch a[aria-current="page"] {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.18);
}

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

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    white-space: nowrap;
    flex: 0 0 auto;
}

.nav-links a.active,
.nav-links a[aria-current="page"] {
    color: var(--text-main) !important;
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(129, 140, 248, 0.28);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.08);
}

.nav-links a.nav-link-danger {
    color: #fca5a5;
}

.nav-links a.nav-link-danger:hover {
    color: #fecaca !important;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(248, 113, 113, 0.24);
}

.nav-links a:hover {
    color: var(--text-main) !important;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: none;
    box-shadow: none;
}

.nav-links a:active {
    transform: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 6, 23, 0.82);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-open {
    display: flex;
    padding: 24px;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    padding: 32px;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.32);
}

.modal-content-wide {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.target-editor-modal {
    width: min(1040px, calc(100vw - 64px));
    max-width: 1040px;
    max-height: calc(100vh - 48px);
    padding: 34px 36px;
}

.modal-content-compact {
    max-width: 640px;
}

.modal-close-row {
    margin-bottom: 24px;
}

.modal-copy-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
}

.settings-hero a {
    color: #93c5fd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.settings-hero a:hover {
    color: #dbeafe;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.editor-grid .full-span {
    grid-column: 1 / -1;
}

.editor-grid .form-group,
.editor-section .form-group,
.template-search-card .form-group {
    margin-bottom: 0;
}

.target-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 8px;
}

.target-editor-header-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.target-editor-header-copy h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
}

.target-editor-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.preset-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.preset-chip {
    background: rgba(255,255,255,0.06);
    color: #cbd5e1;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.readonly-value {
    padding: 12px 16px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-muted);
    min-height: 46px;
    display: flex;
    align-items: center;
}

.table-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.table-note strong {
    color: var(--text-main);
}

.target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

.target-card {
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 22px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.16);
}

.target-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.target-card-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.target-card-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.target-card-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.target-identity-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.target-summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.target-summary-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.target-summary-item strong {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.9);
}

.target-channel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.target-channel-form {
    grid-template-columns: 1fr;
    gap: 18px;
}

.target-channel-form .form-group {
    min-width: 0;
}

.target-channel-card,
.editor-section,
.template-group-card,
.protocol-tree-card {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    padding: 18px;
}

.editor-section {
    padding: 22px;
}

.target-channel-card.disabled {
    opacity: 0.72;
    border-style: dashed;
}

.target-channel-head,
.editor-section-head,
.template-group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.target-channel-head h4,
.editor-section-head h3,
.template-group-copy h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.target-channel-head p,
.editor-section-head p,
.template-group-meta {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.target-kv {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.target-kv-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.target-kv-label {
    color: rgba(148, 163, 184, 0.9);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.target-kv-value {
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.target-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding-top: 4px;
}

.target-card-actions .app-btn,
.action-row .app-btn {
    width: auto;
    margin-top: 0;
}

.channel-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.channel-toggle-card {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.channel-toggle-card label {
    margin: 0;
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.channel-toggle-card input[type="checkbox"] {
    width: auto;
    margin: 2px 0 0;
}

.channel-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.channel-toggle-copy strong {
    font-size: 14px;
    font-weight: 600;
}

.channel-toggle-copy span {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.editor-section .helper-box:first-child {
    margin-top: 0;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.target-editor-actions {
    padding-top: 18px;
    margin-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

[v-cloak] {
    display: none;
}

.input-field {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    width: 100%;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: #6366f1;
    outline: none;
}

.template-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 20px;
    align-items: start;
}

.template-group-grid,
.template-tree-grid {
    display: grid;
    gap: 16px;
}

.template-group-card.is-nested {
    margin-left: 28px;
}

.template-group-card.is-locked {
    opacity: 0.68;
    border-color: rgba(148, 163, 184, 0.08);
}

.template-group-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.template-group-description {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.55;
    max-width: 72ch;
}

.template-group-lock-note {
    color: #fbbf24;
    font-size: 12px;
    line-height: 1.5;
}

.template-group-actions,
.template-search-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.template-group-actions .check-toggle {
    min-width: 168px;
}

.template-group-actions .check-toggle-text {
    min-width: 92px;
}

.template-selector-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}

.template-selector-col-toggle {
    width: 150px;
}

.template-selector-col-source {
    width: 36%;
}

.template-selector-col-export {
    width: 34%;
}

.template-selector-col-kind {
    width: 140px;
}

.template-selector-table th,
.template-selector-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

.template-selector-table th {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
    text-align: left;
}

.template-selector-table td {
    overflow-wrap: anywhere;
}

.template-selector-table tbody tr:last-child td {
    border-bottom: none;
}

.template-field-row {
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.template-field-row.is-enabled {
    background: rgba(99, 102, 241, 0.08);
    box-shadow: inset 3px 0 0 rgba(129, 140, 248, 0.85);
}

.template-field-row.is-container-row {
    background: rgba(148, 163, 184, 0.07);
}

.template-field-row.is-disabled {
    opacity: 0.86;
}

.field-toggle-cell {
    width: 150px;
    min-width: 150px;
    text-align: left;
    accent-color: #6366f1;
}

.field-toggle-cell .check-toggle {
    width: 100%;
}

.field-toggle-cell .check-toggle.is-disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.field-path {
    color: #a5b4fc;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.field-path strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #e2e8f0;
    font-family: 'Inter', sans-serif;
}

.field-path small {
    display: block;
    margin-top: 6px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
    word-break: normal;
}

.field-export-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #e2e8f0;
    word-break: break-all;
}

.field-kind {
    color: var(--text-muted);
}

.field-kind-note {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #64748b;
}

.field-kind-note.is-emphasis {
    color: #cbd5e1;
}

.template-search-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.protocol-tree-list,
.protocol-tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.protocol-tree-node + .protocol-tree-node {
    margin-top: 10px;
}

.protocol-tree-children {
    margin-top: 10px;
    margin-left: 18px;
    padding-left: 16px;
    border-left: 1px solid rgba(148, 163, 184, 0.14);
}

.protocol-tree-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.3);
}

.protocol-tree-row.is-branch {
    background: rgba(59, 130, 246, 0.07);
}

.protocol-tree-row.is-leaf {
    background: rgba(15, 23, 42, 0.2);
}

.protocol-tree-row.is-selected {
    border-color: rgba(99, 102, 241, 0.46);
    box-shadow: inset 3px 0 0 rgba(129, 140, 248, 0.85);
}

.protocol-tree-toggle {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}

.protocol-tree-spacer {
    width: 28px;
    height: 28px;
}

.protocol-tree-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.protocol-tree-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.protocol-tree-title {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
}

.protocol-tree-kind {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.protocol-tree-path-label {
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.protocol-tree-path {
    font-size: 12px;
    color: #cbd5e1;
    word-break: break-word;
    line-height: 1.5;
}

.protocol-tree-key {
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    color: #7c8aa5;
    word-break: break-all;
    line-height: 1.5;
}

.protocol-tree-description {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

.protocol-tree-check,
.protocol-tree-expand {
    align-self: center;
}

.protocol-tree-check .check-toggle-text {
    min-width: 86px;
}

.preview-input {
    max-width: 320px;
}

@media (max-width: 960px) {
    body.app-shell {
        padding: 16px;
    }

    .page-header {
        padding: 18px;
    }

    .page-title-block {
        min-height: 0;
    }

    .page-subtitle {
        min-height: 0;
    }

    .page-split,
    .card-grid-2,
    .detail-grid-2,
    .form-grid,
    .entity-layout,
    .field-grid-2,
    .scope-grid,
    .settings-hero,
    .editor-grid,
    .target-channel-grid,
    .target-summary-strip,
    .channel-toggle-grid,
    .template-overview,
    .dashboard-filter-label-row,
    .dashboard-filter-control-row {
        grid-template-columns: 1fr;
    }

    .dashboard-toolbar-meta,
    .table-pagination {
        justify-content: flex-start;
    }

    .dashboard-filter-head-actions {
        justify-content: flex-start;
    }

    .filter-actions {
        justify-content: flex-start;
        min-height: 0;
    }

    .page-actions,
    .nav-links {
        justify-content: flex-start;
    }

    .page-header-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-calendar-panel {
        width: 100%;
    }

    .template-selector-table {
        table-layout: auto;
    }

    .template-group-card.is-nested {
        margin-left: 0;
    }

    .lang-switch {
        align-self: flex-start;
    }

    .page-title-block h1 {
        font-size: 24px;
    }

    .dashboard-card,
    .form-card,
    .surface-card {
        padding: 20px;
    }

    .entity-toolbar,
    .table-caption,
    .target-card-header,
    .template-group-header,
    .target-editor-header,
    .editor-layout,
    .editor-mode-switch {
        flex-direction: column;
    }

    .editor-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding-right: 0;
        padding-bottom: 20px;
    }

    .detail-row {
        flex-direction: column;
        gap: 6px;
    }

    .detail-label {
        width: auto;
    }

    .clock-grid {
        grid-template-columns: 1fr;
    }
}

.secret-box {
    background: rgba(0,0,0,0.3);
    border: 1px dashed var(--primary);
    padding: 16px;
    border-radius: 12px;
    font-family: monospace;
    font-size: 18px;
    text-align: center;
    margin: 20px 0;
    color: var(--primary);
    word-break: break-all;
}

.table-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.table-col-actions,
.row-actions-cell {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}

.table-row {
    transition: background-color 0.18s ease;
}

.table-row.is-row-active td {
    background: rgba(99, 102, 241, 0.05);
}

.table-row-interactive {
    cursor: pointer;
}

.table-row-interactive:focus-visible {
    outline: 2px solid rgba(129, 140, 248, 0.6);
    outline-offset: -2px;
}

.table-actions-reveal {
    justify-content: flex-end;
    align-items: center;
    opacity: 0;
    transform: translateX(4px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.table-actions-reveal .app-btn {
    position: relative;
    z-index: 1;
}

.table-row:hover .table-actions-reveal,
.table-row:focus-within .table-actions-reveal,
.table-row.is-row-active .table-actions-reveal {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

@media (hover: none), (max-width: 960px) {
    .table-actions-reveal {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}

.table-actions form {
    margin: 0;
}

.table-inline-note {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.metric-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-value {
    font-size: 15px;
    color: var(--text-main);
    font-weight: 600;
}

.metric-value-light {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

.table-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-meta-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-meta-list .table-inline-note {
    margin-top: 0;
}

.target-list-delivery,
.target-list-slice {
    gap: 8px;
}

.target-list-delivery-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.target-list-delivery-label {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.9);
}

.target-list-delivery-value {
    min-width: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-main);
    word-break: break-word;
}

.table-status-note {
    font-weight: 600;
}

.table-value-muted {
    color: #94a3b8;
}

.table-value-strong {
    font-weight: 600;
}

.table-placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.field-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.scope-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.scope-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
    user-select: none;
}

.scope-card:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

.scope-card.active {
    background: rgba(79, 70, 229, 0.15);
    border-color: rgba(79, 70, 229, 0.5);
    box-shadow: 0 2px 10px -2px rgba(79, 70, 229, 0.14);
}

.scope-card input[type="checkbox"] {
    display: none;
}

.scope-icon-wrapper {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    position: relative;
    margin-top: 2px;
}

.scope-card.active .scope-icon-wrapper {
    background: #4f46e5;
    border-color: #4f46e5;
}

.scope-card.active .scope-icon-wrapper::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.scope-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.scope-title {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    transition: color 0.2s;
}

.scope-card.active .scope-title {
    color: #ffffff;
}

.scope-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    transition: color 0.2s;
}

.scope-card.active .scope-desc {
    color: rgba(165, 180, 252, 0.9);
}

.form-check-card {
    margin-top: 0;
}

.form-check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.form-check-inline input[type="checkbox"],
.channel-toggle-card input[type="checkbox"] {
    width: auto;
    margin: 0;
    appearance: auto;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
}

.field-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 8px;
}

.helper-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.section-divider {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

.center-empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.editor-meta-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.editor-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-meta-label {
    font-size: 12px;
    color: var(--text-muted);
}

.editor-mode-switch {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 24px;
}

.editor-layout {
    display: flex;
    gap: 32px;
}

.editor-sidebar {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid var(--glass-border);
    padding-right: 24px;
}

.editor-sidebar-title,
.editor-panel-title {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
}

.editor-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.editor-group-name {
    font-weight: 500;
}

.editor-group-count {
    float: right;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

.editor-main {
    flex-grow: 1;
    min-width: 0;
}

.editor-empty-state {
    color: var(--text-muted);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.2);
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    border: 1px dashed var(--glass-border);
}

.editor-surface {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.editor-field-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.field-cell-center {
    text-align: center;
}

.field-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.field-source-path {
    color: #a5b4fc;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.field-value-kind {
    color: var(--text-muted);
}

.field-disabled {
    opacity: 0.5;
}

.preview-panel {
    margin-top: 40px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.preview-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.preview-tag {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 100px;
}

.advanced-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.advanced-editor textarea {
    height: 400px;
    margin-bottom: 24px;
}

.editor-savebar {
    margin-top: 32px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}
