:root {
    --header-footer-bg: #1c1915;
    --header-footer-text: #f8f1e7;
    --bg: #f4f1ea;
    --ink: #1c1915;
    --muted: #6b6258;
    --card: #fffdf8;
    --line: #e4dccf;
    --accent: #b45309;
    --accent-dark: #8a3e06;
    --ok: #166534;
    --bad: #991b1b;
    --shadow: 0 10px 30px rgba(60, 40, 10, 0.06);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
}
a { color: var(--accent-dark); }
.wrap { width: min(980px, calc(100% - 32px)); margin: 0 auto; }
.site-header, .admin-bar {
    background: var(--header-footer-bg);
    color: var(--header-footer-text);
}
.header-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 64px;
    text-align: center;
}
.admin-bar .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 64px;
}
.brand {
    display: block;
    width: 100%;
    color: #fff;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-align: center;
    overflow-wrap: anywhere;
}
.admin-bar a { color: #f3e6d4; text-decoration: none; margin-left: 14px; }
.admin-bar a:hover { color: #fff; }
main.wrap { padding: 28px 0 48px; }
.hero, .card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 22px;
}
.hero h1 { margin: 0 0 8px; font-size: 2.2rem; }
.muted { color: var(--muted); }
.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.city-card {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    text-decoration: none;
    color: inherit;
}
.city-card:hover { border-color: var(--accent); }
.content { margin-top: 18px; }
.content h2, .content h3 { font-family: Georgia, serif; }
.global-box {
    margin-top: 22px;
    padding: 16px 18px;
    background: #fff8ee;
    border-left: 4px solid var(--accent);
    border-radius: 10px;
}
.site-footer {
    background: var(--header-footer-bg) !important;
    color: var(--header-footer-text) !important;
    padding: 18px 0;
    text-align: center;
}
.site-footer .wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 28px;
}
.site-footer p { margin: 0; width: 100%; text-align: center; }
label { display: block; font-weight: 700; margin: 12px 0 6px; font-family: system-ui, sans-serif; font-size: 0.92rem; }
input[type=text], input[type=password], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8cfbf;
    border-radius: 10px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 140px; }
.btn, button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    text-decoration: none;
    cursor: pointer;
    font-family: system-ui, sans-serif;
}
.btn.secondary, button.secondary { background: #44403c; }
.btn.danger { background: var(--bad); }
.btn.small { padding: 6px 10px; font-size: 0.85rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; font-family: system-ui, sans-serif; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; }
.flash.ok { background: #ecfdf3; color: var(--ok); }
.flash.bad { background: #fef2f2; color: var(--bad); }
.login-box { max-width: 420px; margin: 40px auto; }
.badge { background: #fde68a; color: #78350f; border-radius: 999px; padding: 2px 8px; font-size: 0.78rem; }
code { background: #efe8dc; padding: 1px 5px; border-radius: 4px; }
.help { font-family: system-ui, sans-serif; font-size: 0.9rem; color: var(--muted); }

/* Header/footer alignment safeguards */
@media (max-width: 768px) {
    .header-inner { justify-content: center; text-align: center; }
    .brand { width: 100%; text-align: center; font-weight: 700; }
    .site-footer, .site-footer p { text-align: center; }
}

/* ===== Admin horizontal dashboard ===== */
.admin-body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.admin-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 18px rgba(0,0,0,.12);
}
.admin-top {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.admin-title {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.08rem;
}
.admin-site-name {
    color: #f3e6d4;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-align: right;
}
.admin-bar .admin-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    min-height: 46px;
    padding-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.admin-bar .admin-nav a {
    flex: 0 0 auto;
    margin: 0;
    color: #f8f1e7;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 650;
    background: rgba(255,255,255,.06);
}
.admin-bar .admin-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
}
.admin-main { padding-top: 24px; }
.admin-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.admin-heading-row h1,
.admin-dashboard-panel h1,
.settings-panel h1,
.city-editor-panel h1 { margin: 0; }
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin: 18px 0;
}
.dashboard-stat {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
}
.dashboard-stat span {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    margin-bottom: 5px;
}
.dashboard-stat strong {
    display: block;
    font-size: 1.08rem;
    overflow-wrap: anywhere;
}
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin: 18px 0 26px;
}
.dashboard-action {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    min-width: 0;
}
.dashboard-action:hover { border-color: var(--accent); }
.dashboard-action strong { display:block; margin-bottom: 5px; }
.dashboard-action span { display:block; color:var(--muted); font-size:.86rem; line-height:1.4; }
.shortcode-row { display:flex; flex-wrap:wrap; gap:8px; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 16px;
    margin-bottom: 14px;
}
.settings-section {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 16px;
    min-width: 0;
}
.settings-section h2 { margin: 0 0 10px; font-size: 1.15rem; }
input[type=file] {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #d8cfbf;
    border-radius: 10px;
    background: #fff;
}
.favicon-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: .9rem;
    color: var(--muted);
}
.favicon-preview img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}
.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 18px;
}
.check-row input { width:auto; }
.form-options-row { display:flex; flex-wrap:wrap; gap:14px; margin:16px 0; }
.table-wrap { width:100%; overflow-x:auto; }
.action-row form { margin:0; }
button.danger, .btn.danger { background: var(--bad); }

@media (max-width: 900px) {
    .dashboard-stats,
    .dashboard-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
    .admin-top { align-items:flex-start; flex-direction:column; justify-content:center; padding-top:10px; padding-bottom:8px; gap:2px; }
    .admin-site-name { text-align:left; font-size:.88rem; }
    .admin-nav { width:min(980px, calc(100% - 20px)); }
    .admin-heading-row { align-items:flex-start; flex-direction:column; }
    .dashboard-stats,
    .dashboard-actions,
    .settings-grid { grid-template-columns: 1fr; }
}

/* Keep site name bold on every device */
@media (max-width: 768px) {
    .brand { font-weight: 900; }
}
