:root {
    color-scheme: light;
    --bg: #f0f0f1;
    --panel: #ffffff;
    --text: #2a2d3e;
    --muted: rgba(42, 45, 62, 0.72);
    --line: #dcdcde;
    --tab: #f5f6fa;
    --accent: #7c6cff;
    --accent-blue: #5ca9ff;
    --accent-mint: #4dd4c1;
    --accent-pink: #ff8ec7;
    --ink: #2a2d3e;
    --soft-shadow: 0 18px 48px rgba(42, 45, 62, 0.12);
    --font-rounded:
        "Hiragino Maru Gothic ProN", "Zen Maru Gothic", "Hiragino Sans",
        "Yu Gothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
    font-family: var(--font-rounded);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-rounded);
    font-size: 14px;
    line-height: 1.8;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    border-radius: 999rem;
    padding: 8px 18px;
    color: #ffffff;
    background: linear-gradient(90deg, var(--accent), var(--accent-pink));
    cursor: pointer;
    font-weight: 800;
    line-height: 1.25;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

input,
select {
    min-height: 34px;
    border: 1px solid #d7dce5;
    border-radius: 8px;
    padding: 4px 10px;
    color: var(--text);
    background: #ffffff;
}

select {
    min-width: 6.5rem;
}

hr {
    height: 1px;
    margin: 1rem 0 0.6rem;
    border: 0;
    background: var(--line);
}

.brand-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    min-height: 12.5rem;
    margin: 20px 20px 22px 20px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 28px;
    padding: 28px 32px;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 8% 18%,
            rgba(255, 142, 199, 0.22),
            transparent 28rem
        ),
        radial-gradient(
            circle at 92% 12%,
            rgba(92, 169, 255, 0.18),
            transparent 30rem
        ),
        linear-gradient(135deg, #fff 0%, var(--tab) 100%);
    box-shadow: var(--soft-shadow);
}

.brand-lockup {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.brand-tagline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 13px;
    border-radius: 999px;
    color: var(--accent);
    background: rgba(124, 108, 255, 0.1);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
}

.brand-logo {
    display: block;
    width: min(260px, 48vw);
    height: auto;
}

.brand-dots {
    position: absolute;
    top: 50%;
    right: 32px;
    display: grid;
    grid-template-columns: repeat(5, 42px);
    gap: 10px;
    transform: translateY(-50%);
}

.brand-dots span {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(42, 45, 62, 0.14);
}

.brand-dots span:nth-child(1) {
    background: var(--accent);
}

.brand-dots span:nth-child(2) {
    background: var(--accent-blue);
}

.brand-dots span:nth-child(3) {
    background: var(--accent-mint);
}

.brand-dots span:nth-child(4) {
    background: var(--accent-pink);
}

.brand-dots span:nth-child(5) {
    background: var(--ink);
}

#page-title {
    grid-column: 1 / -1;
    margin: -8px 0 0;
    color: var(--ink);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.app-shell {
    position: relative;
    margin: 18px 20px 0;
}

.app-tabs {
    display: flex;
    gap: 0.45rem;
    margin: 0 0 16px;
}

.app-tabs a,
.logout-button,
.text-link {
    border-radius: 999rem;
    padding: 9px 18px;
    color: var(--text);
    background: var(--tab);
    text-decoration: none;
    font-weight: 800;
    line-height: 1.25;
}

.app-tabs a.current {
    color: #ffffff;
    background: linear-gradient(90deg, var(--accent), var(--accent-pink));
}

.logout-button {
    position: absolute;
    top: 0;
    right: 0.65rem;
    min-width: 6rem;
    color: var(--text);
    background: var(--tab);
}

.text-link {
    display: inline;
    border: 0;
    padding: 0;
    color: var(--accent);
    background: transparent;
    font-size: 0.74rem;
}

.panel {
    min-height: 18rem;
    border: 1px solid #eef0f6;
    border-radius: 22px;
    padding: 20px;
    background: var(--panel);
    box-shadow: 0 14px 44px rgba(42, 45, 62, 0.08);
}

.login-panel {
    width: min(100%, 280px);
    min-height: 8.3rem;
    padding: 24px;
}

.login-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

.login-form button {
    justify-self: end;
    min-width: 4.4rem;
    padding-block: 0.15rem;
}

.login-panel input {
    width: 100%;
}

.message {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.message.error {
    color: #d94b5d;
}

.message.ok {
    color: #168574;
}

.account-line {
    margin: 0 0 0.35rem;
}

.table-wrap {
    margin-top: 0.75rem;
    overflow-x: auto;
}

.site-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
}

.site-table th,
.site-table td {
    border-bottom: 1px solid #d5d6dc;
    padding: 0.45rem 0.6rem;
    text-align: left;
}

.site-table th {
    font-weight: 500;
    background: #ffffff;
}

.site-table tbody tr:nth-child(odd) {
    background: #e6e6ea;
}

.site-card-list {
    display: grid;
    gap: 0.35rem;
}

.site-card {
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    padding: 0.75rem 0.9rem;
}

.site-card-details {
    display: grid;
    gap: 0.25rem;
}

.site-detail-row {
    display: grid;
    grid-template-columns: minmax(12rem, max-content) auto;
    gap: 0.5rem;
    align-items: center;
    justify-content: start;
}

.site-detail-row button {
    min-width: 5.9rem;
    padding-block: 0.15rem;
}

.features-box,
.diagnostics-box {
    margin-top: 0.7rem;
    border-top: 1px solid var(--line);
    padding-top: 0.5rem;
}

.features-box h3,
.diagnostics-box h3 {
    margin: 0 0 0.3rem;
    font-size: 1rem;
}

.features-box ol {
    margin: 0;
    padding-left: 1.4rem;
}

.diagnostics-box {
    min-height: 4.8rem;
}

.settings-panel .inline-form,
.form-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.4rem 0;
    flex-wrap: wrap;
}

.settings-panel input {
    width: min(100%, 13rem);
}

.settings-panel button {
    min-width: 6.2rem;
    padding-block: 0.15rem;
}

.settings-block p {
    margin: 0 0 0.35rem;
}

.new-site-panel {
    min-height: 12rem;
}

.new-site-panel form {
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    padding: 0.65rem 0.8rem;
}

#connect-site-url {
    width: min(100%, 12rem);
    margin-bottom: 0.35rem;
}

.features-line {
    margin: 0;
}

.contract-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.45rem 0 0 0.1rem;
    flex-wrap: wrap;
}

.contract-actions button {
    min-width: 5.1rem;
    padding-block: 0.15rem;
}

.terms-dialog {
    width: min(34rem, calc(100vw - 2rem));
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    padding: 1.1rem;
}

.terms-dialog::backdrop {
    background: rgba(42, 45, 62, 0.28);
}

[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .brand-header {
        min-height: 7.2rem;
        margin: 0.35rem;
    }

    .brand-dots {
        top: 1rem;
        right: 0.75rem;
    }

    .app-shell {
        margin-inline: 0.35rem;
    }

    .logout-button {
        position: static;
        margin: 0 0 0.5rem 0.75rem;
    }

    .login-panel {
        width: 100%;
    }

    .site-detail-row {
        grid-template-columns: 1fr;
    }
}
