/* Audentia SEO Command Center
   Light, neutral surfaces with deep indigo accents. */

:root {
  --ink:        #15172b;
  --ink-soft:   #5a5f7a;
  --ink-faint:  #8b90a8;
  --indigo:     #3b2d8f;
  --indigo-600: #4a39b0;
  --indigo-050: #eeecfa;
  --violet:     #7c5cd6;
  --line:       #e4e6f0;
  --surface:    #ffffff;
  --canvas:     #f6f7fb;
  --ok:         #1d7a46;
  --ok-bg:      #e6f6ec;
  --warn:       #9a6b00;
  --warn-bg:    #fdf3dc;
  --bad:        #b3261e;
  --bad-bg:     #fdecea;
  --radius:     12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo); }

/* ── Shell ─────────────────────────────────────────────── */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: linear-gradient(180deg, #221a52 0%, #15102f 100%);
  color: #cfcbe8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand strong { display: block; color: #fff; font-size: .95rem; letter-spacing: -.01em; }
.sidebar-brand small  { display: block; color: #9f9ac4; font-size: .72rem; }

.mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--violet), var(--indigo));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  flex: 0 0 34px;
}

.sidebar-nav { padding: .75rem .6rem; flex: 1; overflow-y: auto; }
.sidebar-nav a {
  display: block;
  padding: .55rem .75rem;
  margin-bottom: 2px;
  border-radius: 8px;
  color: #c3bfe2;
  text-decoration: none;
  font-size: .875rem;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.is-active { background: rgba(124,92,214,.26); color: #fff; font-weight: 600; }

.sidebar-foot { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .who { margin-bottom: .6rem; }
.sidebar-foot .who strong { display: block; color: #fff; font-size: .82rem; }
.sidebar-foot .who small  { display: block; color: #9f9ac4; font-size: .72rem; word-break: break-all; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: .9rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; }

.content { padding: 1.5rem 1.75rem; flex: 1; max-width: 1280px; width: 100%; }

.foot {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: .78rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Cards ─────────────────────────────────────────────── */

.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel { margin-bottom: 1.25rem; }
.panel-head {
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: .95rem; font-weight: 650; }
.panel-head .hint { color: var(--ink-faint); font-size: .78rem; font-weight: 400; }
.panel-body { padding: 1.1rem; }
.panel-body.tight { padding: 0; }

/* ── Stat tiles ────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .95rem 1.05rem;
}
.tile .label { color: var(--ink-soft); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 1.65rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.2; margin-top: .2rem; }
.tile .sub   { color: var(--ink-faint); font-size: .76rem; }
.tile.accent { background: linear-gradient(135deg, var(--indigo-050), #fff); border-color: #d9d4f5; }
.tile.danger .value { color: var(--bad); }
.tile.good   .value { color: var(--ok); }

/* ── Tables ────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.data th {
  text-align: left;
  padding: .6rem .9rem;
  background: #fafbfe;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
table.data td { padding: .65rem .9rem; border-bottom: 1px solid #f0f1f7; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fcfcff; }

/* ── Badges ────────────────────────────────────────────── */

.badge-soft {
  display: inline-block;
  padding: .18rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.b-ok      { background: var(--ok-bg);   color: var(--ok); }
.b-warn    { background: var(--warn-bg); color: var(--warn); }
.b-bad     { background: var(--bad-bg);  color: var(--bad); }
.b-neutral { background: #eef0f6;        color: var(--ink-soft); }
.b-indigo  { background: var(--indigo-050); color: var(--indigo); }

/* ── Empty states ──────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--ink-soft);
}
.empty .icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--indigo-050);
  color: var(--indigo);
  display: grid; place-items: center;
  margin: 0 auto .8rem;
  font-size: 1.3rem;
}
.empty h3 { font-size: .98rem; font-weight: 650; color: var(--ink); margin-bottom: .3rem; }
.empty p  { font-size: .86rem; max-width: 460px; margin: 0 auto 1rem; }

/* ── Forms ─────────────────────────────────────────────── */

.form-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .25rem; }
.form-text  { font-size: .78rem; color: var(--ink-faint); }
.form-control, .form-select {
  border-color: #d9dbe7;
  border-radius: 9px;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 .2rem rgba(124,92,214,.15);
}
textarea.form-control { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .83rem; }

.btn { border-radius: 9px; font-size: .875rem; font-weight: 550; }
.btn-primary { background: var(--indigo); border-color: var(--indigo); }
.btn-primary:hover, .btn-primary:focus { background: var(--indigo-600); border-color: var(--indigo-600); }
.btn-sm { font-size: .8rem; }

.alert { border-radius: 10px; border: 1px solid transparent; font-size: .875rem; }
.alert-success { background: var(--ok-bg);   border-color: #bfe6cd; color: #10512e; }
.alert-danger  { background: var(--bad-bg);  border-color: #f2c4c0; color: #8c1d16; }
.alert-warning { background: var(--warn-bg); border-color: #ecd9a5; color: #6f4d00; }
.alert-info    { background: var(--indigo-050); border-color: #d4cef5; color: #2f2470; }

/* ── Auth ──────────────────────────────────────────────── */

.auth-body {
  background: linear-gradient(140deg, #1c1544 0%, #2b2066 55%, #3b2d8f 100%);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.auth-brand strong { display: block; color: #fff; font-size: 1rem; }
.auth-brand small  { display: block; color: #b9b3dd; font-size: .74rem; }
.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: 0 18px 50px rgba(10,6,40,.35);
}
.auth-foot { text-align: center; color: #a49dcf; font-size: .74rem; margin-top: 1rem; }

/* ── Editor ────────────────────────────────────────────── */

.editor-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); gap: 1.25rem; }
.preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem;
  background: #fff;
  max-height: 640px;
  overflow-y: auto;
  font-size: .9rem;
}
.preview h2 { font-size: 1.1rem; margin: 1.1rem 0 .4rem; font-weight: 650; }
.preview h3 { font-size: .98rem; margin: .9rem 0 .35rem; font-weight: 600; }
.preview p  { margin-bottom: .7rem; }
.preview a  { color: var(--indigo); text-decoration: underline; }

.checklist-item {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: .5rem;
  font-size: .85rem;
}
.checklist-item.done { background: var(--ok-bg); border-color: #cbe9d6; }
.checklist-item .why { color: var(--ink-faint); font-size: .78rem; }

.link-row {
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: .45rem;
  font-size: .82rem;
  word-break: break-all;
}
.link-row.ok  { border-color: #cbe9d6; background: var(--ok-bg); }
.link-row.bad { border-color: #f2c4c0; background: var(--bad-bg); }

.muted { color: var(--ink-faint); }
.small-caps { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 1080px) {
  .editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
  .sidebar-nav a { flex: 0 0 auto; }
  .sidebar-foot { display: flex; align-items: center; gap: 1rem; }
  .sidebar-foot form { margin-left: auto; }
  .content, .topbar, .foot { padding-left: 1rem; padding-right: 1rem; }
}
