:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #172235;
    background: #f3f6fa;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
}

.shell {
    width: min(100% - 32px, 920px);
    margin: 56px auto;
}

.brand,
.welcome,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    justify-content: flex-start;
    margin-bottom: 28px;
}

.brand-mark {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 15px;
    color: #fff;
    background: #2459cc;
    font-size: 15px;
    font-weight: 800;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

h2 {
    margin-bottom: 8px;
    font-size: 1.25rem;
}

h3 {
    margin-bottom: 16px;
    font-size: 1.05rem;
}

.eyebrow {
    margin-bottom: 4px;
    color: #58708e;
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.card {
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid #e1e8f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 35px rgb(22 44 75 / 6%);
}

.login-card {
    max-width: 460px;
}

.muted {
    color: #65758b;
}

label {
    display: block;
    margin: 18px 0 7px;
    font-size: 0.9rem;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #ccd7e4;
    border-radius: 9px;
    background: #fff;
    color: #172235;
    font: inherit;
}

input:focus,
select:focus {
    border-color: #2459cc;
    outline: 3px solid rgb(36 89 204 / 14%);
}

button {
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #2459cc;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

button:hover {
    background: #1948ae;
}

form > button {
    margin-top: 22px;
}

.button-secondary {
    color: #263a57;
    background: #eaf0f8;
}

.button-secondary:hover {
    background: #dce6f3;
}

.alert {
    padding: 12px 14px;
    border: 1px solid #f1c7c7;
    border-radius: 9px;
    color: #8d2424;
    background: #fff2f2;
}

.welcome {
    margin-bottom: 22px;
}

.welcome h2,
.welcome p {
    margin-bottom: 0;
}

.welcome form > button {
    margin-top: 0;
}

.section-heading {
    align-items: flex-start;
}

.section-heading p {
    margin-bottom: 0;
}

.pending-overview,
.migration-preview {
    margin-bottom: 20px;
}

.pending-database-list {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.bulk-migration-actions {
    display: grid;
    gap: 14px;
    margin-top: 22px;
    padding: 18px;
    border: 1px solid #dfe8f4;
    border-radius: 12px;
    background: #f7f9fc;
}

.bulk-migration-actions form,
.bulk-migration-actions form > button {
    margin: 0;
}

.bulk-apply-form {
    display: grid;
    gap: 8px;
}

.bulk-apply-form label {
    margin: 0;
}

.bulk-apply-form .checkbox-label {
    margin-top: 6px;
}

.bulk-scope-note {
    margin: 12px 0 0;
    font-size: 0.88rem;
}

.bulk-apply-block {
    display: grid;
    justify-items: start;
    gap: 10px;
}

.bulk-apply-block button {
    margin: 0;
}

.bulk-apply-block p {
    margin: 0;
}

.bulk-apply-block button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.initializer-warning {
    margin-bottom: 20px;
    border-color: #f0d7a5;
    background: #fffaf0;
}

.initializer-warning h2 {
    color: #694900;
}

.initializer-warning p:last-child {
    margin-bottom: 0;
}

.initializer-overview,
.initializer-output {
    margin-bottom: 20px;
}

.initializer-bulk-action {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid #dfe8f4;
    border-radius: 12px;
    background: #f7f9fc;
}

.initializer-bulk-action form,
.initializer-one-form {
    display: grid;
    max-width: 620px;
    gap: 8px;
}

.initializer-bulk-action label,
.initializer-one-form label {
    margin: 0;
}

.initializer-bulk-action button,
.initializer-one-form button {
    justify-self: start;
    margin: 8px 0 0;
}

.initializer-database-list {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.initializer-database-row {
    padding: 18px;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    background: #fbfcfe;
}

.initializer-database-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.initializer-database-heading h3,
.initializer-database-heading p {
    margin-bottom: 6px;
}

.initializer-database-row .initializer-one-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e7edf4;
}

.badge-warning {
    color: #815000;
    background: #fff2d6;
}

.initializer-output {
    margin-top: 20px;
}

.git-check-warning {
    margin-bottom: 20px;
    border-color: #c9d8ee;
    background: #f3f7fd;
}

.git-project-overview,
.git-operation-result {
    margin-bottom: 20px;
}

.git-project-list {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.git-project-card {
    border: 1px solid #e1e8f1;
    border-radius: 12px;
    background: #fbfcfe;
    overflow: hidden;
}

.git-project-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
}

.git-project-summary::-webkit-details-marker {
    display: none;
}

.git-project-summary::after {
    flex: 0 0 auto;
    color: #536982;
    font-size: 1.2rem;
    font-weight: 700;
    content: "+";
}

.git-project-card[open] .git-project-summary::after {
    content: "-";
}

.git-project-summary-main {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.git-project-summary-main > strong {
    overflow-wrap: anywhere;
}

.git-project-summary-status {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.git-project-content {
    padding: 0 18px 18px;
}

.git-change-list {
    max-height: 260px;
    overflow: auto;
    margin: 14px 0;
    padding: 12px 12px 12px 32px;
    border: 1px solid #e7edf4;
    border-radius: 8px;
    background: #fff;
}

.git-change-list li {
    margin: 5px 0;
    overflow-wrap: anywhere;
}

.git-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
    margin-top: 18px;
}

.git-operation-form {
    display: grid;
    align-content: start;
    gap: 7px;
    padding: 14px;
    border: 1px solid #e1e8f1;
    border-radius: 9px;
    background: #fff;
}

.git-operation-form label {
    margin: 0;
}

.git-operation-form input[type="text"] {
    min-width: 0;
}

.git-operation-form .checkbox-label {
    margin-top: 4px;
}

.git-operation-form button {
    justify-self: start;
    margin: 4px 0 0;
}

.git-operation-form button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.git-operation-result form > button {
    margin-top: 12px;
}

.pending-database-row {
    padding: 16px;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    background: #fbfcfe;
}

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

.pending-database-info h3,
.pending-database-info p {
    margin: 0;
}

.pending-database-info h3 {
    grid-column: 1;
    grid-row: 1;
}

.pending-database-info p {
    grid-column: 1;
    grid-row: 2;
}

.pending-database-info > .badge {
    grid-column: 2;
    grid-row: 1;
}

.pending-database-info .versions {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0;
}

.pending-database-info form {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: end;
}

.pending-database-info form > button {
    margin: 0;
}

.pending-count {
    color: #8a5700;
    font-size: 0.9rem;
    font-weight: 700;
}

.badge {
    padding: 7px 10px;
    border-radius: 999px;
    color: #31569a;
    background: #edf3ff;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.database-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-top: 22px;
}

.database-picker label {
    grid-column: 1 / -1;
    margin: 0 0 -5px;
}

.database-picker button {
    margin: 0;
}

.status-panel {
    margin-top: 25px;
    padding-top: 24px;
    border-top: 1px solid #e7edf4;
}

.stats {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.stats > div {
    display: grid;
    min-width: 125px;
    gap: 4px;
    padding: 14px;
    border-radius: 12px;
    background: #f3f6fb;
}

.stats strong {
    font-size: 1.35rem;
}

.stats span,
.versions {
    color: #65758b;
    font-size: 0.88rem;
}

.versions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    list-style: none;
}

.versions li {
    padding: 6px 9px;
    border-radius: 7px;
    background: #f3f6fb;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.cli-note {
    margin: 22px 0 0;
    color: #52657d;
    font-size: 0.9rem;
}

footer {
    margin-top: 22px;
    color: #75849a;
    font-size: 0.8rem;
    text-align: center;
}

.app-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    padding: 24px 16px;
    color: #d7e2f1;
    background: #14233b;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 42px;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand .brand-mark {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: #3269df;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand strong {
    font-size: 0.9rem;
}

.sidebar-brand small,
.nav-label,
.sidebar-foot {
    color: #91a2ba;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.1em;
}

.sidebar-brand small {
    margin-top: 5px;
}

.nav-label {
    margin: 0 10px 10px;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.nav-link {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 9px;
    color: #d7e2f1;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: #263d5e;
}

.nav-link.active {
    box-shadow: inset 3px 0 #72a1ff;
}

.nav-icon {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border-radius: 8px;
    color: #b7cefb;
    background: #1d3150;
    font-size: 0.64rem;
    font-weight: 800;
}

.sidebar-foot {
    margin-top: auto;
    padding: 16px 10px 2px;
}

.app-main {
    min-width: 0;
}

.app-main .shell {
    width: min(calc(100% - 64px), 1060px);
    margin: 42px auto;
}

.import-warning {
    margin-bottom: 20px;
    border-color: #f0d7a5;
    background: #fffaf0;
}

.import-warning h2 {
    color: #694900;
}

.import-warning p:last-child {
    margin-bottom: 0;
}

.import-card,
.staged-card {
    margin-bottom: 20px;
}

.import-card form > button {
    margin-top: 18px;
}

.import-card input[type="file"] {
    padding: 8px;
}

.notice {
    padding: 12px 14px;
    border: 1px solid #cbd9ef;
    border-radius: 9px;
    color: #294b7e;
    background: #f1f6ff;
}

.notice.success {
    border-color: #bbdfca;
    color: #23613c;
    background: #effaf3;
}

.notice.error {
    border-color: #f1c7c7;
    color: #8d2424;
    background: #fff2f2;
}

.badge-success {
    color: #23613c;
    background: #e8f7ed;
}

.badge-neutral {
    color: #58677c;
    background: #edf1f6;
}

.confirm-panel {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid #f0d7a5;
    border-radius: 12px;
    background: #fffaf0;
}

.confirm-panel h3 {
    margin-bottom: 8px;
}

.confirm-panel p {
    color: #6b5b39;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    font-weight: 500;
    line-height: 1.5;
}

.checkbox-label input {
    width: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 2px 0 0;
}

.button-danger {
    margin-top: 18px;
    background: #b52e35;
}

.button-danger:hover {
    background: #92242a;
}

.terminal {
    overflow: hidden;
    margin-top: 22px;
    border: 1px solid #25334a;
    border-radius: 12px;
    color: #d8e5d2;
    background: #101821;
    box-shadow: 0 10px 26px rgb(11 22 36 / 16%);
}

.terminal-bar {
    display: flex;
    min-height: 39px;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid #283545;
    color: #a9b5c5;
    font-size: 0.67rem;
    font-weight: 750;
    letter-spacing: 0.1em;
}

.terminal-lights {
    position: absolute;
    left: 13px;
    display: flex;
    gap: 5px;
}

.terminal-lights i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e16c65;
}

.terminal-lights i:nth-child(2) {
    background: #e3b454;
}

.terminal-lights i:nth-child(3) {
    background: #62bb7c;
}

.terminal pre {
    overflow: auto;
    max-height: 420px;
    margin: 0;
    padding: 17px;
    color: #d8e5d2;
    font: 0.82rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.discard-form {
    margin-top: 18px;
}

.discard-form button {
    margin: 0;
}

@media (max-width: 560px) {
    .shell {
        margin: 28px auto;
    }

    .welcome,
    .section-heading {
        align-items: flex-start;
    }

    .database-picker {
        grid-template-columns: 1fr;
    }

    .database-picker button {
        width: 100%;
    }

    .pending-database-info {
        grid-template-columns: 1fr;
    }

    .pending-database-info h3,
    .pending-database-info p,
    .pending-database-info > .badge,
    .pending-database-info .versions,
    .pending-database-info form {
        grid-column: 1;
        grid-row: auto;
    }

    .pending-database-info form {
        justify-self: stretch;
    }

    .pending-database-info form > button {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .app-layout {
        grid-template-columns: 1fr;
        align-content: start;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 14px 16px;
    }

    .sidebar-brand {
        margin-bottom: 16px;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-foot,
    .nav-label {
        display: none;
    }

    .app-main .shell {
        width: min(calc(100% - 32px), 920px);
        margin: 28px auto;
    }
}
