:root {
    /* Surfaces & neutrals (slate scale) */
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --surface-3: #f8fafc;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --line: #e6ebf1;
    --line-strong: #d4dce5;

    /* Brand */
    --primary: #0d9488;
    --primary-strong: #0f766e;
    --primary-deep: #115e59;
    --primary-soft: #ecfdf9;
    --primary-ring: rgba(13, 148, 136, 0.18);
    --gradient-brand: linear-gradient(135deg, #14b8a6 0%, #0d9488 50%, #0f766e 100%);

    /* Accents */
    --blue: #2563eb;
    --green: #16a34a;
    --gold: #d97706;
    --violet: #7c3aed;
    --red: #dc2626;

    /* Radii */
    --radius-lg: 18px;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;

    /* Shadows (soft, layered) */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.14), 0 6px 16px rgba(15, 23, 42, 0.08);
    --shadow-brand: 0 10px 24px rgba(13, 148, 136, 0.32);
}

* {
    box-sizing: border-box;
}

*::selection {
    background: var(--primary-ring);
    color: var(--primary-deep);
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 12% -10%, rgba(20, 184, 166, 0.10), transparent 60%),
        radial-gradient(1000px 600px at 100% 0%, rgba(37, 99, 235, 0.07), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.material-icons {
    font-family: "Material Icons Round";
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-feature-settings: "liga";
    font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

a {
    color: var(--primary-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
p {
    margin: 0;
}

/* Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: #b8c2cf;
    background-clip: content-box;
}

/* ---------- Auth ---------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 38px 34px;
    box-shadow: var(--shadow-lg);
    display: grid;
    gap: 6px;
    animation: rise 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-panel h1 {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 18px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--gradient-brand);
    color: #fff;
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0;
    box-shadow: var(--shadow-brand);
    margin-bottom: 8px;
}

.brand-mark.small {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 0;
}

.login-form,
.form-grid {
    display: grid;
    gap: 16px;
}

.login-form {
    margin-top: 8px;
}

.login-form label,
.form-grid label {
    display: grid;
    gap: 8px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface-3);
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

textarea {
    resize: vertical;
    line-height: 1.55;
}

input:focus,
textarea:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

/* ---------- App shell ---------- */
.app-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px;
}

.topbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 14px;
    z-index: 20;
}

.topbar-left,
.topbar-actions,
.brand-lockup,
.toolbar,
.segmented,
.load-row {
    display: flex;
    align-items: center;
}

.topbar-left {
    gap: 16px;
}

.brand-lockup {
    gap: 12px;
}

.topbar-actions {
    gap: 8px;
}

.toolbar,
.segmented {
    gap: 8px;
}

.topbar h1 {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
}

.subtle,
.status-line {
    color: var(--muted);
    font-size: 12.5px;
}

.version-pill,
.platform-chip {
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--text-2);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

.version-pill {
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.version-pill:hover {
    background: var(--primary-soft);
    border-color: #9fe3d8;
    color: var(--primary-deep);
}

/* ---------- Header layout + last message ---------- */
.app-header {
    display: grid;
    gap: 14px;
}

.last-message {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.last-message:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}

.last-message:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.last-message.is-empty {
    cursor: default;
    box-shadow: var(--shadow-xs);
}

.last-message.is-empty:hover {
    transform: none;
    box-shadow: var(--shadow-xs);
    border-color: var(--line);
}

.lm-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
}

.lm-icon .material-icons {
    font-size: 26px;
}

.last-message.is-empty .lm-icon {
    background: var(--surface-2);
    color: var(--muted);
}

.lm-main {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.lm-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lm-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--muted);
}

.lm-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

.lm-time .material-icons {
    font-size: 15px;
}

.lm-message {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.lm-message.muted {
    color: var(--muted);
    font-weight: 400;
}

.lm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.lm-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
}

.lm-chip .material-icons {
    font-size: 15px;
    color: var(--muted);
    flex-shrink: 0;
}

.lm-chip > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lm-sender {
    background: var(--primary-soft);
    border-color: #c4ece4;
    color: var(--primary-deep);
}

.lm-sender .material-icons {
    color: var(--primary);
}

/* ---------- Summary cards ---------- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 20px 0;
}

.summary-card {
    position: relative;
    display: grid;
    grid-template-columns: 50px 1fr;
    grid-template-rows: auto auto;
    gap: 0 14px;
    align-items: center;
    min-height: 96px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.summary-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
    opacity: 0.85;
}

.summary-card.accent-green::before  { background: var(--green); }
.summary-card.accent-blue::before   { background: var(--blue); }
.summary-card.accent-gold::before   { background: var(--gold); }
.summary-card.accent-violet::before { background: var(--violet); }

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}

.summary-card .material-icons {
    grid-row: span 2;
    width: 50px;
    height: 50px;
    font-size: 24px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
}

.summary-card strong {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
}

.summary-card small {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
}

.summary-card.accent-green .material-icons {
    background: #dcfce7;
    color: var(--green);
}

.summary-card.accent-blue .material-icons {
    background: #dbeafe;
    color: var(--blue);
}

.summary-card.accent-gold .material-icons {
    background: #fef3c7;
    color: var(--gold);
}

.summary-card.accent-violet .material-icons {
    background: #ede9fe;
    color: var(--violet);
}

/* ---------- Workspace ---------- */
.workspace {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 18px;
}

.rail {
    display: grid;
    align-content: start;
    gap: 8px;
    position: sticky;
    top: 100px;
}

.rail-button,
.segment,
.btn,
.icon-btn {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease,
        box-shadow 140ms ease, transform 120ms ease;
}

.rail-button {
    min-height: 50px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 14px;
}

.rail-button .material-icons {
    color: var(--muted);
    transition: color 140ms ease;
}

.rail-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
}

.rail-button.active,
.segment.active {
    background: var(--primary-soft);
    color: var(--primary-deep);
    border-color: #9fe3d8;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.08);
}

.rail-button.active .material-icons {
    color: var(--primary);
}

.content-panel {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.toolbar {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.search-field {
    min-width: min(340px, 100%);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    background: var(--surface-3);
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.search-field:focus-within {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.search-field .material-icons {
    color: var(--muted);
    font-size: 20px;
}

.search-field input {
    border: 0;
    background: transparent;
    padding-inline: 0;
}

.search-field input:focus {
    outline: none;
    box-shadow: none;
}

.segmented {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}

.segment {
    min-height: 36px;
    padding: 0 14px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 8px;
    color: var(--muted);
}

.segment:hover {
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.7);
}

.segment.active {
    background: var(--surface);
    color: var(--primary-deep);
    border-color: var(--line);
    box-shadow: var(--shadow-xs);
}

.status-line {
    min-height: 20px;
    margin: 6px 2px 14px;
    font-weight: 500;
}

/* ---------- Video grid ---------- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
    gap: 16px;
}

.video-card {
    min-width: 0;
    display: grid;
    grid-template-rows: 160px auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 180ms ease, border-color 180ms ease;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}

.thumb {
    position: relative;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    overflow: hidden;
}

.thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.18), transparent 45%);
    opacity: 0;
    transition: opacity 180ms ease;
}

.video-card:hover .thumb::after {
    opacity: 1;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.video-card:hover .thumb img {
    transform: scale(1.05);
}

.thumb-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #94a3b8;
}

.thumb-fallback .material-icons {
    font-size: 44px;
}

.card-body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.card-title {
    min-height: 42px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.card-url {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
}

.chip-row,
.metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid transparent;
}

.chip.active {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.chip.configured {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.chip.remote-active {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

.metric-row {
    padding-top: 4px;
    border-top: 1px solid var(--line);
    margin-top: 2px;
}

.metric-row span {
    color: var(--muted);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
}

.metric-row span + span::before {
    content: "•";
    margin: 0 8px 0 2px;
    color: var(--line-strong);
}

.load-row {
    justify-content: center;
    min-height: 64px;
    margin-top: 8px;
}

/* ---------- Buttons ---------- */
.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.btn .material-icons {
    font-size: 19px;
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-brand);
}

.btn.primary:hover {
    filter: brightness(1.04);
    box-shadow: 0 12px 28px rgba(13, 148, 136, 0.38);
}

.btn.secondary {
    background: var(--primary-soft);
    border-color: #c4ece4;
    color: var(--primary-deep);
}

.btn.secondary:hover {
    background: #d7f6ef;
    border-color: #9fe3d8;
}

.btn.ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--text-2);
}

.btn.ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--red);
}

.btn.danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--text-2);
}

.icon-btn:hover {
    background: var(--surface-2);
    color: var(--primary-deep);
    border-color: var(--line-strong);
}

/* ---------- Modal ---------- */
.modal {
    width: min(940px, calc(100vw - 32px));
    border: 0;
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow-lg);
    background: transparent;
    overflow: visible;
}

.small-modal {
    width: min(780px, calc(100vw - 32px));
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal[open] {
    animation: modalIn 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
    display: grid;
    gap: 20px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.modal-header,
.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.modal-header {
    align-items: start;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.modal-header > div {
    display: grid;
    gap: 8px;
}

.modal-header h2 {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
}

.platform-chip {
    justify-self: start;
    background: var(--primary-soft);
    color: var(--primary-deep);
    border-color: #c4ece4;
}

.platform-chip.neutral {
    background: var(--surface-2);
    color: var(--muted);
    border-color: var(--line-strong);
}

#modal-url {
    display: block;
    max-width: 720px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 13px;
}

.modal-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.modal-metrics div {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
}

.modal-metrics strong {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
}

.modal-metrics span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

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

.form-grid label:first-child,
.form-grid label:nth-child(2),
.form-grid .wide {
    grid-column: 1 / -1;
}

.modal-footer {
    align-items: center;
    flex-wrap: wrap;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.switch-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    font-weight: 600;
    color: var(--text-2);
}

.switch-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ---------- Changelog ---------- */
.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: min(68vh, 720px);
    overflow-y: auto;
    padding: 2px 6px 2px 2px;
}

.version-block {
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.version-block.current {
    border-color: #9fe3d8;
    box-shadow: var(--shadow-md);
}

.version-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface-3);
    border-bottom: 1px solid var(--line);
}

.version-block.current .version-head {
    background: var(--primary-soft);
    border-bottom-color: #c4ece4;
}

.version-badge {
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    min-width: 58px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    color: var(--text);
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0;
}

.version-block.current .version-badge {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-brand);
}

.version-titles {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 4px;
}

.version-titles h3 {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--text);
}

.version-titles p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.version-tag {
    flex-shrink: 0;
    align-self: center;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.version-body {
    display: grid;
    gap: 16px;
    padding: 16px 18px;
}

.release-section {
    display: grid;
    gap: 8px;
}

.release-section h4 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--primary-deep);
}

.release-section h4::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.release-section ul {
    margin: 0;
    padding-left: 22px;
    color: var(--text-2);
    line-height: 1.6;
    font-size: 13.5px;
}

.release-section li + li {
    margin-top: 6px;
}

.release-section li::marker {
    color: var(--line-strong);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    background: #0f172a;
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 200ms ease, transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 60;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.form-error {
    min-height: 18px;
    color: var(--red);
    font-size: 13px;
    font-weight: 500;
}

/* ---------- Empty state ---------- */
.empty-state {
    grid-column: 1 / -1;
    min-height: 260px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-3);
    font-weight: 500;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .summary-grid,
    .modal-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .rail {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 12px;
    }

    .topbar,
    .toolbar,
    .modal-header,
    .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions,
    .segmented {
        width: 100%;
        flex-wrap: wrap;
    }

    .segment {
        flex: 1;
    }

    .summary-grid,
    .form-grid,
    .modal-metrics {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
