@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-muted: #fafafa;
    --ink: #111111;
    --muted: #6f6f6f;
    --line: #e8e8e8;
    --accent: #5195e7;
    --accent-soft: #edf4fd;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a {
    color: inherit;
}

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

code {
    display: inline-block;
    padding: 0.24rem 0.52rem;
    border-radius: 0.75rem;
    background: #f5f5f5;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.82rem;
    word-break: break-all;
}

.container {
    width: min(960px, calc(100vw - 2rem));
    margin: 0 auto;
}

.app-body {
    background: #fcfcfc;
}

.auth-body {
    background:
        radial-gradient(circle at top left, rgba(81, 149, 231, 0.15), transparent 34%),
        #f7f9fc;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.topbar-inner,
.topbar-brand,
.topbar-actions,
.page-header,
.header-actions,
.panel-heading,
.field-row,
.actions,
.action-strip {
    display: flex;
    gap: 1rem;
}

.topbar-inner {
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
}

.topbar-brand {
    align-items: center;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.brand-name {
    display: inline-block;
    text-decoration: none;
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.brand-subtitle {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.topbar-actions {
    align-items: center;
    gap: 0.6rem;
}

.menu-popover {
    position: relative;
}

.menu-popover summary {
    list-style: none;
}

.menu-popover summary::-webkit-details-marker {
    display: none;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-button:hover,
.menu-popover[open] .icon-button {
    border-color: rgba(81, 149, 231, 0.35);
    color: var(--accent);
    transform: translateY(-1px);
}

.icon-button i {
    width: 18px;
    font-size: 15px;
    line-height: 1;
}

.menu-panel {
    position: absolute;
    top: calc(100% + 0.7rem);
    right: 0;
    width: 240px;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(17, 17, 17, 0.08);
}

.menu-title,
.summary-item strong,
.page-header h2,
.panel h3,
.auth-panel h1,
.auth-panel h2 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.04em;
}

.menu-copy {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.menu-list {
    display: grid;
    gap: 0.6rem;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-muted);
    font-size: 0.92rem;
}

.menu-link-item {
    color: inherit;
    text-decoration: none;
}

.menu-link-item:hover {
    border-color: rgba(81, 149, 231, 0.35);
    color: var(--accent);
}

.menu-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-shell {
    padding: 2rem 0 3rem;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.auth-shell .container {
    width: min(1120px, calc(100vw - 2rem));
}

.auth-split {
    display: grid;
    grid-template-columns: 1.02fr 0.98fr;
    min-height: min(720px, calc(100vh - 4rem));
    border: 1px solid rgba(17, 17, 17, 0.06);
    border-radius: 32px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(17, 17, 17, 0.08);
}

.auth-panel {
    padding: clamp(2rem, 4vw, 4rem);
}

.auth-panel-accent {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.22), transparent 24%),
        linear-gradient(160deg, #67a4ed 0%, #5195e7 60%, #377dd5 100%);
    color: #ffffff;
}

.eyebrow-light {
    color: rgba(255, 255, 255, 0.8);
}

.auth-panel-accent h1 {
    max-width: 320px;
    font-size: clamp(2.4rem, 4vw, 4rem);
    line-height: 0.95;
}

.auth-copy {
    max-width: 360px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    line-height: 1.7;
}

.auth-panel-form {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.auth-form-wrap {
    width: min(420px, 100%);
}

.auth-form-wrap h2 {
    margin-top: 0.3rem;
    font-size: 2rem;
}

.page-header,
.panel-heading {
    align-items: flex-start;
    justify-content: space-between;
}

.page-header {
    margin-bottom: 1.5rem;
}

.header-actions {
    align-items: center;
}

.eyebrow,
.label,
th,
.field span,
dt {
    color: var(--muted);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow {
    margin: 0 0 0.55rem;
}

.muted,
.small,
th {
    color: var(--muted);
}

.muted {
    margin: 0.35rem 0 0;
}

.small {
    font-size: 0.88rem;
}

.panel,
.flash,
.summary-item,
.reveal-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.panel {
    padding: 1.4rem;
    margin-bottom: 1rem;
}

.plugin-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-item {
    padding: 1.1rem 1.2rem;
}

.summary-item strong {
    display: block;
    margin-top: 0.55rem;
    font-size: 1.35rem;
}

.action-strip {
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

.compact-stack {
    gap: 0.85rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field-row {
    align-items: stretch;
}

.field-row .field {
    flex: 1;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    color: var(--ink);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(81, 149, 231, 0.75);
    box-shadow: 0 0 0 4px rgba(81, 149, 231, 0.12);
}

textarea {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(81, 149, 231, 0.18);
}

.button-secondary {
    border-color: var(--line);
    background: #ffffff;
    color: var(--ink);
    box-shadow: none;
}

.button-secondary:hover {
    border-color: rgba(81, 149, 231, 0.4);
    color: var(--accent);
    box-shadow: none;
}

.button-small {
    padding: 0.6rem 0.82rem;
    font-size: 0.88rem;
}

.button-block,
.button-full {
    width: 100%;
}

.text-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.plugin-link {
    text-decoration: none;
}

.plugin-link:hover {
    color: var(--accent);
}

.row-menu {
    display: inline-block;
    position: relative;
    z-index: 5;
}

.row-menu-button {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    text-align: center;
}

.row-menu-button i {
    width: auto;
    margin: 0;
}

.row-menu-panel {
    width: 156px;
    padding: 0.45rem;
    z-index: 30;
    text-align: left;
}

.row-menu-link {
    display: block;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.92rem;
    text-align: left;
}

.row-menu-link:hover {
    background: var(--surface-muted);
    color: var(--accent);
}

.row-menu-form {
    margin: 0;
}

.row-menu-action {
    display: block;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
}

.row-menu-action:hover {
    background: var(--surface-muted);
    color: var(--accent);
}

.row-menu-action-danger:hover {
    color: #b42318;
}

.is-busy {
    opacity: 0.7;
    pointer-events: none;
}

.flash {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.flash p {
    margin-bottom: 0;
}

.flash-success {
    border-color: #d8e8ff;
    background: #f7fbff;
}

.flash-error {
    border-color: #f4d4d1;
    background: var(--danger-soft);
}

.flash-token {
    border-color: #d8e8ff;
    background: var(--accent-soft);
}

.credential-grid {
    display: grid;
    gap: 0.8rem;
    margin-top: 0.85rem;
}

.table-wrap {
    overflow: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 1rem 0.25rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 0.74rem;
}

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

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

.cell-action,
.row-actions {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.hover-row:hover .cell-action,
.hover-row:hover .row-actions,
.hover-row:focus-within .cell-action,
.hover-row:focus-within .row-actions {
    opacity: 1;
}

.actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 0.32rem 0.68rem;
    border-radius: 999px;
    background: #f4f4f4;
    font-size: 0.82rem;
}

.status-accent,
.status-ok {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-forbidden,
.status-not_found {
    background: var(--danger-soft);
    color: var(--danger);
}

.error {
    color: var(--danger);
    font-size: 0.88rem;
    min-height: 1rem;
}

.modal-card {
    width: min(520px, calc(100vw - 2rem));
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(17, 17, 17, 0.14);
}

.modal-card-wide {
    width: min(760px, calc(100vw - 2rem));
}

.app-modal {
    padding: 0;
    border: none;
    background: transparent;
}

.app-modal::backdrop {
    background: rgba(17, 17, 17, 0.38);
    backdrop-filter: blur(4px);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-header {
    margin-bottom: 1rem;
}

.modal-footer {
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
}

.modal-close:hover {
    border-color: rgba(81, 149, 231, 0.4);
    color: var(--accent);
}

.credential-block {
    display: grid;
    gap: 0.45rem;
}

.credential-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.credential-copy {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.credential-block code {
    display: block;
    width: 100%;
}

.credential-snippet {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 0.95rem;
    background: #f5f5f5;
    overflow-x: auto;
}

.credential-snippet code {
    padding: 0;
    background: transparent;
    white-space: pre-wrap;
    word-break: break-word;
}

.upload-progress {
    display: grid;
    gap: 0.55rem;
}

.upload-progress-bar {
    position: relative;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1f6;
}

.upload-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5195e7 0%, #75acef 100%);
    transition: width 0.2s ease;
}

.button.is-working::after {
    content: "";
    width: 0.8rem;
    height: 0.8rem;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

.button-secondary.is-working::after {
    border-color: rgba(17, 17, 17, 0.2);
    border-top-color: var(--accent);
}

.text-link.is-copied {
    color: var(--ink);
}

.panel-empty {
    color: var(--muted);
}

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

@media (max-width: 900px) {
    .auth-split,
    .plugin-summary {
        grid-template-columns: 1fr;
    }

    .auth-panel-accent {
        min-height: 280px;
    }

    .topbar-inner,
    .page-header,
    .field-row,
    .header-actions,
    .modal-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-inner {
        padding: 1rem 0;
    }

    .topbar-actions {
        align-self: flex-end;
    }

    .cell-action,
    .row-actions {
        opacity: 1;
    }

    .actions {
        justify-content: flex-start;
    }

    .table-wrap {
        overflow-x: auto;
        overflow-y: visible;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100vw - 1rem, 960px);
    }

    .app-shell {
        padding-top: 1.25rem;
    }

    .auth-shell {
        padding: 0.5rem 0;
    }

    .auth-split {
        min-height: auto;
        border-radius: 24px;
    }

    .auth-panel {
        padding: 1.5rem;
    }

    .panel,
    .summary-item,
    .modal-card {
        padding: 1rem;
    }

    .menu-panel {
        width: min(240px, calc(100vw - 2rem));
    }
}
