:root {
    --bg: #f5f1e8;
    --surface: #fffdfa;
    --surface-2: #f2ece1;
    --text: #1d1a16;
    --muted: #6f675e;
    --line: #ded4c5;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --danger: #b42318;
    --warning: #b54708;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(29, 26, 22, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #efe7da 0%, #f7f3eb 45%, #f5f1e8 100%);
    color: var(--text);
}

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

.app-shell {
    min-height: 100vh;
    padding-bottom: 88px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(245, 241, 232, 0.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(222, 212, 197, 0.9);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.topbar h1,
.page-actions h2,
.auth-card h2,
.card h3 {
    margin: 0;
}

.content {
    padding: 16px;
    max-width: 1080px;
    margin: 0 auto;
}

.menu-dropdown summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    font-weight: 600;
}

.menu-dropdown summary::-webkit-details-marker { display: none; }

.menu-panel {
    margin-top: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.flash {
    margin: 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
}

.flash.success {
    background: #dff7ef;
    color: #0b5c42;
}

.flash.error {
    background: #fde8e8;
    color: #912018;
}

.stack-lg > * + * { margin-top: 20px; }
.stack-md > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }

.grid {
    display: grid;
    gap: 14px;
}

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

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

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

.metric-card {
    background: linear-gradient(135deg, #fffdfa, #f4ede1);
}

.metric-label {
    color: var(--muted);
    margin: 0 0 8px;
}

.metric-value {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
}

.stat-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.stat-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.stat-list li:last-child { border-bottom: none; }

.alert-row {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.alert-row:last-child { border-bottom: none; }

.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.chip {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 10px 14px;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 600;
}

.chip.active {
    background: #d8efe8;
    border-color: #9fd1c7;
    color: #0f5e58;
}

.profile-card__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
}

.profile-thumb,
.logo-badge {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f766e, #22a89d);
    color: white;
    font-weight: 700;
    font-size: 20px;
}

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

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

.profile-meta dd {
    margin: 0;
    font-weight: 600;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.table-wrap table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
}

.table-wrap th,
.table-wrap td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table-wrap th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    background: #f8fafc;
}

.table-wrap tr:last-child td {
    border-bottom: none;
}

.inline-warning {
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff4e5;
    color: var(--warning);
    font-weight: 600;
}

.card-actions,
.page-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-block { width: 100%; }

.btn-primary {
    background: var(--brand);
    color: white;
}

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

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--line);
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #e8efe8;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-warning {
    background: #fff1dd;
    color: var(--warning);
}

.badge-critical {
    background: #fde8e8;
    color: var(--danger);
}

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

.auth-card {
    max-width: 440px;
    margin: 10vh auto 0;
    text-align: center;
}

.field {
    display: grid;
    gap: 8px;
    text-align: left;
}

.field input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    font: inherit;
}

.upload-box {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: #fbf7ef;
}

.upload-box input[type="file"] {
    padding: 8px 0;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--brand-dark);
    font-weight: 600;
}

.hint {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 24px 16px;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 250, 0.98);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.bottom-nav a {
    text-align: center;
    padding: 12px 6px;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 700;
}

.bottom-nav a.active {
    background: #d8efe8;
    color: #0f5e58;
}

.profile-card__header-link {
    color: inherit;
}

.grid-detail {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-thumb-lg {
    width: 60px;
    height: 60px;
    font-size: 22px;
}

.inline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.inline-meta-tight {
    justify-content: flex-end;
    margin-top: 0;
}

.language-switch {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(72px, 1fr));
    gap: 4px;
    max-width: 180px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-2);
}

.language-switch label {
    cursor: pointer;
}

.language-switch input {
    position: absolute;
    width: auto;
    min-height: 0;
    opacity: 0;
    pointer-events: none;
}

.language-switch span {
    display: grid;
    place-items: center;
    min-height: 38px;
    border-radius: 10px;
    font-weight: 800;
    color: var(--muted);
}

.language-switch input:checked + span {
    background: var(--brand);
    color: white;
}

.info-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
}

.keyword-item {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.keyword-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.photo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.photo-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.photo-row__meta p {
    margin: 4px 0 0;
}

.review-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fcfaf5;
}

.review-card__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.reply-box {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #eef7f4;
}

.log-context {
    margin: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    color: var(--muted);
}

.post-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fcfaf5;
}

.monthly-report-profile--excluded {
    opacity: 0.58;
    background: #eee9df;
}

.monthly-report-profile--excluded input[type="file"] {
    cursor: not-allowed;
}

.post-card__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.job-item-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fcfaf5;
}

.job-item-card__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.keyword-row {
    display: grid;
    gap: 10px;
}

.keyword-row input {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
}

.visibility-table table {
    min-width: 720px;
}

.visibility-table textarea,
.visibility-table input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
    font: inherit;
}

.visibility-table textarea {
    resize: vertical;
}

.visibility-table__actions {
    width: 96px;
    white-space: nowrap;
}

.btn-danger {
    color: var(--danger);
}

.btn-danger-solid {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-danger-solid:hover {
    filter: brightness(0.95);
}

.section-gap {
    margin-top: 16px;
}

.copy-source {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.timeline-item {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.timeline-item__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-actions-end {
    align-items: end;
}

.stat-list-no-border li {
    border-bottom: 1px solid var(--line);
}

.pagination,
.pagination nav,
.pagination svg {
    max-width: 100%;
}

@media (min-width: 768px) {
    .content { padding: 24px; }
    .grid-1-1-1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .keyword-row { grid-template-columns: 1fr 120px auto; align-items: center; }
    .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bottom-nav {
        max-width: 600px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
        border: 1px solid var(--line);
        border-bottom: none;
        border-radius: 18px 18px 0 0;
    }
}
