: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: 13px;
    font-weight: 800;
}

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

.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;
    padding: 10px 12px;
    border-radius: 8px;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: 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: 12px;
    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: 13px;
    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: 12px;
    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: 12px;
    margin-bottom: 5px;
}

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

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

.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;
}

.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;
}

.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;
}

.checkbox-field {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin: 0;
    padding: 10px 11px;
}

.checkbox-field legend {
    color: var(--muted);
    font-size: 13px;
    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: 13px;
    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: 13px;
    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);
}

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: 12px;
    font-weight: 800;
    padding: 2px 8px;
}

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

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

.gsc-fetch-message {
    color: var(--muted);
    display: block;
    font-size: 12px;
    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: 12px;
    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: 12px;
    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: 12px;
    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: 12px;
    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-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;
}

.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,
    .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;
    }

    .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-section.content-grid {
        grid-template-columns: 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;
    }
}

@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-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;
    }
}
