.inline-action { display: inline-block; margin: 0; }
.user-panel .logout-button {
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: #93c5fd;
    font: inherit;
    cursor: pointer;
}
.user-panel .logout-button:hover { text-decoration: underline; }
.user-panel .logout-button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --green: #15803d;
    --red: #b91c1c;
    --sidebar: #111827;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 24px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    margin-bottom: 28px;
}

.user-panel {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    display: grid;
    gap: 4px;
    margin: -12px 0 18px;
    padding: 12px 0;
}

.user-panel span {
    font-size: 14px;
    font-weight: 800;
}

.user-panel a {
    color: #93c5fd;
    font-size: 14px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--primary);
}

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

.nav a {
    color: #cbd5e1;
    font-size: 15px;
    padding: 10px 12px;
    border-radius: 8px;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.sidebar .nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 44px;
}
.sidebar .nav a > span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.sidebar-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}
.sidebar .nav a:focus-visible,
.sidebar-toggle:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.sidebar-toggle {
    display: none;
    min-height: 44px;
    border: 1px solid #64748b;
    background: transparent;
    color: #f8fafc;
    font: inherit;
    padding: 8px 12px;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.sidebar-toggle:hover { background: rgba(255, 255, 255, 0.1); }
@media (max-width: 900px) {
    .app-shell { grid-template-rows: auto 1fr; }
    .sidebar-toggle:not([hidden]) { display: flex; margin-bottom: 12px; }
    .sidebar .nav[hidden] { display: none; }
}

.main {
    min-width: 0;
    padding: 28px;
}

.page-header {
    margin-bottom: 22px;
}

.mode-banner {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #9a3412;
    font-weight: 800;
    margin: -6px 0 18px;
    padding: 12px 14px;
}

.eyebrow {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 2px;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.25;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat-card,
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 30px;
}

.stat-card.tone-up {
    border-color: #bbf7d0;
}

.stat-card.tone-up strong {
    color: var(--green);
}

.stat-card.tone-down {
    border-color: #fecaca;
}

.stat-card.tone-down strong {
    color: var(--red);
}

.plan-usage.warning {
    border-color: #facc15;
}

.plan-usage.warning strong {
    color: #a16207;
}

.plan-usage.danger {
    border-color: #fecaca;
}

.plan-usage.danger strong {
    color: var(--red);
}

.plan-usage small {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-top: 4px;
}

.plan-usage.warning small {
    color: #a16207;
}

.plan-usage.danger small {
    color: var(--red);
}

.status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.status-card {
    padding: 12px 14px;
}

.status-card span {
    font-size: 13px;
    margin-bottom: 5px;
}

.status-card strong {
    display: block;
    font-size: 15px;
    line-height: 1.45;
}

.form-note {
    color: var(--muted);
    font-size: 13px;
    margin: 10px 0 0;
}

.info-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.info-grid > div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
}

.info-grid h3 {
    font-size: 14px;
    margin: 0 0 8px;
}

.compact-list {
    color: var(--text);
    font-size: 14px;
    line-height: 1.75;
    margin: 0;
    padding-left: 18px;
}

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

.card {
    margin-bottom: 18px;
    overflow: hidden;
}

.card-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.card-header.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.card > p:not(.empty),
.card > .form-note,
.card > .notice,
.card > .table-wrap {
    margin-left: 18px;
    margin-right: 18px;
}

.card > p:not(.empty) {
    line-height: 1.8;
}

.card > .card-header + p,
.card > .card-header + .form-note,
.card > .card-header + .table-wrap {
    margin-top: 16px;
}

.card > .table-wrap {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 18px;
    overflow: auto;
}

.card > .table-wrap table {
    margin: 0;
}

.integration-card > p,
.integration-card > .info-grid,
.integration-card > .notice,
.integration-card > .table-wrap {
    margin-left: 18px;
    margin-right: 18px;
}

.integration-card > p:first-of-type {
    margin-top: 18px;
}

.integration-card > p:last-child,
.integration-card > .table-wrap:last-child {
    margin-bottom: 18px;
}

.integration-card > .form-note {
    line-height: 1.8;
}

.integration-card > .table-wrap {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-top: 14px;
    overflow: auto;
}

.integration-card > .notice {
    margin-top: 14px;
}

.dashboard-site-card .card-header {
    align-items: flex-end;
}

.dashboard-site-filter {
    grid-template-columns: minmax(240px, 420px) auto;
    padding: 0;
}

.dashboard-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px 18px;
}

.form-grid,
.filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    padding: 18px;
}

.ga4-fetch-form {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.ga4-fetch-property {
    max-width: 640px;
}

.ga4-fetch-period {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 240px)) auto;
    gap: 14px;
    align-items: end;
}

.ga4-fetch-period [hidden] {
    display: none !important;
}

.filter-bar {
    grid-template-columns: repeat(2, minmax(180px, 260px)) auto;
}

.chart-filter {
    grid-template-columns: minmax(260px, 560px) auto;
}

.compare-filter {
    grid-template-columns: repeat(3, minmax(160px, 1fr)) repeat(3, minmax(140px, 1fr)) auto;
}

.form-actions {
    display: flex;
    gap: 8px;
}

.keyword-create-form {
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
}

.billing-body { padding: 20px; }
.billing-body form + form { margin-top: 20px; }
.billing-consent { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; }
.billing-consent input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 4px; }
.billing-application-form .billing-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 44px;
    padding: 10px 8px;
    margin: 12px 0;
    box-sizing: border-box;
    cursor: pointer;
    color: #334155;
    line-height: 1.6;
}
.billing-application-form .billing-check input[type="checkbox"] {
    appearance: auto;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    margin: 0;
    padding: 0;
    accent-color: #2563eb;
    cursor: pointer;
}
.billing-application-form .billing-check span { min-width: 0; overflow-wrap: anywhere; }
.billing-application-form .billing-check:has(input:checked) { background: #eff6ff; }
.billing-application-form .billing-check:focus-within { outline: 2px solid #2563eb; outline-offset: 2px; }
.billing-application-form input[readonly] { background: #f1f5f9; color: #475569; }
.checkbox-field {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin: 0;
    padding: 10px 11px;
}

.checkbox-field legend {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    padding: 0 4px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-option {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: inline-flex;
    font-size: 14px;
    gap: 7px;
    min-height: 34px;
    padding: 5px 9px;
}

.check-option input {
    width: auto;
}

.check-option:has(input:disabled) {
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.65;
}

.check-option input:disabled + span {
    color: #94a3b8;
}

.check-option small {
    color: var(--muted);
    font-weight: 700;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.label-sub {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    padding: 10px 11px;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(37, 99, 235, 0.15);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.custom-date-field.is-disabled {
    color: #94a3b8;
}

.custom-date-field.is-hidden {
    display: none;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 8px 14px;
    white-space: nowrap;
}

.button:hover {
    text-decoration: none;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

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

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

.button.secondary {
    background: #eef2ff;
    color: #3730a3;
}

.button.danger {
    background: #fee2e2;
    color: var(--danger);
}

.button.warning {
    background: #fef3c7;
    color: #92400e;
}

.button.checked {
    background: #e5e7eb;
    color: #64748b;
}

.checked-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #dcfce7;
    color: var(--green);
    font-size: 13px;
    font-weight: 800;
    padding: 2px 8px;
}

.checked-status.limit {
    background: #fef3c7;
    color: #92400e;
}

.checked-time {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
    white-space: nowrap;
}

.gsc-fetch-message {
    color: var(--muted);
    display: block;
    font-size: 13px;
    line-height: 1.45;
    margin-top: 6px;
    max-width: 420px;
    overflow-wrap: anywhere;
}

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

.scroll-table {
    max-height: 520px;
    overflow: auto;
}

.scroll-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.compare-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.compare-table {
    min-width: 1100px;
}

.compare-table th,
.compare-table td {
    white-space: nowrap;
}

.compare-table th:first-child,
.compare-table td:first-child {
    min-width: 220px;
    white-space: normal;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
}

td {
    background: #fff;
}

.actions {
    display: flex;
    gap: 8px;
}

.inline-form {
    align-items: center;
    display: flex;
    gap: 8px;
}

.inline-form select {
    min-width: 220px;
}

.select-cell {
    text-align: center;
    width: 44px;
}

.select-cell input {
    width: auto;
}

.url-cell {
    max-width: 280px;
    overflow: hidden;
}

.url-cell a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.status,
.rank-diff,
.engine-badge,
.device-badge {
    display: inline-flex;
    min-width: 54px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    padding: 3px 9px;
}

.status.on,
.rank-diff.up {
    background: #dcfce7;
    color: var(--green);
}

.status.off {
    background: #e5e7eb;
    color: #4b5563;
}

.rank-diff.down {
    background: #fee2e2;
    color: var(--red);
}

.rank-diff.neutral {
    background: #f1f5f9;
    color: #475569;
}

.engine-badge.google {
    background: #dbeafe;
    color: #1d4ed8;
}

.engine-badge.yahoo {
    background: #f3e8ff;
    color: #7e22ce;
}

.engine-badge.bing {
    background: #ccfbf1;
    color: #0f766e;
}

.engine-badge.default {
    background: #f1f5f9;
    color: #475569;
}

.unsupported-badge {
    background: #fef3c7;
    border-radius: 999px;
    color: #92400e;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    margin-left: 6px;
    padding: 3px 8px;
}

.device-badge.desktop {
    background: #e0f2fe;
    color: #0369a1;
}

.device-badge.mobile {
    background: #fef3c7;
    color: #92400e;
}

.device-badge.default {
    background: #f1f5f9;
    color: #475569;
}

.role-badge {
    display: inline-flex;
    min-width: 58px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    padding: 3px 9px;
}

.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.user {
    background: #e0f2fe;
    color: #0369a1;
}

.usage-status,
.provider-badge {
    display: inline-flex;
    min-width: 68px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    padding: 3px 9px;
}

.usage-status.success {
    background: #dcfce7;
    color: var(--green);
}

.usage-status.error {
    background: #fee2e2;
    color: var(--red);
}

.usage-status.warning {
    background: #fef3c7;
    color: #92400e;
}

.usage-status.neutral {
    background: #f1f5f9;
    color: #475569;
}

.provider-badge.mock {
    background: #f1f5f9;
    color: #475569;
}

.provider-badge.dataforseo {
    background: #dbeafe;
    color: #1d4ed8;
}

.provider-badge.desktop {
    background: #dcfce7;
    color: var(--green);
}

.provider-badge.serpapi {
    background: #f3e8ff;
    color: #7e22ce;
}

.provider-badge.default {
    background: #e5e7eb;
    color: #374151;
}

.feedback-type,
.priority-badge,
.feedback-status {
    display: inline-flex;
    min-width: 64px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    padding: 3px 9px;
}

.feedback-type.bug,
.priority-badge.high,
.feedback-status.open {
    background: #fee2e2;
    color: var(--red);
}

.feedback-type.request,
.priority-badge.normal,
.feedback-status.in_progress {
    background: #fef3c7;
    color: #92400e;
}

.feedback-type.question {
    background: #dbeafe;
    color: #1d4ed8;
}

.feedback-type.other,
.priority-badge.low,
.feedback-status.closed {
    background: #f1f5f9;
    color: #475569;
}

.feedback-card {
    max-width: 960px;
}

.feedback-form-wrap {
    padding: 18px;
}

.feedback-form {
    display: grid;
    gap: 14px;
}

.feedback-form-grid,
.feedback-admin-filter {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.feedback-detail {
    padding: 18px;
}

.feedback-detail dl {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px 16px;
    margin: 0;
}

.feedback-detail dt {
    color: var(--muted);
    font-weight: 800;
}

.feedback-detail dd {
    margin: 0;
    overflow-wrap: anywhere;
}

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

.site-detail-meta div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.site-detail-meta span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.site-detail-meta strong {
    display: block;
    overflow-wrap: anywhere;
}

.sites-list-card {
    overflow: visible;
}

.site-card-list {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
    padding: 18px;
}

.site-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    display: grid;
    gap: 16px;
    min-width: 0;
    padding: 18px;
}

.site-card.is-over-limit {
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 10px 26px rgba(245, 158, 11, 0.08);
}

.site-card-header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
}

.site-card-heading {
    min-width: 0;
    width: 100%;
}

.site-card-title-row {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    min-width: 0;
}

.site-card-title-row .checked-status {
    flex: 0 0 auto;
    margin-top: 2px;
}

.site-card-title {
    color: var(--text);
    font-size: 20px;
    line-height: 1.35;
    margin: 0 0 4px;
    overflow-wrap: anywhere;
    word-break: keep-all;
}

.site-card-domain {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-weight: 800;
    margin: 0;
    overflow-wrap: normal;
    word-break: keep-all;
}

.site-card-domain span {
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.site-card-meta {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.6fr);
    margin: 0;
}

.site-card-meta div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    padding: 10px 12px;
}

.site-card-meta-wide {
    min-width: 0;
}

.site-card-meta dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 3px;
}

.site-card-meta dd {
    margin: 0;
}

.site-card-url {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.site-limit-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
    font-size: 13px;
    font-weight: 700;
    margin: 0;
    padding: 10px 12px;
}

.site-link-form {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.site-card-select {
    max-width: 100%;
    min-width: 240px;
}

.site-card-actions {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.site-card-footer {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
}

.site-card-footer form {
    margin: 0;
}

.action-note-form-grid {
    grid-template-columns: minmax(140px, 180px) minmax(220px, 1fr) minmax(160px, 220px);
}

.note-type {
    display: inline-flex;
    min-width: 78px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    padding: 3px 9px;
}

.note-type.title {
    background: #dbeafe;
    color: #1d4ed8;
}

.note-type.content {
    background: #dcfce7;
    color: var(--green);
}

.note-type.internal_link {
    background: #f3e8ff;
    color: #7e22ce;
}

.note-type.technical {
    background: #fef3c7;
    color: #92400e;
}

.note-type.other {
    background: #f1f5f9;
    color: #475569;
}

.monthly-report-form {
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 160px) minmax(100px, 140px) auto;
}

.monthly-report-card-list {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.monthly-report-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 16px;
    padding: 18px;
}

.monthly-report-card-header {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.monthly-report-card-header h3 {
    font-size: 18px;
    line-height: 1.45;
    margin: 0;
    overflow-wrap: anywhere;
    word-break: keep-all;
}

.monthly-report-card-header .public-badge {
    flex: 0 0 auto;
    margin-left: auto;
}

.monthly-report-meta {
    display: grid;
    gap: 12px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.monthly-report-meta div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    padding: 10px 12px;
}

.monthly-report-meta dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
}

.monthly-report-meta dd {
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
    word-break: keep-all;
}

.monthly-report-meta dd small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    margin-top: 3px;
}

.monthly-report-gsc-status {
    color: var(--green);
    display: block;
    font-weight: 800;
}

.monthly-report-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.monthly-report-actions form {
    margin: 0;
}

.copy-feedback {
    color: var(--green);
    font-size: 13px;
    font-weight: 800;
    margin: -4px 0 0;
}

.report-list-empty {
    padding: 28px 18px;
    text-align: center;
}

.report-list-empty strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}

.report-list-empty p {
    color: var(--muted);
    margin: 0;
}

.report-admin-filter {
    grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.report-actions form {
    margin: 0;
}

.public-badge,
.report-status {
    display: inline-flex;
    min-width: 68px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 800;
    padding: 3px 9px;
}

.public-badge.on,
.report-status.up,
.report-status.new {
    background: #dcfce7;
    color: var(--green);
}

.public-badge.off,
.report-status.same {
    background: #f1f5f9;
    color: #475569;
}

.report-status.down,
.report-status.out {
    background: #fee2e2;
    color: var(--red);
}

.report-paper {
    background: #fff;
    border: 1px solid var(--line);
    box-sizing: border-box;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    margin: 0 auto 24px;
    max-width: 980px;
    padding: 42px;
    width: 100%;
}

.report-cover {
    border-bottom: 2px solid var(--line);
    margin-bottom: 24px;
    padding-bottom: 22px;
}

.report-cover p {
    color: var(--muted);
    font-weight: 800;
    margin: 0 0 8px;
}

.report-cover h1 {
    font-size: 34px;
    margin-bottom: 18px;
}

.report-cover dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 14px;
    margin: 0;
}

.report-cover dt {
    color: var(--muted);
    font-weight: 800;
}

.report-cover dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.report-summary-grid div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

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

.report-summary-grid strong {
    display: block;
    font-size: 26px;
}

.report-summary-grid small {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 800;
    margin-top: 4px;
}

.report-primary-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 26px;
}

.report-primary-summary > div {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-top: 4px solid #2563eb;
    border-radius: 8px;
    min-height: 116px;
    padding: 15px;
}

.report-primary-summary > div > span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.report-primary-summary > div > strong {
    display: block;
    font-size: 24px;
    line-height: 1.35;
}

.report-primary-summary strong small {
    color: var(--muted);
    font-size: 12px;
}

.report-primary-summary > div > small {
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-top: 7px;
}

.report-movement,
.report-traffic {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px 10px;
}

.report-movement b,
.report-traffic b {
    font-size: 13px;
    white-space: nowrap;
}

.is-up {
    color: #15803d !important;
}

.is-down {
    color: #b91c1c !important;
}

.is-same {
    color: #64748b !important;
}

.report-section-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
}

.report-section-heading > strong {
    color: #334155;
    font-size: 13px;
    white-space: nowrap;
}

.report-distribution-bar {
    background: #e2e8f0;
    border-radius: 6px;
    display: flex;
    height: 20px;
    overflow: hidden;
    width: 100%;
}

.report-distribution-bar span {
    min-width: 2px;
}

.report-distribution-bar .rank1_3,
.report-distribution-legend .rank1_3 { background: #166534; }
.report-distribution-bar .rank4_10,
.report-distribution-legend .rank4_10 { background: #22c55e; }
.report-distribution-bar .rank11_30,
.report-distribution-legend .rank11_30 { background: #eab308; }
.report-distribution-bar .rank31_50,
.report-distribution-legend .rank31_50 { background: #f97316; }
.report-distribution-bar .out,
.report-distribution-legend .out { background: #94a3b8; }

.report-distribution-legend {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 12px;
}

.report-distribution-legend div {
    align-items: center;
    display: grid;
    font-size: 11px;
    gap: 3px 6px;
    grid-template-columns: 10px 1fr auto;
}

.report-distribution-legend i {
    border-radius: 3px;
    display: block;
    height: 10px;
    width: 10px;
}

.report-distribution-legend strong {
    font-size: 12px;
}

.report-distribution-legend small {
    color: var(--muted);
    grid-column: 2 / 4;
}

.report-secondary-summary {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 26px;
}

.report-secondary-summary div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

.report-secondary-summary span {
    color: var(--muted);
    display: block;
    font-size: 10px;
    font-weight: 800;
}

.report-secondary-summary strong {
    display: block;
    font-size: 20px;
    margin-top: 2px;
}

.report-insight-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-insight {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 14px 16px;
}

.report-insight--warnings { border-left-color: #d97706; }
.report-insight--actions { border-left-color: #0f766e; }

.report-insight h3 {
    font-size: 15px;
    margin: 0 0 9px;
}

.report-insight ul {
    margin: 0;
    padding-left: 18px;
}

.report-insight li {
    font-size: 12px;
    line-height: 1.65;
    margin-bottom: 5px;
}

.report-period-note {
    background: #eff6ff;
    border-left: 3px solid #2563eb;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 12px;
    padding: 8px 10px;
}

.report-current-rank {
    color: #0f172a;
    font-size: 12px !important;
    font-weight: 900 !important;
}

.report-change {
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.chart-panel.report-chart-panel:not(.is-ready) {
    min-height: 0;
}

.chart-panel.report-chart-panel canvas {
    display: none;
}

.chart-panel.report-chart-panel.is-ready canvas {
    display: block;
}

.report-chart-fallback {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin: 0;
    padding: 16px;
}

.report-chart-panel.is-ready .report-chart-fallback {
    display: none;
}

.report-overview {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 24px;
    overflow: hidden;
}

.report-overview div {
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 12px;
}

.report-overview div:last-child {
    border-right: 0;
}

.report-overview span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 3px;
}

.report-overview strong {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-section {
    margin-bottom: 26px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.report-section h2 {
    margin-bottom: 8px;
}

.report-section-lead {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 14px;
}

.report-comment {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.8;
    padding: 14px 16px;
}

.report-comment--preline {
    white-space: pre-line;
}

.report-rank-extra.is-hidden {
    display: none;
}

.report-rank-toggle {
    margin-top: 12px;
}

.report-section.content-grid,
.report-section .content-grid,
.report-paper .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.report-section.content-grid > *,
.report-section .content-grid > *,
.report-paper .content-grid > * {
    min-width: 0;
}

.report-paper table {
    max-width: 100%;
    table-layout: fixed;
    width: 100%;
}

.report-paper th,
.report-paper td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.report-paper .table-wrap {
    max-width: 100%;
    overflow-x: visible;
}

.report-section.content-grid .report-table {
    min-width: 0;
}

.report-paper table,
.report-paper .report-table {
    min-width: 0;
}

.report-paper th,
.report-paper td {
    font-size: 12px;
    line-height: 1.45;
    padding: 10px 11px;
}

.report-compact-table th,
.report-compact-table td {
    font-size: 11px;
    padding: 9px 8px;
}

.report-compact-table th:first-child,
.report-compact-table td:first-child {
    width: 44%;
}

.report-url {
    display: block;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-ga4-landing-table .report-url {
    max-width: 220px;
}

.report-label {
    background: #eef2ff;
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    white-space: nowrap;
}

.report-label.action {
    background: #ecfdf5;
    color: #047857;
}

.report-opportunity-table th:first-child,
.report-opportunity-table td:first-child {
    width: 28%;
}

.report-opportunity-table th:last-child,
.report-opportunity-table td:last-child {
    width: 16%;
}

.report-rank-table th,
.report-rank-table td {
    font-size: 10.5px;
    padding: 7px 6px;
}

.report-rank-table th:first-child,
.report-rank-table td:first-child {
    width: 24%;
}

.report-table {
    min-width: 860px;
}

.public-report-body {
    background: #eef2f7;
}

.public-report-shell {
    padding: 28px;
}

.api-usage-filter {
    grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
}

.admin-api-usage-filter {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.admin-inner-stats {
    margin: 0;
    padding: 18px;
}

.admin-user-filter {
    grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(180px, 240px) auto;
}

.admin-log-filter {
    grid-template-columns: minmax(180px, 240px) minmax(140px, 180px) auto;
}

.log-message {
    max-width: 720px;
    overflow-wrap: anywhere;
}

.log-viewer {
    background: #0f172a;
    color: #e2e8f0;
    font-family: Consolas, "SFMono-Regular", Menlo, monospace;
    font-size: 12px;
    line-height: 1.7;
    margin: 0;
    max-height: 620px;
    overflow: auto;
    padding: 18px;
    white-space: pre-wrap;
}

.cron-log-viewer {
    max-height: 360px;
}

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

.dashboard-inner-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px;
}

.admin-detail-grid div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.admin-detail-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.admin-detail-grid strong {
    display: block;
    overflow-wrap: anywhere;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 18px;
}

.rank-queue-summary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.rank-queue-alert {
    background: #fff7ed;
    border-color: #fdba74;
}

.rank-queue-filter {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    padding: 18px;
}

.rank-queue-filter label {
    min-width: 0;
}

.rank-queue-table {
    min-width: 1900px;
}

.rank-queue-table td {
    vertical-align: top;
}

.rank-queue-table td small {
    color: var(--muted);
    display: block;
    margin-top: 4px;
}

.rank-queue-row-alert td {
    background: #fff7ed;
}

.rank-queue-task-id,
.rank-queue-error {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graph-card .card-header {
    border-bottom: 0;
}

.keyword-toggle-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px 14px;
}

.keyword-toggle {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
    max-width: 360px;
    min-height: 34px;
    padding: 6px 10px;
}

.keyword-toggle input {
    width: auto;
}

.keyword-toggle span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-panel {
    min-height: 320px;
    padding: 18px;
}

.chart-panel canvas {
    display: block;
    width: 100%;
    max-height: 360px;
}

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

.empty {
    padding: 18px;
}

.seed-card {
    max-width: 760px;
}

.seed-content {
    padding: 18px;
}

.seed-content p {
    margin: 0 0 16px;
}

.notice {
    border-radius: 8px;
    font-weight: 800;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.notice.success {
    background: #dcfce7;
    color: var(--green);
}

.notice.warning {
    background: #fef3c7;
    color: #92400e;
}

.auth-body {
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e0f2fe 100%);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 440px);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
    padding: 28px;
}

.auth-brand {
    color: var(--text);
    margin-bottom: 18px;
}

.auth-card h1 {
    font-size: 24px;
    margin-bottom: 18px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form .button {
    margin-top: 4px;
}

.auth-errors {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--danger);
    font-weight: 700;
    margin-bottom: 16px;
    padding: 10px 12px;
}

.auth-errors p,
.auth-switch {
    margin: 0;
}

.auth-switch {
    color: var(--muted);
    margin-top: 16px;
}

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

    .sidebar {
        position: static;
        padding: 16px;
    }

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

    .main {
        padding: 18px;
    }

    .stats-grid,
    .content-grid,
    .info-grid,
    .form-grid,
    .filter-bar,
    .chart-filter,
    .compare-filter,
    .admin-user-filter,
    .api-usage-filter,
    .admin-api-usage-filter,
    .feedback-form-grid,
    .feedback-admin-filter,
    .action-note-form-grid,
    .site-detail-meta,
    .monthly-report-form,
    .report-admin-filter,
    .report-summary-grid,
    .admin-detail-grid {
        grid-template-columns: 1fr;
    }

    .site-link-form {
        grid-template-columns: 1fr;
    }

    .ga4-fetch-period {
        grid-template-columns: 1fr;
    }

    .ga4-fetch-period .button {
        width: 100%;
    }

    .site-card-meta {
        grid-template-columns: 1fr;
    }

    .site-card-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-card-select {
        min-width: 0;
    }

    .site-card-actions,
    .site-card-footer {
        justify-content: flex-start;
    }

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

    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .card-header.split {
        align-items: flex-start;
        flex-direction: column;
    }

    .report-paper {
        padding: 24px;
        width: 100%;
    }

    .monthly-report-card-header {
        flex-direction: column;
    }

    .monthly-report-meta {
        grid-template-columns: 1fr;
    }

    .report-cover dl,
    .report-overview,
    .report-summary-grid,
    .report-primary-summary,
    .report-insight-grid,
    .report-section.content-grid {
        grid-template-columns: 1fr;
    }

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

    .report-distribution-legend {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-overview div {
        border-bottom: 1px solid var(--line);
        border-right: 0;
    }

    .report-overview div:last-child {
        border-bottom: 0;
    }

    .report-table {
        min-width: 760px;
    }

    .report-paper .table-wrap {
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }
}

/* Saved and legacy report HTML share these containers. Screen-only keeps print sizing intact. */
@media screen and (max-width: 767px) {
    .report-paper .report-cover h1 {
        overflow-wrap: anywhere;
    }

    .report-paper .table-wrap {
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .report-paper .table-wrap::before {
        content: "左右にスクロールできます";
        display: block;
        position: sticky;
        left: 0;
        width: max-content;
        max-width: 100%;
        padding: 4px 0 10px;
        color: #526174;
        font-size: 12px;
        white-space: nowrap;
    }

    .report-paper .table-wrap table {
        min-width: 780px;
        table-layout: fixed;
    }

    .report-paper .table-wrap th,
    .report-paper .table-wrap td {
        font-size: 12px;
        padding: 10px;
        white-space: nowrap;
        word-break: normal;
        overflow-wrap: normal;
    }

    .report-paper .table-wrap th:first-child,
    .report-paper .table-wrap td:first-child {
        width: 220px;
    }

    .report-paper .table-wrap td:first-child {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .report-paper .table-wrap .report-rank-table {
        min-width: 1160px;
    }

    .report-paper .table-wrap .report-opportunity-table {
        min-width: 1220px;
    }

    .report-paper .report-opportunity-table th:nth-last-child(-n+2),
    .report-paper .report-opportunity-table td:nth-last-child(-n+2) {
        width: 240px;
    }

    .report-paper .report-opportunity-table td:nth-last-child(-n+2) {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media print {
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: #fff;
    }

    .sidebar,
    .page-header,
    .mode-banner,
    .no-print,
    form,
    .button {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .main,
    .public-report-shell {
        padding: 0;
    }

    .report-paper {
        border: 1px solid #cbd5e1;
        box-shadow: none;
        max-width: none;
        padding: 9mm;
        width: 100%;
    }

    .report-section.content-grid,
    .report-paper .content-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-overview {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .report-paper .table-wrap {
        overflow: visible;
    }

    .report-paper table,
    .report-table {
        min-width: 0;
    }

    .report-paper th,
    .report-paper td {
        border-color: #cbd5e1;
        font-size: 9px;
        padding: 5px 5px;
    }

    .report-paper th {
        background: #f1f5f9 !important;
    }

    .report-summary-grid div {
        background: #f8fafc !important;
    }

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

    .report-primary-summary > div {
        min-height: 0;
        padding: 8px;
    }

    .report-primary-summary > div > strong {
        font-size: 16px;
    }

    .report-secondary-summary {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .report-insight-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .report-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-rank-extra.is-hidden {
        display: table-row;
    }

    table,
    canvas {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .chart-panel {
        min-height: 220px;
    }

    .report-url {
        max-width: 140px;
    }

    .report-label {
        font-size: 8px;
        padding: 2px 5px;
    }

    .card,
    .stat-card {
        box-shadow: none;
    }
}

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

    h1 {
        font-size: 24px;
    }

    .actions {
        align-items: flex-start;
        flex-direction: column;
    }
}
/* Scoped, read-only first-use guidance. */
.getting-started-plan { margin: 20px 0; padding: 12px 0; border-block: 1px solid #cbd5e1; color: #334155; }
.getting-started-plan summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 600; }
.getting-started-plan dl { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.getting-started-plan dd { margin: 4px 0; }
.getting-started-status { margin: 16px 0; padding: 12px 0; border-bottom: 1px solid #cbd5e1; overflow-wrap: anywhere; }
.getting-started-status h2 { font-size: 18px; }
.getting-started { margin: 0 0 24px; padding: 16px 0 20px; border-bottom: 1px solid #cbd5e1; overflow-wrap: anywhere; }
.getting-started h2 { margin: 8px 0; font-size: 20px; line-height: 1.5; }
.getting-started p { max-width: 75ch; line-height: 1.7; }
.getting-started summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 600; }
.getting-started .button { min-height: 44px; white-space: normal; max-width: 100%; }
.getting-started a:focus-visible, .getting-started summary:focus-visible { outline: 3px solid #087f8c; outline-offset: 3px; }
.getting-started.is-complete { padding-bottom: 8px; }
