:root {
    color-scheme: light;
    font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
    --bg: #f3f6fa;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --line: #dce3ec;
    --text: #172033;
    --muted: #667085;
    --primary: #2356d8;
    --primary-dark: #1945b6;
    --shadow: 0 12px 34px rgba(26, 39, 70, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

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

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #dfe9ff 0, transparent 36%),
        radial-gradient(circle at bottom right, #e5f2ef 0, transparent 34%),
        var(--bg);
}

.login-card {
    width: min(430px, 100%);
    padding: 38px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 22px 60px rgba(27, 44, 82, 0.16);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 20px;
    border-radius: 16px;
    background: linear-gradient(145deg, #2e66f0, #173c9c);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow: 0 10px 22px rgba(35, 86, 216, 0.28);
}

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

.brand-mark.brand-icon {
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.brand-mark.brand-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-mark.warning {
    background: linear-gradient(145deg, #e78324, #b34d12);
}

.eyebrow {
    margin: 0 0 5px;
    color: #4b6cae;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

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

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.55rem, 3vw, 2rem);
}

h2 {
    margin-bottom: 0;
    font-size: 1.18rem;
}

.muted,
.subtext,
.currency {
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

label {
    color: #344054;
    font-size: 0.88rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cfd7e3;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    padding: 9px 11px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
    border-color: #6c92ee;
    box-shadow: 0 0 0 3px rgba(35, 86, 216, 0.12);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 6px 0 10px;
    font-weight: 500;
}

.remember-row input {
    width: 17px;
    min-height: 17px;
}

.primary-button,
.secondary-button {
    min-height: 40px;
    border-radius: 10px;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 750;
    text-align: center;
    text-decoration: none;
    transition: transform 0.12s ease, background 0.12s ease;
}

.primary-button {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
}

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

.secondary-button {
    border: 1px solid #cbd5e2;
    background: #fff;
    color: #344054;
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.field-error,
.validation-summary {
    color: #b42318;
    font-size: 0.82rem;
}

.validation-summary ul {
    margin: 0;
    padding-left: 18px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 74px;
    padding: 14px clamp(18px, 4vw, 52px);
    border-bottom: 1px solid rgba(207, 216, 228, 0.86);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
}

.brand-row,
.account-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-row h1 {
    margin: 0;
    font-size: 1.25rem;
}

.account-area {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.88rem;
}

.account-area form,
.account-area .secondary-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.page-shell {
    width: min(1660px, calc(100% - 28px));
    margin: 26px auto 46px;
}

.search-card,
.table-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-card {
    padding: 22px;
    margin-bottom: 18px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.result-count {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border-radius: 999px;
    background: #edf3ff;
    color: #294f9d;
    padding: 5px 12px;
    font-weight: 750;
}

.search-grid {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(210px, 1.2fr) minmax(210px, 1.2fr) 110px auto;
    align-items: end;
    gap: 14px;
}

.field-group {
    display: grid;
    gap: 6px;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-card {
    overflow: hidden;
}

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

.orders-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.orders-table th,
.orders-table td {
    border-bottom: 1px solid #e5eaf1;
    padding: 13px 14px;
    text-align: left;
    vertical-align: middle;
}

.orders-table th {
    position: sticky;
    top: 0;
    background: #f7f9fc;
    color: #475467;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.orders-table tbody tr:hover {
    background: #f8faff;
}

.orders-table tbody tr:last-child td {
    border-bottom: 0;
}

.number-cell {
    text-align: right !important;
    white-space: nowrap;
}

.date-cell {
    white-space: nowrap;
    color: #475467;
}

.order-number,
.product-code {
    white-space: nowrap;
}

.subtext {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
}

.currency {
    margin-left: 3px;
    font-size: 0.75rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pending {
    background: #fff4d8;
    color: #8a5700;
}

.status-paid {
    background: #e7f0ff;
    color: #2451a5;
}

.status-fulfilled {
    background: #dff6e7;
    color: #17663a;
}

.status-cancelled {
    background: #fbe7e5;
    color: #a5372c;
}

.status-neutral {
    background: #eef1f5;
    color: #475467;
}

.delivery-line {
    font-weight: 700;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 7px;
    min-height: 230px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text);
}

@media (max-width: 1050px) {
    .search-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .topbar {
        align-items: flex-start;
        padding: 12px 14px;
    }

    .account-area {
        align-items: flex-end;
        flex-direction: column;
        gap: 6px;
    }

    .account-area > span {
        display: none;
    }

    .page-shell {
        width: min(100% - 18px, 1660px);
        margin-top: 14px;
    }

    .search-card {
        padding: 17px;
    }

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

    .search-actions {
        grid-column: auto;
    }

    .search-actions > * {
        flex: 1;
    }

    .login-card {
        padding: 28px 22px;
    }
}

/* Step 2: 注文番号リンク・注文詳細 */
.order-number-link {
    display: inline-flex;
    border-radius: 5px;
    color: var(--primary);
    text-decoration: none;
    outline: none;
}

.order-number-link code {
    color: inherit;
    font-weight: 750;
}

.order-number-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.order-number-link:focus-visible {
    box-shadow: 0 0 0 3px rgba(35, 86, 216, 0.16);
}

.detail-shell {
    width: min(1220px, calc(100% - 28px));
}

.breadcrumb-row {
    margin: 0 0 14px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #425d94;
    font-size: 0.9rem;
    font-weight: 750;
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.detail-hero,
.detail-card,
.not-found-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.detail-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 24px 26px;
}

.detail-order-number {
    margin: 0 0 7px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: clamp(1.25rem, 3vw, 1.72rem);
    overflow-wrap: anywhere;
}

.detail-subtitle {
    margin: 0;
    color: var(--muted);
}

.status-summary {
    display: grid;
    justify-items: end;
    gap: 9px;
    flex: 0 0 auto;
}

.status-summary strong {
    font-size: 1.2rem;
}

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

.detail-card {
    min-width: 0;
    overflow: hidden;
}

.detail-card-wide {
    grid-column: 1 / -1;
}

.detail-card-heading {
    padding: 19px 21px 16px;
    border-bottom: 1px solid #e7ecf2;
    background: #fafbfd;
}

.detail-list {
    margin: 0;
}

.detail-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
    gap: 18px;
    padding: 13px 21px;
    border-bottom: 1px solid #edf0f5;
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-row dt {
    color: #667085;
    font-size: 0.8rem;
    font-weight: 700;
}

.detail-row dd {
    min-width: 0;
    margin: 0;
    color: #263247;
    overflow-wrap: anywhere;
}

.detail-row-stack {
    grid-template-columns: 1fr;
    gap: 8px;
}

.mono-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
}

.card-empty-state {
    display: grid;
    gap: 6px;
    min-height: 150px;
    place-content: center;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

.card-empty-state strong {
    color: var(--text);
}

.compact-empty {
    min-height: 92px;
}

.memo-box {
    margin: 20px 21px 22px;
    border: 1px solid #d9e1ec;
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 14px 15px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.detail-row .memo-box {
    margin: 0;
}

.error-box {
    border-color: #f1c5c0;
    background: #fff7f6;
    color: #922b21;
}

.not-found-card {
    display: grid;
    justify-items: center;
    min-height: 360px;
    place-content: center;
    padding: 32px;
    text-align: center;
}

.not-found-card .brand-mark {
    margin-bottom: 18px;
}

@media (max-width: 820px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-card-wide {
        grid-column: auto;
    }

    .detail-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 21px;
    }

    .status-summary {
        justify-items: start;
    }
}

@media (max-width: 560px) {
    .detail-shell {
        width: min(100% - 18px, 1220px);
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 13px 17px;
    }

    .detail-card-heading {
        padding-inline: 17px;
    }

    .memo-box {
        margin-inline: 17px;
    }
}


/* Physical shipping address */
.shipping-address-block {
    display: grid;
    gap: 0.25rem;
    line-height: 1.65;
}

.shipping-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
}


/* Admin memo editor */
.memo-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.memo-limit {
    flex: 0 0 auto;
    border-radius: 999px;
    background: #edf3ff;
    color: #315aab;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 750;
}

.memo-edit-form {
    display: grid;
    gap: 9px;
    padding: 20px 21px 22px;
}

.memo-textarea {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid #cfd7e3;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    padding: 13px 14px;
    font: inherit;
    line-height: 1.65;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.memo-textarea:focus {
    border-color: #6c92ee;
    box-shadow: 0 0 0 3px rgba(35, 86, 216, 0.12);
}

.memo-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 3px;
}

.memo-hint {
    color: var(--muted);
    font-size: 0.8rem;
}

.success-message {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 18px 21px 0;
    border: 1px solid #b7e2c7;
    border-radius: 11px;
    background: #effaf3;
    color: #17663a;
    padding: 11px 13px;
    font-size: 0.88rem;
    font-weight: 700;
}

.success-mark {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: #d9f2e2;
    font-weight: 900;
}

@media (max-width: 560px) {
    .memo-card-heading,
    .memo-editor-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .memo-limit {
        align-self: flex-start;
    }

    .memo-edit-form {
        padding-inline: 17px;
    }

    .memo-editor-footer .primary-button {
        width: 100%;
    }

    .success-message {
        margin-inline: 17px;
    }
}

/* Step 4: 注文登録 */
.section-heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.create-order-link {
    min-height: 34px;
    padding-inline: 14px;
    white-space: nowrap;
}

.create-shell {
    width: min(1220px, calc(100% - 28px));
}

.create-hero,
.form-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.create-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 24px 26px;
}

.create-hero h2 {
    margin-bottom: 7px;
}

.create-form {
    display: grid;
    gap: 18px;
}

.form-validation-summary:empty {
    display: none;
}

.form-validation-summary:not(:empty) {
    border: 1px solid #f1c5c0;
    border-radius: 12px;
    background: #fff7f6;
    padding: 13px 15px;
}

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

.form-card {
    min-width: 0;
    overflow: hidden;
}

.form-card-wide {
    grid-column: 1 / -1;
}

.form-card-body {
    padding: 20px 21px 22px;
}

.form-fields-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field-span-two {
    grid-column: 1 / -1;
}

.required-mark {
    display: inline-flex;
    margin-left: 5px;
    border-radius: 999px;
    background: #fbe7e5;
    color: #a5372c;
    padding: 1px 6px;
    font-size: 0.68rem;
    font-weight: 800;
    vertical-align: 1px;
}

.field-hint {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.55;
}

.input-with-suffix {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 8px;
}

.payment-note {
    border-radius: 10px;
    background: var(--surface-soft);
    padding: 10px 12px;
}

.shipping-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.shipping-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    color: #344054;
    font-size: 0.86rem;
    font-weight: 750;
    user-select: none;
}

.shipping-toggle > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    position: relative;
    display: inline-flex;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #cbd3df;
    transition: background 0.16s ease;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.25);
    transition: transform 0.16s ease;
}

.shipping-toggle > input:checked + .toggle-track {
    background: var(--primary);
}

.shipping-toggle > input:checked + .toggle-track .toggle-thumb {
    transform: translateX(18px);
}

.shipping-toggle > input:focus-visible + .toggle-track {
    box-shadow: 0 0 0 3px rgba(35, 86, 216, 0.18);
}

.shipping-form-area[hidden],
.card-empty-state[hidden] {
    display: none;
}

.shipping-info-banner {
    display: flex;
    align-items: center;
    gap: 8px 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid #dbe6f6;
    background: #f4f8ff;
    color: #31528a;
    padding: 12px 21px;
    font-size: 0.82rem;
}

.shipping-info-banner span {
    color: #5d6f8c;
}

.shipping-fields-grid {
    display: grid;
    grid-template-columns: 150px repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.create-memo-textarea {
    min-height: 130px;
}

.create-actions {
    position: sticky;
    bottom: 14px;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border: 1px solid rgba(207, 216, 228, 0.92);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 30px rgba(37, 52, 80, 0.13);
    padding: 12px;
    backdrop-filter: blur(12px);
}

.create-submit-button {
    min-width: 150px;
}

.create-submit-button:disabled {
    cursor: wait;
    opacity: 0.68;
    transform: none;
}

@media (max-width: 900px) {
    .create-grid {
        grid-template-columns: 1fr;
    }

    .form-card-wide {
        grid-column: auto;
    }

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

@media (max-width: 650px) {
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading-actions {
        width: 100%;
        justify-content: space-between;
    }

    .create-shell {
        width: min(100% - 18px, 1220px);
    }

    .create-hero,
    .shipping-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .create-hero {
        padding: 21px;
    }

    .form-card-body,
    .shipping-info-banner {
        padding-inline: 17px;
    }

    .form-fields-two-column,
    .shipping-fields-grid {
        grid-template-columns: 1fr;
    }

    .field-span-two,
    .field-span-two-mobile {
        grid-column: auto;
    }

    .shipping-toggle {
        width: 100%;
    }

    .create-actions {
        bottom: 8px;
    }

    .create-actions > * {
        flex: 1;
    }
}

.detail-page-message {
    margin: 0 0 18px;
}

/* 注文登録: 郵便番号から住所を補完 */
.postal-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.postal-search-button {
    min-width: 88px;
    white-space: nowrap;
}

.postal-search-button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.postal-search-status {
    min-height: 1.35em;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.postal-search-status:empty {
    display: none;
}

.postal-search-status.is-info {
    color: #31528a;
}

.postal-search-status.is-success {
    color: #17663a;
    font-weight: 700;
}

.postal-search-status.is-error {
    color: #a5372c;
    font-weight: 700;
}

.postal-search-results {
    border: 1px solid #d7e2f3;
    border-radius: 12px;
    background: #f8faff;
    padding: 13px;
}

.postal-search-results[hidden] {
    display: none;
}

.postal-search-results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    color: #344054;
    font-size: 0.82rem;
}

.postal-search-results-heading span {
    color: var(--muted);
    font-size: 0.76rem;
}

.postal-search-candidates {
    display: grid;
    gap: 8px;
}

.postal-candidate-button {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    border: 1px solid #d6deea;
    border-radius: 10px;
    background: #fff;
    color: #263348;
    padding: 11px 12px;
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.postal-candidate-button:hover,
.postal-candidate-button:focus-visible {
    border-color: #87a7e9;
    background: #f5f8ff;
    box-shadow: 0 0 0 3px rgba(35, 86, 216, 0.1);
    outline: none;
}

.postal-candidate-button.is-selected {
    border-color: var(--primary);
    background: #eef3ff;
}

.postal-candidate-button strong {
    line-height: 1.45;
}

.postal-candidate-button span {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

@media (max-width: 650px) {
    .postal-search-row {
        grid-template-columns: 1fr;
    }

    .postal-search-button {
        width: 100%;
    }

    .postal-candidate-button {
        flex-direction: column;
        gap: 4px;
    }
}

/* 注文登録: 未登録の購入者を同じ画面で作成 */
.buyer-email-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.buyer-register-toggle {
    min-width: 160px;
    white-space: nowrap;
}

.buyer-registration-message {
    border: 1px solid #cbd9ee;
    border-radius: 10px;
    background: #f4f8ff;
    color: #31528a;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.5;
}

.buyer-registration-message.is-success {
    border-color: #b9dec8;
    background: #f0faf4;
    color: #17663a;
}

.buyer-registration-panel {
    overflow: hidden;
    border: 1px solid #cbd9ee;
    border-radius: 12px;
    background: #f8faff;
}

.buyer-registration-panel[hidden] {
    display: none;
}

.buyer-registration-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #dce6f4;
    padding: 14px 15px 12px;
}

.buyer-registration-heading h3 {
    margin: 2px 0 0;
    color: #263348;
    font-size: 1rem;
}

.buyer-registration-target {
    max-width: 55%;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.buyer-registration-target strong {
    color: #344054;
}

.buyer-registration-fields {
    display: grid;
    gap: 13px;
    padding: 15px;
}

.buyer-registration-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #dce6f4;
    background: #f2f6fc;
    padding: 12px 15px;
}

.buyer-registration-footer > span {
    color: #5d6f8c;
    font-size: 0.76rem;
    line-height: 1.5;
}

.buyer-registration-footer .primary-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.buyer-registration-footer .primary-button:disabled {
    cursor: wait;
    opacity: 0.68;
}

@media (max-width: 650px) {
    .buyer-email-row {
        grid-template-columns: 1fr;
    }

    .buyer-register-toggle {
        width: 100%;
    }

    .buyer-registration-heading,
    .buyer-registration-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .buyer-registration-target {
        max-width: none;
    }

    .buyer-registration-footer .primary-button {
        width: 100%;
    }
}

/* Buyer registration */

.register-password-hint {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.55;
}

.register-success {
    margin-top: 28px;
    text-align: center;
}

.register-success-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #e4f7eb;
    color: #18753f;
    font-size: 1.8rem;
    font-weight: 900;
}

.register-success h2 {
    margin-bottom: 12px;
}

.register-success p {
    line-height: 1.65;
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

/* Buyer account result */

.account-result-card {
    text-align: center;
}

.account-result-card .brand-mark {
    margin-left: auto;
    margin-right: auto;
}

.account-result-card .eyebrow {
    text-align: center;
}

.account-result-mark {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 24px auto 20px;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 900;
}

.account-result-mark.success {
    background: #e4f7eb;
    color: #18753f;
}

.account-result-mark.error {
    background: #fff0ee;
    color: #b42318;
}

.account-result-message {
    margin: 18px 0 10px;
    font-weight: 700;
    line-height: 1.7;
}

.account-page-actions {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.account-page-actions .primary-button,
.account-page-actions .secondary-button {
    width: 100%;
}

.close-hint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.6;
}

/* ================================================================
   Admin Order Details - License maintenance
   ================================================================ */

.license-admin-panel,
.license-danger-zone {
    margin: 18px 21px 0;
    border-radius: 12px;
}

.license-admin-panel {
    border: 1px solid #dfe6f1;
    background: #f8faff;
}

.license-admin-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 15px;
    border-bottom: 1px solid #e2e8f2;
}

.license-admin-panel-heading > div {
    display: grid;
    gap: 3px;
}

.license-admin-panel-heading strong {
    color: #253552;
    font-size: 0.88rem;
}

.license-admin-panel-heading span,
.license-device-copy span,
.license-reissue-hint {
    color: var(--muted);
    font-size: 0.76rem;
}

.license-device-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    border-radius: 999px;
    background: #eaf1ff;
    color: #315ca8 !important;
    padding: 5px 9px;
    font-weight: 800;
}

.license-device-list {
    display: grid;
}

.license-device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 15px;
    border-top: 1px solid #e7ecf4;
}

.license-device-row:first-child {
    border-top: none;
}

.license-device-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.license-device-copy strong {
    overflow-wrap: anywhere;
    color: #273957;
    font-size: 0.86rem;
}

.license-device-empty {
    padding: 15px;
    color: var(--muted);
    font-size: 0.8rem;
}

.license-device-revoke-button,
.license-reissue-button {
    border: 1px solid transparent;
    border-radius: 9px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.license-device-revoke-button {
    border-color: #e6c6c1;
    background: #fff8f7;
    color: #9b4037;
    padding: 7px 11px;
}

.license-device-revoke-button:hover {
    background: #fff0ee;
}

.license-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #edc7c1;
    background: #fff8f7;
    padding: 14px 15px;
}

.license-danger-copy {
    display: grid;
    gap: 4px;
}

.license-danger-copy strong {
    color: #8f342d;
    font-size: 0.86rem;
}

.license-danger-copy span {
    color: #815c58;
    font-size: 0.76rem;
    line-height: 1.55;
}

.license-reissue-button {
    border-color: #c95549;
    background: #b84036;
    color: #fff;
    padding: 8px 13px;
}

.license-reissue-button:hover {
    background: #a63830;
}

.license-reissue-hint {
    max-width: 250px;
    text-align: right;
    line-height: 1.5;
}

@media (max-width: 650px) {
    .license-admin-panel-heading,
    .license-device-row,
    .license-danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .license-device-count {
        align-self: flex-start;
    }

    .license-device-revoke-button,
    .license-reissue-button {
        width: 100%;
    }

    .license-reissue-hint {
        max-width: none;
        text-align: left;
    }
}

/* ================================================================
   Service management
   ================================================================ */

.service-admin-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 24px 26px;
    border: 1px solid #dfe6f1;
    border-radius: 16px;
    background: #fff;
}

.service-admin-hero h2,
.service-admin-heading h2 {
    margin: 2px 0 0;
    color: #243653;
}

.service-admin-count {
    display: grid;
    min-width: 100px;
    text-align: center;
}

.service-admin-count strong {
    color: #285fce;
    font-size: 2rem;
}

.service-admin-count span {
    color: #8794a8;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.service-admin-card {
    overflow: hidden;
    border: 1px solid #dfe6f1;
    border-radius: 16px;
    background: #fff;
}

.service-admin-heading {
    padding: 20px 22px 16px;
}

.service-admin-table-scroll {
    overflow-x: auto;
}

.service-admin-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
}

.service-admin-table th,
.service-admin-table td {
    padding: 14px 16px;
    border-top: 1px solid #edf0f5;
    text-align: left;
    vertical-align: middle;
}

.service-admin-table th {
    background: #f8fafd;
    color: #7d899d;
    font-size: 0.7rem;
    font-weight: 800;
}

.service-admin-table td {
    color: #40506a;
    font-size: 0.82rem;
}

.service-admin-table td:first-child {
    min-width: 220px;
}

.service-admin-table td:first-child strong,
.service-admin-table td:first-child small {
    display: block;
}

.service-admin-table td:first-child small {
    margin-top: 4px;
    color: #9aa5b5;
    font-family:
        ui-monospace,
        SFMono-Regular,
        Consolas,
        monospace;
    font-size: 0.64rem;
}

.status-trial {
    border-color: #cadcff;
    background: #edf3ff;
    color: #285fce;
}

/* ================================================================
   Admin navigation
   ================================================================ */

.admin-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 12px;
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;
    padding: 8px 18px;

    border: 1px solid transparent;
    border-radius: 10px;

    color: #62718a;
    font-size: 0.82rem;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.admin-nav-link:hover {
    border-color: #d9e2ef;
    background: #f6f8fc;
    color: #285fce;
}

.admin-nav-link.is-active {
    border-color: #cadcff;
    background: #edf3ff;
    color: #285fce;
}


/* tablet */
@media (max-width: 900px) {

    .topbar {
        flex-wrap: wrap;
    }

    .admin-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-top: 4px;
    }
}

.service-admin-actions {
    display: grid;
    gap: 8px;
    min-width: 150px;
}

.controller-benefit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #bde5ce;
    border-radius: 9px;
    background: #eefaf3;
    color: #218653;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.service-history-cell {
    min-width: 280px;
}

.service-history summary {
    cursor: pointer;
    color: #285fce;
    font-weight: 800;
}

.service-history-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.service-history-item {
    padding: 12px;
    border: 1px solid #e3e9f2;
    border-radius: 10px;
    background: #f9fbfe;
}

.service-history-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.service-history-title time {
    color: #8a97aa;
    font-size: 0.68rem;
    white-space: nowrap;
}

.service-history-period {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    color: #77859a;
    font-size: 0.72rem;
}

.service-history-period strong {
    color: #294d8f;
}

.service-history-item p {
    margin: 8px 0 0;
    color: #62718a;
    font-size: 0.72rem;
}

.service-history-item small {
    display: block;
    margin-top: 6px;
    color: #9ba6b6;
    font-size: 0.65rem;
}

.service-adjust-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.service-adjust-form input {
    width: 70px;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid #d8e0ec;
    border-radius: 8px;
    font: inherit;
}


.service-license-reissue-form {
    margin-top: 8px;
}

.service-license-list {
    display: grid;
    gap: 10px;
    min-width: 190px;
}

.service-license-item {
    padding: 10px;
    border: 1px solid #e3e9f2;
    border-radius: 10px;
    background: #fbfcff;
}

.service-license-item strong,
.service-license-item code,
.service-license-item span,
.service-license-item small {
    display: block;
}

.service-license-item code {
    margin-top: 2px;
    color: #78869b;
    font-size: 0.66rem;
}

.service-license-item span {
    margin-top: 6px;
    color: #334662;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 700;
}

.service-license-item small {
    margin-top: 3px;
    color: #8995a8;
}

.service-license-reissue-button {
    min-height: 30px;
    padding: 5px 9px;
    border-color: #e4c8c5;
    background: #fff9f8;
    color: #9a463e;
    font-size: 0.7rem;
    white-space: nowrap;
}

.service-license-reissue-button:hover {
    border-color: #d9aaa5;
    background: #fff0ee;
    color: #873930;
}

/* ================================================================
   Admin Users
   ================================================================ */

.user-admin-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.user-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid #dbe4ef;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 26px rgba(39, 55, 82, 0.05);
}

.user-summary-card span {
    color: #697990;
    font-size: 0.78rem;
    font-weight: 750;
}

.user-summary-card strong {
    color: #24324a;
    font-size: 1.75rem;
    line-height: 1;
}

.user-summary-card.warning {
    border-color: #f2dfb3;
    background: #fffaf0;
}

.user-summary-card.warning strong {
    color: #a56a00;
}

.user-summary-card.service {
    border-color: #cadcff;
    background: #f7faff;
}

.user-summary-card.service strong {
    color: #285fce;
}

.user-search-grid {
    grid-template-columns: minmax(260px, 2fr) minmax(150px, 0.8fr) 120px auto;
}

.user-list-heading {
    margin-bottom: 18px;
}

.user-delete-note {
    max-width: 440px;
    text-align: right;
    font-size: 0.75rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1260px;
}

.users-table th,
.users-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #e8edf4;
    vertical-align: top;
    text-align: left;
}

.users-table th {
    background: #f8fafd;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.users-table td {
    color: #334155;
    font-size: 0.78rem;
}

.user-identity-cell {
    min-width: 250px;
}

.user-identity-cell strong,
.user-identity-cell .subtext,
.user-identity-cell .user-id {
    display: block;
}

.user-id {
    margin-top: 5px;
    color: #9aa5b5;
    font-size: 0.62rem;
    word-break: break-all;
}

.admin-user-badge {
    display: inline-flex;
    align-items: center;
    margin-top: 7px;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid #c8b9f4;
    border-radius: 999px;
    background: #f5f1ff;
    color: #6843c4;
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.06em;
}

.user-data-counts {
    display: grid;
    gap: 5px;
    min-width: 95px;
}

.user-data-counts span {
    color: #748096;
    white-space: nowrap;
}

.user-data-counts strong {
    color: #334155;
}

.user-delete-form {
    margin: 0;
}

.resend-confirmation-form {
    margin-top: 8px;
}

.resend-confirmation-form .secondary-button {
    white-space: nowrap;
}

.compact-button {
    min-height: 34px;
    padding: 6px 13px;
    font-size: 0.72rem;
}

.delete-blocked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 31px;
    padding: 5px 10px;
    border: 1px solid #e3e7ed;
    border-radius: 9px;
    background: #f7f8fa;
    color: #9aa5b5;
    font-size: 0.7rem;
    font-weight: 750;
}

@media (max-width: 900px) {
    .user-admin-summary {
        grid-template-columns: 1fr;
    }

    .user-search-grid {
        grid-template-columns: 1fr;
    }

    .user-delete-note {
        max-width: none;
        text-align: left;
    }
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #efb8b8;
    border-radius: 10px;
    background: #fff5f5;
    color: #c43d3d;
    font-weight: 800;
    cursor: pointer;
}

.danger-button:hover {
    border-color: #e58f8f;
    background: #ffecec;
    color: #a92828;
}


/* ================================================================
   Admin confirmation modal
   ================================================================ */

body.admin-modal-open {
    overflow: hidden;
}

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

.admin-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(3px);
    animation: admin-confirm-fade 0.14s ease-out;
}

.admin-confirm-dialog {
    position: relative;
    width: min(480px, 100%);
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
    animation: admin-confirm-rise 0.16s ease-out;
}

.admin-confirm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #dce4ef;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.admin-confirm-close:hover {
    background: #eef2f7;
    color: #334155;
}

.admin-confirm-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 18px;
    border-radius: 13px;
    background: #edf3ff;
    color: #2458d7;
    font-size: 1.15rem;
    font-weight: 900;
}

.admin-confirm-dialog.is-danger .admin-confirm-icon {
    background: #fff0f0;
    color: #c43d3d;
}

.admin-confirm-dialog.is-warning .admin-confirm-icon {
    background: #fff7e8;
    color: #b36b00;
}

.admin-confirm-dialog h2 {
    margin: 0 42px 10px 0;
    color: #172033;
    font-size: 1.18rem;
}

.admin-confirm-dialog p {
    margin: 0;
    color: #667085;
    font-size: 0.9rem;
    line-height: 1.75;
    white-space: pre-line;
}

.admin-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
}

.admin-confirm-actions button {
    min-width: 104px;
}

.admin-confirm-submit.admin-confirm-danger,
.admin-confirm-danger {
    border-color: #d92d20;
    background: #d92d20;
    color: #ffffff;
}

.admin-confirm-danger:hover {
    border-color: #b42318;
    background: #b42318;
}

.admin-confirm-warning {
    border-color: #d99000;
    background: #d99000;
    color: #ffffff;
}

.admin-confirm-warning:hover {
    border-color: #b87300;
    background: #b87300;
}

@keyframes admin-confirm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes admin-confirm-rise {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 560px) {
    .admin-confirm-overlay {
        padding: 14px;
    }

    .admin-confirm-dialog {
        padding: 24px 20px 20px;
        border-radius: 15px;
    }

    .admin-confirm-actions {
        flex-direction: column-reverse;
    }

    .admin-confirm-actions button {
        width: 100%;
    }
}

/* ================================================================
   AI Review management
   ================================================================ */

.ai-admin-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.ai-admin-summary-card {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid #dbe4ef;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 26px rgba(39, 55, 82, 0.05);
}

.ai-admin-summary-card span {
    color: #697990;
    font-size: 0.74rem;
    font-weight: 800;
}

.ai-admin-summary-card strong {
    overflow: hidden;
    color: #24324a;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-admin-summary-card small {
    color: #98a3b3;
    font-size: 0.66rem;
    font-weight: 700;
}

.ai-admin-summary-card.cost {
    border-color: #cfe0fb;
    background: #f7faff;
}

.ai-admin-summary-card.cost strong {
    color: #285fce;
}

.ai-admin-summary-card.time {
    border-color: #d7e9df;
    background: #f7fcf9;
}

.ai-admin-summary-card.time strong {
    color: #218653;
}

.ai-admin-summary-card.score {
    border-color: #e2d9f6;
    background: #fbf9ff;
}

.ai-admin-summary-card.score strong {
    color: #6843c4;
}

.ai-admin-filter-card {
    padding-bottom: 16px;
}

.ai-admin-filter-grid {
    display: grid;
    grid-template-columns: 180px 120px auto;
    align-items: end;
    gap: 14px;
}

.ai-admin-cost-note {
    margin: 14px 0 0;
    font-size: 0.72rem;
}

.ai-admin-table {
    width: 100%;
    min-width: 1800px;
    border-collapse: collapse;
}

.ai-admin-table th,
.ai-admin-table td {
    padding: 12px 13px;
    border-bottom: 1px solid #e8edf4;
    text-align: left;
    vertical-align: top;
}

.ai-admin-table th {
    background: #f8fafd;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.ai-admin-table td {
    color: #334155;
    font-size: 0.76rem;
}

.ai-admin-table tbody tr:hover {
    background: #f9fbff;
}

.ai-admin-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 850;
}

.ai-admin-status.success {
    border-color: #bde5ce;
    background: #eefaf3;
    color: #218653;
}

.ai-admin-status.failed {
    border-color: #efc5c5;
    background: #fff4f4;
    color: #bd3f3f;
}

.ai-admin-user-cell,
.ai-admin-model-cell,
.ai-admin-input-cell {
    min-width: 175px;
}

.ai-admin-user-cell strong,
.ai-admin-user-cell small,
.ai-admin-model-cell strong,
.ai-admin-model-cell small,
.ai-admin-input-cell span,
.ai-admin-input-cell small {
    display: block;
}

.ai-admin-user-cell small,
.ai-admin-model-cell small,
.ai-admin-input-cell small {
    margin-top: 4px;
    color: #98a3b3;
    font-size: 0.64rem;
}

.ai-admin-user-cell small {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ai-admin-score {
    color: #285fce;
    font-size: 1rem;
}

.ai-admin-cost-cell {
    color: #285fce !important;
    font-weight: 850;
}

.ai-admin-response-cell {
    min-width: 240px;
    max-width: 360px;
}

.ai-admin-response-cell code {
    display: block;
    color: #697990;
    font-size: 0.64rem;
    overflow-wrap: anywhere;
}

.ai-admin-error-text {
    display: block;
    margin-top: 5px;
    color: #b42318;
    font-size: 0.67rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
    .ai-admin-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ai-admin-summary {
        grid-template-columns: 1fr;
    }

    .ai-admin-filter-grid {
        grid-template-columns: 1fr;
    }
}

.ai-admin-summary-card.storage {
    border-color: #d4e0ec;
    background: #f8fbfe;
}

.ai-admin-summary-card.storage strong {
    color: #38658c;
}

/* ================================================================
   Admin - Announcements
   ================================================================ */

.announcement-admin-shell {
    width: min(1420px, calc(100% - 28px));
}

.announcement-admin-message {
    margin: 0 0 18px;
}

.announcement-admin-grid {
    display: grid;
    grid-template-columns: minmax(330px, 0.72fr) minmax(520px, 1.28fr);
    align-items: start;
    gap: 18px;
}

.announcement-editor-card,
.announcement-list-card {
    min-width: 0;
}

.announcement-editor-card {
    position: sticky;
    top: 94px;
}

.announcement-admin-card-heading,
.announcement-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 21px 16px;
    border-bottom: 1px solid #e5eaf1;
}

.announcement-list-heading {
    margin-bottom: 0;
}

.announcement-editor-form {
    display: grid;
    gap: 16px;
    padding: 20px 21px 22px;
}

.announcement-editor-textarea {
    width: 100%;
    min-height: 190px;
    resize: vertical;
    border: 1px solid #cfd7e3;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    font: inherit;
    line-height: 1.65;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.announcement-editor-textarea:focus {
    border-color: #6c92ee;
    box-shadow: 0 0 0 3px rgba(35, 86, 216, 0.12);
}

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

.announcement-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #dfe5ee;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
}

.announcement-option input {
    width: 17px;
    min-width: 17px;
    height: 17px;
    min-height: 17px;
    margin: 2px 0 0;
    padding: 0;
}

.announcement-option span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.announcement-option strong {
    color: #344054;
    font-size: 0.78rem;
}

.announcement-option small {
    color: #7b8799;
    font-size: 0.68rem;
    line-height: 1.45;
}

.announcement-editor-actions {
    display: flex;
    justify-content: flex-end;
}

.announcement-editor-actions .primary-button {
    min-width: 150px;
}

.announcement-admin-list {
    display: grid;
}

.announcement-admin-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    padding: 17px 20px;
    border-bottom: 1px solid #e7ebf1;
}

.announcement-admin-item:last-child {
    border-bottom: 0;
}

.announcement-admin-item.is-draft {
    background: #fbfcfe;
}

.announcement-admin-item-main {
    min-width: 0;
}

.announcement-admin-item-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    color: #7b8799;
    font-size: 0.68rem;
}

.announcement-admin-important {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fff0d5;
    color: #955c00;
    font-size: 0.69rem;
    font-weight: 850;
}

.announcement-admin-item h3 {
    margin: 0 0 7px;
    color: #253149;
    font-size: 0.95rem;
}

.announcement-admin-item p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: #667085;
    font-size: 0.78rem;
    line-height: 1.65;
    white-space: pre-line;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.announcement-admin-item-dates {
    margin-top: 9px;
    color: #8a96a8;
    font-size: 0.65rem;
}

.announcement-admin-item-actions {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.announcement-admin-item-actions form {
    margin: 0;
}

@media (max-width: 1040px) {
    .announcement-admin-grid {
        grid-template-columns: 1fr;
    }

    .announcement-editor-card {
        position: static;
    }
}

@media (max-width: 650px) {
    .announcement-options,
    .announcement-admin-item {
        grid-template-columns: 1fr;
    }

    .announcement-admin-item-actions {
        justify-content: flex-start;
    }
}

/* ------------------------------------------------------------------
   Support inquiries
   ------------------------------------------------------------------ */
.support-admin-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 42px;
}

.support-admin-message {
    margin-bottom: 16px;
}

.support-admin-card {
    padding: 22px;
}

.support-admin-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.support-admin-item {
    padding: 17px 18px;
    border: 1px solid #dfe5ee;
    border-radius: 12px;
    background: #ffffff;
}

.support-admin-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.support-admin-title-group {
    min-width: 0;
}

.support-admin-title-group h3 {
    margin: 7px 0 3px;
    color: #25344f;
    font-size: 1rem;
}

.support-admin-meta,
.support-admin-mail-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: #718097;
    font-size: 0.75rem;
}

.support-reference {
    color: #8a97a9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.73rem;
}

.support-admin-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.support-admin-item-actions form {
    margin: 0;
}

.support-status-form {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.support-status-form select {
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid #cfd7e3;
    border-radius: 8px;
    background: #ffffff;
}

.support-admin-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 13px;
    color: #77859a;
    font-size: 0.78rem;
}

.support-admin-user-row a {
    color: #285fce;
    font-weight: 700;
    text-decoration: none;
}

.support-admin-user-row a:hover {
    text-decoration: underline;
}

.support-admin-body {
    margin: 13px 0;
    padding: 13px 14px;
    border-radius: 9px;
    color: #3e4d63;
    background: #f7f9fc;
    font-size: 0.87rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.support-admin-mail-state .is-ok {
    color: #23835b;
}

.support-admin-mail-state .is-warning {
    color: #ad6a18;
}

@media (max-width: 760px) {
    .support-admin-item-header {
        flex-direction: column;
    }

    .support-admin-item-actions {
        width: 100%;
        align-items: stretch;
        flex-wrap: wrap;
    }

    .support-status-form {
        flex: 1 1 260px;
    }

    .support-status-form select {
        flex: 1;
    }

    .support-admin-item-actions > form:last-child {
        flex: 0 0 auto;
    }
}

/* ================================================================
   Review / Ticket operations dashboard
   ================================================================ */

.ai-ops-shell {
    width: min(1680px, calc(100% - 28px));
}

.ai-ops-filter-card {
    margin-bottom: 18px;
}

.ai-ops-filter-grid {
    display: grid;
    grid-template-columns: 150px 140px 150px 130px auto;
    align-items: end;
    gap: 14px;
}

.ai-ops-filter-grid input[type="number"] {
    width: 100%;
}

.ai-ops-fx-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 11px;
    border: 1px solid #d7e2f1;
    border-radius: 999px;
    background: #f8fbff;
    color: #58708d;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.ai-ops-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-admin-summary-card.qa {
    border-color: #d9d2f3;
    background: #fbf9ff;
}

.ai-admin-summary-card.qa strong {
    color: #6843c4;
}

.ai-admin-summary-card.ticket-use {
    border-color: #f0d8b8;
    background: #fffaf3;
}

.ai-admin-summary-card.ticket-use strong {
    color: #b56b0d;
}

.ai-admin-summary-card.ticket-balance {
    border-color: #cae7da;
    background: #f7fcf9;
}

.ai-admin-summary-card.ticket-balance strong {
    color: #218653;
}

.ai-admin-summary-card.ticket-sale {
    border-color: #cfe0fb;
    background: #f7faff;
}

.ai-admin-summary-card.ticket-sale strong {
    color: #285fce;
}

.ai-admin-summary-card.ticket-free {
    border-color: #e7dce9;
    background: #fdf9fd;
}

.ai-admin-summary-card.ticket-free strong {
    color: #8b4f8e;
}

.ai-ops-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
    margin-bottom: 18px;
}

.ai-ops-card-heading {
    padding: 18px 20px 14px;
    margin: 0;
    border-bottom: 1px solid #e7ecf3;
}

.ai-ops-breakdown-card,
.ai-ops-ticket-card,
.ai-ops-ticket-log-card {
    min-width: 0;
}

.ai-ops-breakdown-table,
.ai-ops-ticket-flow-table,
.ai-ops-ticket-log-table {
    width: 100%;
    border-collapse: collapse;
}

.ai-ops-breakdown-table {
    min-width: 900px;
}

.ai-ops-ticket-flow-table {
    min-width: 520px;
}

.ai-ops-ticket-log-table {
    min-width: 1180px;
}

.ai-ops-breakdown-table th,
.ai-ops-breakdown-table td,
.ai-ops-ticket-flow-table th,
.ai-ops-ticket-flow-table td,
.ai-ops-ticket-log-table th,
.ai-ops-ticket-log-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #e8edf4;
    color: #334155;
    font-size: 0.74rem;
    text-align: left;
    vertical-align: top;
}

.ai-ops-breakdown-table th,
.ai-ops-ticket-flow-table th,
.ai-ops-ticket-log-table th {
    background: #f8fafd;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.ai-ops-breakdown-table tbody tr:hover,
.ai-ops-ticket-flow-table tbody tr:hover,
.ai-ops-ticket-log-table tbody tr:hover {
    background: #f9fbff;
}

.ai-ops-breakdown-table small {
    display: block;
    margin-top: 3px;
    color: #9aa6b5;
    font-size: 0.61rem;
    font-weight: 700;
    white-space: nowrap;
}

.ai-ops-total-cost {
    color: #234fc1 !important;
    font-weight: 900;
}

.compact-empty {
    min-height: 110px;
}

.ticket-ops-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
}

.ticket-flow-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid #d8e0ea;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 850;
}

.ticket-flow-type.type-purchase {
    border-color: #c9dcfb;
    background: #f3f7ff;
    color: #285fce;
}

.ticket-flow-type.type-consume {
    border-color: #ecd7bc;
    background: #fff9ef;
    color: #ad650a;
}

.ticket-flow-type.type-refund {
    border-color: #cce8d9;
    background: #f1fbf6;
    color: #218653;
}

.ticket-flow-type.type-grant,
.ticket-flow-type.type-bonus {
    border-color: #ded4f2;
    background: #faf7ff;
    color: #6843c4;
}

.ticket-amount {
    font-weight: 900;
}

.ticket-amount.plus {
    color: #218653 !important;
}

.ticket-amount.minus {
    color: #b56b0d !important;
}

.ticket-price-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 18px 20px 8px;
}

.ticket-price-summary > div {
    display: grid;
    gap: 5px;
    padding: 14px 15px;
    border: 1px solid #e1e8f1;
    border-radius: 12px;
    background: #fafcff;
}

.ticket-price-summary span,
.ticket-price-summary small {
    color: #8491a3;
    font-size: 0.64rem;
    font-weight: 750;
}

.ticket-price-summary strong {
    color: #285fce;
    font-size: 1.3rem;
}

.ticket-pack-list {
    display: grid;
    gap: 8px;
    padding: 10px 20px 20px;
}

.ticket-pack-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid #e7ecf3;
    border-radius: 10px;
    background: #fff;
}

.ticket-pack-row > div {
    display: grid;
    gap: 2px;
}

.ticket-pack-row strong {
    color: #334155;
    font-size: 0.78rem;
}

.ticket-pack-row small {
    color: #9aa6b5;
    font-size: 0.6rem;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ticket-pack-row span {
    color: #334155;
    font-size: 0.76rem;
    font-weight: 850;
}

.ticket-pack-row em {
    color: #285fce;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 850;
    white-space: nowrap;
}

.ai-ops-warning {
    margin: 0 20px 18px;
    padding: 10px 12px;
    border: 1px solid #f0d8b8;
    border-radius: 10px;
    background: #fff9ef;
    color: #8d5b18;
    font-size: 0.68rem;
    line-height: 1.55;
}

.ai-ops-ticket-log-card {
    margin-bottom: 18px;
}

.ticket-log-memo {
    min-width: 190px;
    max-width: 320px;
}

.ticket-log-memo span,
.ticket-log-memo small {
    display: block;
}

.ticket-log-memo small {
    margin-top: 4px;
    color: #9aa6b5;
    font-size: 0.61rem;
    overflow-wrap: anywhere;
}

.ticket-log-reference {
    min-width: 260px;
    max-width: 380px;
}

.ticket-log-reference code {
    color: #697990;
    font-size: 0.62rem;
    overflow-wrap: anywhere;
}

.ai-ops-log-heading {
    margin-top: 0;
}

@media (max-width: 1320px) {
    .ai-ops-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ai-ops-filter-grid {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
    }

    .ai-ops-filter-grid .search-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 980px) {
    .ai-ops-two-column,
    .ticket-ops-grid {
        grid-template-columns: 1fr;
    }

    .ai-ops-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ai-ops-filter-grid,
    .ai-ops-summary,
    .ticket-price-summary {
        grid-template-columns: 1fr;
    }

    .ticket-pack-row {
        grid-template-columns: 1fr auto;
    }

    .ticket-pack-row em {
        grid-column: 1 / -1;
    }
}

/* 招待リンク経由の新規登録 */
.register-invite-panel {
    margin: 14px 0 18px;
    padding: 12px 14px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.06);
}

.register-invite-title {
    margin-bottom: 4px;
    font-weight: 700;
}

/* ================================================================
   Admin User Delete Confirmation
   ================================================================ */

.user-delete-confirm-hero {
    border-color: #efc6c6;
    background: linear-gradient(135deg, #fffafa 0%, #ffffff 70%);
}

.danger-eyebrow {
    color: #c43d3d;
}

.user-delete-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 8px 20px 18px;
}

.user-delete-summary-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border-bottom: 1px solid #edf0f5;
}

.user-delete-summary-grid span {
    color: #748096;
    font-size: 0.78rem;
    font-weight: 700;
}

.user-delete-summary-grid strong {
    color: #334155;
    font-size: 1rem;
}

.user-delete-final-card {
    border-color: #efc6c6;
    background: #fffafa;
    padding: 22px;
}

.user-delete-final-copy {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.user-delete-danger-icon {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid #efc1c1;
    border-radius: 12px;
    background: #fff1f1;
    font-size: 1.25rem;
}

.user-delete-final-copy h2 {
    margin: 0 0 7px;
    color: #a92828;
    font-size: 1.05rem;
}

.user-delete-final-copy p {
    max-width: 820px;
    margin: 0;
    color: #6f5960;
    line-height: 1.7;
}

.user-delete-final-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #f0d3d3;
}

.user-delete-final-actions form {
    margin: 0;
}

.user-delete-final-button {
    min-height: 40px;
    padding: 8px 16px;
}

@media (max-width: 620px) {
    .user-delete-summary-grid {
        grid-template-columns: 1fr;
    }

    .user-delete-final-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .user-delete-final-actions .link-button,
    .user-delete-final-button {
        width: 100%;
    }
}


/* 招待登録：招待者名と特典表示 */
.register-invite-benefit {
    margin-top: 5px;
    color: #1d4ed8;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.5;
}

.register-invite-code {
    margin-top: 5px;
    font-size: 0.76rem;
}
