/*
Theme Name: CadenceHub
Description: Personal dashboard theme for CadenceHub. Needs the CadenceHub Connect plugin for live data.
Version: 1.0.0
Requires PHP: 7.4
Requires at least: 6.0
Text Domain: cadencehub
*/

:root {
  --bg: #f5f6fa; --surface: #ffffff; --ink: #1d2233; --muted: #6b7185;
  --line: #e4e7f0; --accent: #a855f7; --accent-soft: #f3e8ff;
  --good: #0f9d58; --warn: #d97706; --bad: #dc2626; --radius: 14px;
  --page: linear-gradient(135deg, #fdf2f8 0%, #eef2ff 45%, #ecfeff 100%);
  --grad: linear-gradient(90deg, #f43f5e, #a855f7, #0ea5e9);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --surface: #181c26; --ink: #e8ebf3; --muted: #9aa1b5;
    --line: #262c3a; --accent: #c084fc; --accent-soft: #2e1f4d;
    --page: linear-gradient(135deg, #1b1033 0%, #0b1f2a 100%);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.5; min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a { padding: 7px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.site-nav a:hover { background: var(--bg); color: var(--ink); }
.site-nav a.current { background: var(--accent-soft); color: var(--accent); }

main.site-main { padding: 24px 28px 40px; max-width: 1200px; margin: 0 auto; }
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
h2 a { font-size: 13px; color: var(--accent); font-weight: 600; }
.sub { color: var(--muted); margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font-weight: 600; display: inline-block;
}
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(168,85,247,.35); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: 1.6fr 1fr; margin-bottom: 16px; }
.cats { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 700; margin: 4px 0; }
.cat { border-top: 4px solid var(--c); }
.cat .name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--c, #999); }
.stats { display: flex; gap: 14px; font-size: 13px; margin-top: 10px; }
.stats b { display: block; font-size: 16px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); display: inline-block; margin: 2px 2px 0 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.scheduled { background: #e0e7ff; color: #3730a3; }
.pill.published { background: #dcfce7; color: #166534; }
.pill.draft { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.failed { background: #fee2e2; color: #991b1b; }
.status { font-size: 12px; font-weight: 600; }
.status.ok { color: var(--good); } .status.warn { color: var(--warn); } .status.bad { color: var(--bad); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.row:last-child { border-bottom: none; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child { border-bottom: none; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.banner { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.empty { color: var(--muted); padding: 18px; text-align: center; }
.err { color: var(--bad); font-size: 12px; }
.muted { color: var(--muted); }

/* Login */
.login-wrap { display: grid; place-items: center; min-height: 70vh; padding: 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card form p { margin: 0 0 12px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.login-card input[type=text], .login-card input[type=password] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.login-card input[type=submit] { width: 100%; }
.login-card input[type=submit] {
  background: var(--grad); color: #fff; border: 0; border-radius: 10px; padding: 10px; font-weight: 600; cursor: pointer;
}

.site-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

@media (max-width: 900px) {
  .two { grid-template-columns: 1fr; }
  .site-header { padding: 12px 16px; }
  main.site-main { padding: 16px; }
}
