/* Publisher UI — single stylesheet, no framework. */
:root {
	--bg: #f4f5f7;
	--surface: #ffffff;
	--ink: #1a1d23;
	--muted: #6b7280;
	--line: #e5e7eb;
	--brand: #2563eb;
	--brand-dark: #1e40af;
	--sidebar: #11141b;
	--sidebar-ink: #c9cdd6;
	--green: #16a34a;
	--red: #dc2626;
	--amber: #d97706;
	--radius: 12px;
	--shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	background: var(--bg);
	color: var(--ink);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

/* ---------- App shell ---------- */
body.app { display: flex; min-height: 100vh; }

.sidebar {
	width: 240px;
	background: var(--sidebar);
	color: var(--sidebar-ink);
	display: flex;
	flex-direction: column;
	position: fixed;
	inset: 0 auto 0 0;
	z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; font-weight: 700; color: #fff; font-size: 1.15rem; }
.brand-logo { font-size: 1.4rem; }
.nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; flex: 1; }
.nav a { color: var(--sidebar-ink); padding: 11px 14px; border-radius: 9px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.logout { color: var(--sidebar-ink); font-size: .9rem; }

.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
	height: 60px; background: var(--surface); border-bottom: 1px solid var(--line);
	display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; }
.hamburger { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--ink); }
.content { padding: 24px; max-width: 1200px; width: 100%; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 18px; box-shadow: var(--shadow);
}
.stat .stat-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat .stat-label { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.stat.green .stat-num { color: var(--green); }
.stat.red .stat-num { color: var(--red); }
.stat.amber .stat-num { color: var(--amber); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfc; }
table.data td.wrap { white-space: normal; max-width: 340px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge.planned { background: #e0e7ff; color: #3730a3; }
.badge.published { background: #dcfce7; color: #166534; }
.badge.error { background: #fee2e2; color: #991b1b; }
.badge.skipped { background: #f3f4f6; color: #4b5563; }
.badge.on { background: #dcfce7; color: #166534; }
.badge.off { background: #f3f4f6; color: #6b7280; }
.badge.warn { background: #fef3c7; color: #92400e; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
	background: var(--brand); color: #fff; border: 1px solid var(--brand);
	padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: .9rem; font-family: inherit;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f3f4f6; }
.btn.sm { padding: 5px 11px; font-size: .82rem; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ---------- Forms ---------- */
form .form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
form label { font-weight: 600; font-size: .85rem; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=datetime-local], input[type=time], input[type=date], select, textarea {
	width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-family: inherit; font-size: .92rem; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { min-height: 90px; resize: vertical; }
.hint { color: var(--muted); font-size: .8rem; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.info { background: #dbeafe; color: #1e40af; }
.flash.warning { background: #fef3c7; color: #92400e; }

/* ---------- Login ---------- */
body.guest { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.login-card { background: #fff; padding: 36px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 360px; text-align: center; }
.login-card .login-logo { font-size: 2.6rem; }
.login-card h1 { margin: 8px 0 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: .9rem; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: .85em; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f3f4f6; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.pageinfo { color: var(--muted); font-size: .85rem; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head { font-weight: 600; color: var(--muted); font-size: .8rem; text-align: center; padding: 4px 0; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 110px; padding: 8px; }
.cal-day.other { background: #fafafa; opacity: .55; }
.cal-day.holiday { background: #fff7ed; }
.cal-day.weekend { background: #f8fafc; }
.cal-date { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.cal-item { font-size: .72rem; padding: 2px 5px; border-radius: 5px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.t-image { background: #e0e7ff; }
.cal-item.t-link { background: #dcfce7; }
.cal-item.s-published { opacity: .6; }
.cal-item.s-error { background: #fee2e2; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
	.main { margin-left: 0; }
	.sidebar { transform: translateX(-100%); transition: transform .2s ease; }
	.sidebar.open { transform: translateX(0); }
	.hamburger { display: block; }
	.content { padding: 16px; }
	.cards { grid-template-columns: repeat(2, 1fr); }
	.cal { grid-template-columns: 1fr; gap: 6px; }
	.cal-head { display: none; }
	.cal-day { min-height: auto; }
	table.data td.hide-sm, table.data th.hide-sm { display: none; }
}
