:root {
    color-scheme: light;
    --bg: #f4f4f2;
    --ink: #111114;
    --muted: #6d6f78;
    --line: #dedfe4;
    --panel: rgba(255, 255, 255, 0.86);
    --dark: #09090b;
    --blue: #3b82f6;
    --green: #2fbf71;
    --red: #e5484d;
    --shadow: 0 18px 50px rgba(15, 15, 18, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #fbfbfa 0%, var(--bg) 100%);
    color: var(--ink);
}

body.service-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(8, 8, 10, 0.04), transparent 38%, rgba(59, 130, 246, 0.05));
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

code,
.mono {
    font-family: "SFMono-Regular", Consolas, monospace;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 0;
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark);
    color: #fff;
    font-weight: 720;
}

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

.brand strong {
    font-size: 15px;
    letter-spacing: 0;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 5px;
    border: 1px solid rgba(17, 17, 20, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 8px 26px rgba(15, 15, 18, 0.06);
}

.site-nav a {
    border-radius: 999px;
    padding: 8px 13px;
    color: #4d4f57;
    font-size: 13px;
    white-space: nowrap;
}

.site-nav a.active,
.site-nav a:hover {
    background: var(--dark);
    color: #fff;
}

.page-shell {
    position: relative;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 38px 0 72px;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(420px, 1fr);
    gap: 42px;
    align-items: center;
    min-height: calc(100vh - 150px);
}

.home-actions {
    display: grid;
    gap: 12px;
}

.entry-card,
.service-card,
.guide-panel,
.login-card,
.admin-card {
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.entry-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    padding: 22px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.entry-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.34);
}

.entry-card span {
    grid-row: span 2;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
}

.entry-card strong {
    font-size: 18px;
}

.entry-card small {
    color: var(--muted);
    font-size: 13px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 16px;
    font-size: 46px;
    line-height: 1.04;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 8px;
    font-size: 15px;
    letter-spacing: 0;
}

.lead {
    max-width: 560px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(390px, 0.72fr);
    gap: 26px;
    align-items: start;
}

.guide-panel,
.service-card {
    padding: 24px;
}

.guide-modal-trigger {
    margin-bottom: 16px;
    border-color: rgba(59, 130, 246, 0.2);
    background: var(--blue);
    color: #fff;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.18);
}

.guide-modal-trigger::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 999px;
    background: currentColor;
}

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

.step-list article {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 14px;
    border: 1px solid rgba(17, 17, 20, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    padding: 16px;
}

.step-list article > span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--dark);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.step-list p,
.notice,
.muted,
.refresh-meta {
    color: var(--muted);
    line-height: 1.75;
}

.notice {
    margin: 18px 0 0;
    border-left: 2px solid var(--blue);
    padding-left: 12px;
    font-size: 13px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 650;
}

.card-head,
.page-title.with-toggle,
.result-head,
.admin-topbar,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.title-row {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.title-row h2 {
    margin: 0;
}

.service-tag {
    border: 1px solid rgba(17, 17, 20, 0.12);
    border-radius: 999px;
    background: #fff;
    color: var(--dark);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 10px;
    white-space: nowrap;
}

.state-chip {
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 999px;
    padding: 8px 11px;
    background: #fff;
    color: #343741;
    font-size: 12px;
    white-space: nowrap;
}

.form-stack,
.lookup-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.lookup-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

label {
    display: grid;
    gap: 8px;
}

label span {
    color: #555862;
    font-size: 13px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #d7d8de;
    border-radius: 8px;
    outline: none;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    padding: 12px 13px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
    min-height: 126px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(59, 130, 246, 0.62);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
    background: #fff;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 15px;
    font-weight: 680;
    white-space: nowrap;
}

.primary-button,
.secondary-button {
    background: var(--blue);
    color: #fff;
}

.primary-button.dark {
    background: var(--dark);
}

.ghost-button {
    border: 1px solid rgba(17, 17, 20, 0.12);
    background: #fff;
    color: var(--ink);
}

.danger-button {
    background: rgba(229, 72, 77, 0.1);
    color: #b62027;
}

button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.form-message {
    min-height: 20px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.form-message[data-type="success"],
.success-text {
    color: #17864d;
}

.form-message[data-type="error"],
.error-text {
    color: #d03434;
}

.single-panel {
    display: grid;
    gap: 24px;
    width: min(860px, 100%);
    margin: 24px auto 0;
}

.page-title {
    text-align: left;
}

.result-card {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    padding: 16px;
}

.result-card.compact {
    margin-top: 0;
}

.status-panel {
    display: grid;
    gap: 16px;
}

.status-topline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 30px;
}

.status-topline > span:nth-child(2) {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.status-topline strong {
    margin-left: auto;
    border-radius: 999px;
    background: #fff;
    padding: 7px 10px;
    font-size: 13px;
}

.status-panel h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.28;
}

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

.detail-grid div {
    border: 1px solid rgba(17, 17, 20, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    padding: 13px;
}

.detail-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.detail-grid strong {
    display: block;
    margin-top: 6px;
    word-break: break-all;
    font-size: 15px;
}

.status-panel.success .status-topline strong {
    color: #137847;
}

.status-panel.info .status-topline strong,
.status-panel.queued .status-topline strong,
.status-panel.processing .status-topline strong {
    color: #1f66d1;
}

.status-panel.failed .status-topline strong,
.status-panel.danger .status-topline strong {
    color: #ba252b;
}

.result-card p {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: rgba(7, 7, 9, 0.62);
    padding: 24px;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(1180px, 100%);
    max-height: min(900px, calc(100vh - 48px));
    overflow: auto;
    border-radius: 10px;
    background: #f7f7f6;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.32);
    padding: 20px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.tutorial-images {
    display: grid;
    gap: 14px;
}

.tutorial-images img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 8px;
    background: #fff;
}

.result-card p span {
    color: var(--muted);
}

.result-card p strong {
    text-align: right;
    word-break: break-all;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #8b8f9a;
}

.status-dot.success,
.status-dot.unused {
    background: var(--green);
}

.status-dot.info,
.status-dot.queued,
.status-dot.pending,
.status-dot.processing {
    background: var(--blue);
}

.status-dot.failed,
.status-dot.danger,
.status-dot.disabled {
    background: var(--red);
}

.muted-dot {
    background: #9ca3af;
}

.switch-row {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 999px;
    background: #fff;
    padding: 9px 12px;
    white-space: nowrap;
}

.switch-row input {
    width: auto;
}

.refresh-meta {
    margin-top: 12px;
    font-size: 13px;
}

.admin-page {
    background: var(--bg);
}

.admin-layout {
    width: min(1320px, calc(100% - 34px));
    margin: 0 auto;
    padding: 24px 0 60px;
}

.admin-tabs,
.admin-toolbar,
.generate-form,
.row-actions,
.stats-grid,
.bulk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.admin-tabs {
    margin: 20px 0 14px;
}

.admin-tabs button {
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 8px;
    background: #fff;
    padding: 10px 14px;
}

.admin-tabs button.active {
    background: var(--dark);
    color: #fff;
}

.admin-card,
.login-card {
    padding: 18px;
}

.stats-grid {
    margin-bottom: 14px;
}

.stat-card {
    min-width: 150px;
    flex: 1;
    border: 1px solid rgba(17, 17, 20, 0.1);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
}

.admin-toolbar {
    margin: 14px 0;
}

.bulk-toolbar {
    border: 1px solid rgba(17, 17, 20, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
    margin: 0 0 14px;
    padding: 12px;
}

.bulk-toolbar > strong {
    font-size: 14px;
}

.bulk-toolbar > span {
    color: var(--muted);
    font-size: 13px;
}

.admin-toolbar input,
.admin-toolbar select,
.bulk-toolbar input,
.bulk-toolbar select,
.generate-form input,
.generate-form select,
.format-settings input,
.format-settings select {
    width: auto;
    min-width: 132px;
}

.format-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    border: 1px solid rgba(17, 17, 20, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    margin: 14px 0;
    padding: 14px;
}

.format-settings h3 {
    margin: 2px 0 0;
    font-size: 18px;
}

.format-settings label {
    display: grid;
    gap: 6px;
}

.format-settings label span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.format-preview {
    flex-basis: 100%;
    color: var(--muted);
    font-size: 13px;
}

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

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

th,
td {
    border-bottom: 1px solid rgba(17, 17, 20, 0.08);
    padding: 12px 9px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
}

.sk-cell {
    max-width: 330px;
    word-break: break-all;
}

.status-select {
    min-width: 110px;
    padding: 9px;
}

.admin-section[hidden] {
    display: none;
}

.generated-output {
    margin-top: 14px;
    white-space: pre-wrap;
    word-break: break-all;
}

.generated-actions {
    margin-top: 14px;
}

.account-form {
    display: grid;
    gap: 14px;
    width: min(520px, 100%);
    margin-top: 18px;
}

.card-check,
#selectAllCards {
    width: 18px;
    height: 18px;
}

.login-wrap {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background: #0a0a0b;
}

.login-card {
    width: min(420px, 100%);
}

@media (max-width: 900px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .site-nav {
        justify-content: flex-start;
        width: 100%;
        overflow-x: auto;
    }

    .page-shell {
        width: min(100% - 28px, 720px);
        padding-top: 24px;
    }

    .home-hero,
    .content-grid,
    .lookup-form {
        grid-template-columns: 1fr;
    }

    .home-hero {
        min-height: 0;
        gap: 26px;
    }

    h1 {
        font-size: 36px;
    }

    .page-title.with-toggle,
    .card-head,
    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .guide-panel,
    .service-card {
        padding: 18px;
    }

    .result-card p {
        display: grid;
        gap: 4px;
    }

    .result-card p strong {
        text-align: left;
    }

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

    .modal-backdrop {
        padding: 12px;
    }

    .modal-panel {
        max-height: calc(100vh - 24px);
        padding: 14px;
    }
}

@media (max-width: 520px) {
    .site-header {
        width: min(100% - 24px, 460px);
    }

    .site-nav a {
        padding: 8px 11px;
    }

    .step-list article {
        grid-template-columns: 1fr;
    }

    .admin-toolbar input,
    .admin-toolbar select,
    .bulk-toolbar input,
    .bulk-toolbar select,
    .bulk-toolbar button,
    .generate-form input,
    .generate-form select,
    .generate-form button,
    .format-settings input,
    .format-settings select,
    .format-settings button {
        width: 100%;
    }
}
