/* GL Client DB — Guideline Brand-aligned UI (Oct 2025 Brand Guide) */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Guideline Brand Palette ── */
  --navy:    #051857;
  --blue:    #0161FE;
  --ivory:   #F0E9DF;
  --linen:   #F6F4F2;
  --slate:   #D9E0E7;
  --charcoal:#232323;
  --yellow:  #F2F170;
  --white:   #FFFFFF;
  --muted:   #4B6070;

  /* ── Semantic tokens ── */
  --bg:      var(--ivory);
  --surface: var(--white);
  --border:  var(--slate);
  --text:    var(--charcoal);
  --radius:  5px;
  --shadow:  0 1px 3px rgba(5,24,87,.07), 0 1px 2px rgba(5,24,87,.05);
  --shadow-hover: 0 6px 20px rgba(1,97,254,.13);
}

body {
  font-family: 'Switzer', Calibri, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
}

/* ── Header ── */
header {
  background: var(--navy);
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  height: 100px;
  gap: 1rem;
}
header a { text-decoration: none; }

/* Brand lockup */
.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand-wordmark { display: block; overflow: visible; }

header nav { margin-left: auto; display: flex; gap: .75rem; align-items: center; }

/* ── Layout ── */
main { max-width: 1320px; margin: 0 auto; padding: 1.25rem 1.75rem; }

/* ── App body with sidebar ── */
.app-body {
  display: flex;
  min-height: calc(100vh - 100px);
}
.app-body > main {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
}

/* ── Sidebar ── */
.sidebar {
  width: 192px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}
.sb-section { padding: 0 .625rem; margin-bottom: .5rem; }
.sb-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--blue);
  padding: .2rem .625rem .3rem;
}
.sb-item {
  display: block;
  padding: .375rem .75rem;
  border-radius: var(--radius);
  font-size: .825rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, background .15s;
  letter-spacing: .01em;
}
.sb-item:hover { color: var(--navy); background: var(--linen); }
.sb-item.active {
  color: var(--navy);
  font-weight: 600;
  background: var(--linen);
  box-shadow: inset 3px 0 0 var(--navy);
}
.sb-rule {
  height: 1px;
  background: var(--border);
  margin: .5rem .75rem .625rem;
}

/* ── Search bar ── */
.search-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: .875rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  box-shadow: var(--shadow);
  margin-bottom: .875rem;
}
.search-row {
  display: flex;
  gap: .625rem;
  align-items: center;
  flex-wrap: wrap;
}
.search-row--filters {
  padding-top: .125rem;
  border-top: 1px solid var(--border);
}
.search-bar input[type="text"] {
  flex: 1 1 240px;
  padding: .45rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .875rem;
  background: var(--linen);
  color: var(--text);
  outline: none;
  transition: border-color .15s, background .15s;
}
.search-bar input[type="text"]:focus { border-color: var(--blue); background: var(--white); }
.search-bar input[type="text"]::placeholder { color: var(--muted); }

.search-bar select {
  padding: .45rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .825rem;
  background: var(--linen);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.search-bar select:focus { border-color: var(--blue); }

.search-bar label.review-toggle {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.search-bar button[type="submit"] {
  padding: .45rem 1.2rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
  letter-spacing: .015em;
}
.search-bar button[type="submit"]:hover { opacity: .88; }

/* ── Results meta ── */
.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.results-meta > span { font-weight: 700; color: var(--text); text-transform: none; }
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .75rem;
  background: var(--navy);
  color: #fff;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.export-btn:hover { opacity: .85; }
.export-btn--all {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--navy);
}
.export-btn--all:hover { background: var(--navy); color: #fff; opacity: 1; }

/* ── Result cards — 3-column grid ── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .625rem;
}
@media (max-width: 1060px) { .results-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .results-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: .65rem .875rem;
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-left-color .15s, transform .1s;
  min-width: 0;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  border-left-color: var(--navy);
  transform: translateY(-1px);
}

.card-body { flex: 1; min-width: 0; }
.card-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}
.card-meta { display: flex; flex-wrap: wrap; gap: .25rem; }

.card-hosts {
  flex-shrink: 0;
  text-align: right;
  padding-top: .1rem;
}
.card-hosts .count {
  display: inline-block;
  background: rgba(1,97,254,.08);
  color: var(--blue);
  border-radius: 99px;
  padding: .1rem .55rem;
  font-weight: 600;
  font-size: .7rem;
  white-space: nowrap;
}
.card-hosts span[style] { font-size: .7rem; }

/* ── Chips ── */
.chip {
  display: inline-block;
  border-radius: 3px;
  padding: .1rem .45rem;
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.chip-holding { background: var(--navy);    color: #fff; }
.chip-brand   { background: var(--blue);    color: #fff; }
.chip-agency  { background: var(--charcoal); color: #fff; }
.chip-type    { background: #7c3aed;        color: #fff; }        /* purple */
.chip-review    { background: var(--yellow);  color: var(--navy); }
.chip-55        { background: #0e7490;        color: #fff; }        /* teal */
.chip-no-admins { background: #6b7280;        color: #fff; }        /* neutral grey */

/* ── Detail page ── */
.detail-header {
  margin-bottom: 1.125rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.detail-header h1 { font-size: 1.35rem; font-weight: 700; flex: 1; color: var(--navy); }

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.125rem;
  align-items: start;
}
.detail-col { display: flex; flex-direction: column; gap: 1.125rem; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--blue);
  margin-bottom: .75rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
}

/* Confluence page content */
.page-content {
  font-size: .85rem;
  line-height: 1.75;
  overflow-wrap: break-word;
  color: var(--charcoal);
}
.page-content h1, .page-content h2, .page-content h3 {
  margin: 1rem 0 .45rem;
  font-weight: 600;
  color: var(--navy);
}
.page-content p { margin-bottom: .7rem; }
.page-content table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.page-content th, .page-content td {
  border: 1px solid var(--border);
  padding: .35rem .7rem;
  font-size: .8rem;
  vertical-align: top;
}
.page-content th { background: var(--linen); font-weight: 600; color: var(--navy); }
.page-content a { color: var(--blue); }
.page-content ul, .page-content ol { padding-left: 1.5rem; margin-bottom: .7rem; }

/* Host links */
.host-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.host-list li {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  flex-wrap: wrap;
}
.host-list li a {
  font-size: .8rem;
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
  flex: 1;
}
.host-list li a:hover { text-decoration: underline; }
.host-list li .db-label {
  flex-shrink: 0;
  font-size: .65rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--linen);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .1rem .4rem;
  white-space: nowrap;
  letter-spacing: .02em;
  text-transform: uppercase;
  align-self: flex-start;
  margin-top: .1rem;
}
.host-meta {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .2rem;
}
.host-meta-item {
  font-size: .75rem;
  color: var(--muted);
}
.host-meta-label {
  font-weight: 600;
  color: var(--navy);
  margin-right: .2rem;
}

/* Header nav links */
.nav-link {
  font-size: .8rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .15s;
  margin-right: .75rem;
}
.nav-link:hover { color: var(--yellow); }

/* ── Decommissioned page ── */
.decomm-count {
  display: inline-block;
  padding: .15rem .55rem;
  background: var(--ivory);
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}
.decomm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.decomm-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.decomm-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.decomm-table tr:last-child td { border-bottom: none; }
.decomm-table tr:hover td { background: var(--linen); }
.decomm-link {
  font-size: .8rem;
  color: var(--blue);
  text-decoration: none;
}
.decomm-link:hover { text-decoration: underline; }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: .875rem;
  letter-spacing: .01em;
  transition: color .15s;
}
.back-link:hover { color: var(--blue); }

/* ── Login page ── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--navy);
}
.login-card {
  background: var(--white);
  border-radius: 8px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(5,24,87,.25);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: 1.75rem;
}
.login-wordmark { display: block; overflow: visible; }
.login-heading {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .25rem;
}
.login-subheading {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.login-error {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: .6rem .875rem;
  font-size: .82rem;
  margin-bottom: 1rem;
}
.login-form { display: flex; flex-direction: column; gap: .5rem; }
.login-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: .5rem;
  letter-spacing: .02em;
}
.login-input {
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.login-input:focus { border-color: var(--blue); }
.login-btn {
  margin-top: 1rem;
  padding: .6rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.login-btn:hover { opacity: .88; }

/* ── Admin user management ── */
.admin-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .375rem;
}
.admin-sub {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 1.125rem;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.admin-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.admin-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.you-badge {
  display: inline-block;
  margin-left: .4rem;
  padding: .1rem .4rem;
  background: var(--ivory);
  border-radius: 3px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 3px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-user  { background: var(--ivory); color: var(--muted); }
.admin-date { color: var(--muted); font-size: .78rem; }
.admin-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.action-btn {
  padding: .25rem .65rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--blue);
  background: transparent;
  color: var(--blue);
  transition: background .15s, color .15s;
}
.action-btn:hover { background: var(--blue); color: #fff; }
.action-btn--muted { border-color: var(--border); color: var(--muted); }
.action-btn--muted:hover { background: var(--border); color: var(--text); }
.action-btn--danger { border-color: #fca5a5; color: #b91c1c; }
.action-btn--danger:hover { background: #b91c1c; color: #fff; border-color: #b91c1c; }

/* Sync button + progress (in header) */
.sync-area { display: flex; align-items: center; gap: .75rem; }

.sync-btn {
  padding: .3rem .8rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .75rem;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  letter-spacing: .02em;
  transition: border-color .15s, color .15s;
}
.sync-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.sync-btn:disabled { opacity: .4; cursor: default; }

/* Progress indicator shown while sync is running */
.sync-progress {
  display: none;
  flex-direction: column;
  gap: .2rem;
  min-width: 220px;
}
.sync-progress-label {
  font-size: .7rem;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.sync-progress-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sync-progress-track {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,.18);
  border-radius: 99px;
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 99px;
  transition: width .35s ease;
}
.sync-progress-pct {
  font-size: .65rem;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  min-width: 28px;
  text-align: right;
}

/* Confluence link */
.confluence-link {
  font-size: .75rem;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: color .15s;
}
.confluence-link:hover { color: var(--blue); }

/* Client admin list */
.admin-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.admin-list li { display: flex; flex-direction: column; gap: .1rem; }
.admin-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--charcoal);
}
.admin-email {
  font-size: .77rem;
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
}
.admin-email:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state p { font-size: .95rem; }

/* ── Panel header (title + count badge in one row) ── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ── SMI status chips ── */
.chip-active   { background: #d1fae5; color: #065f46; }
.chip-inactive { background: #fee2e2; color: #991b1b; }  /* red */
.chip-pending  { background: #fef3c7; color: #92400e; }  /* yellow */

/* ── SMI client type chips ── */
.chip-type-agency              { background: #7c3aed; color: #fff; }  /* purple */
.chip-type-publisher           { background: #3b82f6; color: #fff; }  /* blue */
.chip-type-contributor         { background: #059669; color: #fff; }  /* green */
.chip-type-internal            { background: #64748b; color: #fff; }  /* slate */

/* ── SMI client cards ── */
.smi-card {
  flex-direction: column;
  gap: .5rem;
  cursor: default;
}
.smi-card:hover {
  box-shadow: var(--shadow);
  border-left-color: var(--blue);
  transform: none;
}
.smi-card-top { display: flex; flex-direction: column; gap: .3rem; width: 100%; }
.smi-parent-client {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--blue);
  opacity: .75;
}
.smi-card-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.smi-card-dates {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .1rem;
}
.smi-date-sep { color: var(--border); }
.smi-card-modules {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  padding-top: .4rem;
  border-top: 1px solid var(--border);
}
.smi-module-tag {
  display: inline-block;
  padding: .1rem .45rem;
  background: var(--linen);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: .65rem;
  color: var(--text);
  white-space: nowrap;
}
.smi-module-more {
  display: inline-block;
  padding: .1rem .3rem;
  font-size: .65rem;
  color: var(--blue);
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
}
.smi-module-more:hover {
  color: var(--navy);
}

/* ── SMI upsells section ── */
.smi-card-upsells {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}
.smi-upsells-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.smi-upsell-tag {
  display: inline-block;
  padding: .1rem .45rem;
  margin: 0 .25rem .25rem 0;
  background: #fef3c7;
  color: #92400e;
  border-radius: 3px;
  font-size: .65rem;
  font-weight: 500;
  border: 1px solid #fde68a;
}
