/* Admin UI styling. Same colour tokens and font as the public site
   (assets/site.css :root) so it feels like one product; layout is its own
   (a plain admin console, not the public design). */
@font-face { font-family: 'Roboto'; src: url('/admin-assets/fonts/roboto-normal-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
:root {
  --navy: #002c6a; --accent: #1f5fd6; --accent-soft: #eaf1fd; --danger: #b00000; --danger-soft: #fbe6e6;
  --heading: #10202b; --text: #2c4358; --muted: #4b586c; --line: #e6e9ef; --surface: #f6f7f9; --white: #fff;
  --radius: 10px; --radius-sm: 6px; --shadow: 0 1px 2px rgba(0,26,64,.06), 0 8px 24px rgba(0,26,64,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.6 Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--surface); }
a { color: var(--accent); }
h1 { font-size: 22px; color: var(--heading); margin: 0 0 16px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); }

.topnav { display: flex; align-items: center; gap: 18px; background: var(--navy); color: #fff; padding: 0 20px; height: 56px; }
.topnav a { color: #cfe0ff; text-decoration: none; font-weight: 500; }
.topnav a.active, .topnav a:hover { color: #fff; }
.topnav .brand { color: #fff; font-weight: 700; }
.topnav .brand span { font-weight: 400; opacity: .8; }
.topnav .spacer { flex: 1; }
.topnav .who { opacity: .85; font-size: 13px; }
.linklike { background: none; border: none; color: #cfe0ff; cursor: pointer; font: inherit; }
.linklike:hover { color: #fff; }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; max-width: 420px; margin: 40px auto; }
.login-card form:not([hidden]) { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login-card input { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; }
button { cursor: pointer; }

.btn { display: inline-block; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--white); color: var(--text); text-decoration: none; font: inherit; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; opacity: .9; }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-feature { background: #fff3cd; border-color: #d4a017; color: #7a5b00; font-weight: 700; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }

.head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; }

.month-group { margin-bottom: 14px; }
.month-group summary { cursor: pointer; padding: 10px 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 600; color: var(--heading); list-style: revert; }
.month-group[open] summary { margin-bottom: 8px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.list-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-table th, .list-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.list-table th { background: var(--surface); font-weight: 600; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill--draft { background: var(--surface); color: var(--muted); }
.pill--scheduled { background: #fff3cd; color: #7a5b00; }
.pill--published { background: #e5f6ea; color: #1a7a35; }
.tag-lead { background: var(--danger); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }

.grid2 { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.grid2 > div { min-width: 0; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; margin: 10px 0; font-weight: 600; font-size: 13px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); width: 100%; margin-top: 4px; font-weight: 400; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 6px 0 0; vertical-align: middle; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; padding: 12px 14px; }
legend { font-weight: 700; color: var(--heading); padding: 0 6px; }

.toolbar { display: flex; gap: 4px; flex-wrap: wrap; background: var(--white); border: 1px solid var(--line); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 6px; }
.toolbar button { border: 1px solid transparent; background: none; padding: 6px 10px; border-radius: 4px; }
.toolbar button:hover { background: var(--accent-soft); border-color: var(--accent); }
.body-editor { min-height: 340px; background: var(--white); border: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 14px; font-size: 16px; line-height: 1.7; }
.body-editor:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.body-editor img { max-width: 100%; }
.body-editor blockquote { border-left: 4px solid var(--line); margin-left: 0; padding-left: 14px; color: var(--muted); }

.featured-image img { max-width: 100%; border-radius: var(--radius-sm); display: block; margin-bottom: 8px; }
.save-status { font-size: 13px; margin-bottom: 10px; }
.save-status.ok { color: #1a7a35; }
.save-status.err { color: var(--danger); }

.drag-list { list-style: none; padding: 0; margin: 0; }
.drag-row { display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; margin-bottom: 6px; }
.drag-row.dragging { opacity: .4; }
.drag-row .handle { cursor: grab; color: var(--muted); }
.drag-row select { flex: 1; margin: 0; }

/* SEO box in the article editor */
.seo-box label { margin-top: 8px; }
.btn-small { padding: 2px 10px; font-size: 12px; margin-left: 6px; }
.seo-over { color: #b42318; font-weight: 700; }
.seo-checks { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; line-height: 1.6; }
.seo-checks .ok { color: #067647; }
.seo-checks .todo { color: #b54708; }

/* Traffic page */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.stat-tile { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--heading); line-height: 1.3; }
.traffic-box { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin: 16px 0; }
.traffic-box h2 { font-size: 16px; color: var(--heading); margin: 0 0 10px; }
.traffic-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.traffic-grid .traffic-box { margin: 0; }
.traffic-chart { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--accent); }
.chart-hit { fill: transparent; }
.chart-day:hover .chart-bar { fill: var(--navy); }
.chart-day:hover .chart-hit { fill: var(--accent-soft); }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 12px; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 4px 8px; }
.rank-table td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.rank-label { position: relative; padding-bottom: 12px !important; }
.rank-bar { position: absolute; left: 8px; bottom: 4px; height: 3px; max-width: calc(100% - 16px); border-radius: 2px; background: var(--accent); opacity: .55; }
.rank-num, .rank-pct { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; width: 1%; }
.rank-pct { color: var(--muted); }
@media (max-width: 800px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .traffic-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Country and topic checkboxes in the article editor (regions with their countries indented) */
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; padding: 3px 0 3px calc(var(--depth, 0) * 18px); font-weight: 400; cursor: pointer; }
.check input { margin: 0; }
fieldset .muted.small { margin: 0 0 8px; }

/* My account + Users pages */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.panel h2, .user-body h3 { font-size: 16px; color: var(--heading); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.user-body h3 { font-size: 14px; margin-top: 4px; }
.stack-form { margin: 0 0 8px; }
.stack-form + .stack-form { border-top: 1px solid var(--line); padding-top: 12px; }
.form-msg:empty { display: none; }
.notice { background: #fff3cd; color: #7a5b00; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.user-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.user-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.user-item > summary { cursor: pointer; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-item[open] > summary { border-bottom: 1px solid var(--line); }
.user-name { font-weight: 600; color: var(--heading); }
.user-tags { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.user-body { padding: 14px 16px; }
.user-add > summary .user-name { color: var(--accent); }
