/* ============================================================================
   Jacks of All Trades — Command Center (Business Hub) Styles
   File: assets/css/admin.css
   Generated: 2026-09-03 16:32 UTC  |  joatamp.org redesign
   ========================================================================== */

body.admin { background: var(--silver-050); }
/* Guarantee the hidden attribute wins over display:grid on #login/#app. */
[hidden] { display: none !important; }

/* ---- App shell ----------------------------------------------------------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }

/* Mobile overlay — always out of grid flow so it never steals a column. */
.scrim { position: fixed; inset: 0; background: rgba(5,7,13,.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.show { opacity: 1; pointer-events: auto; }
@media (min-width: 901px) { .scrim { display: none; } }

.sidebar {
  background: var(--navy-950); color: var(--text-invert-soft); padding: 1.4rem 1rem;
  display: flex; flex-direction: column; gap: .3rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (max-width: 900px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 60; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
}
.side-brand { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem 1.2rem; color: #fff; }
.side-brand .mark { width: 34px; height: 34px; }
.side-brand b { font-size: .96rem; line-height: 1.1; }
.side-brand span { display: block; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--slate-400); }
.side-group { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: #5f7099; margin: 1rem .7rem .3rem; font-weight: 700; }
.side-link {
  display: flex; align-items: center; gap: .7rem; padding: .62rem .7rem; border-radius: var(--r-sm);
  color: var(--text-invert-soft); font-size: .92rem; font-weight: 550; cursor: pointer; border: none; background: none; width: 100%; text-align: left; transition: background .15s, color .15s;
}
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: var(--blue-600); color: #fff; }
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link .count { margin-left: auto; font-size: .72rem; font-weight: 700; background: rgba(255,255,255,.14); padding: .1em .5em; border-radius: var(--r-pill); }
.side-link.active .count { background: rgba(255,255,255,.25); }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.1); }

/* ---- Main area ----------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 0 clamp(16px,3vw,32px); height: 66px; display: flex; align-items: center; gap: 1rem; }
.topbar h1 { font-size: 1.2rem; margin: 0; }
.burger { display: none; width: 40px; height: 40px; border: 1px solid var(--border); background: #fff; border-radius: var(--r-sm); cursor: pointer; align-items: center; justify-content: center; }
.burger svg { width: 20px; height: 20px; }
@media (max-width: 900px) { .burger { display: inline-flex; } }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.env-badge { font-size: .72rem; font-weight: 700; padding: .32em .8em; border-radius: var(--r-pill); }
.env-badge.live { background: rgba(18,138,90,.12); color: var(--success); }
.env-badge.demo { background: rgba(183,121,31,.14); color: var(--warning); }
.user-chip { display: flex; align-items: center; gap: .5rem; font-size: .86rem; font-weight: 600; color: var(--ink-700); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-size: .82rem; font-weight: 700; }

.view { padding: clamp(18px,3vw,32px); flex: 1; }
.view-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.view-head p { margin: .2rem 0 0; color: var(--text-soft); font-size: .92rem; }

/* ---- KPI cards ----------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.6rem; }
@media (max-width: 1040px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.3rem; box-shadow: var(--shadow-xs); }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.kpi .kpi-ico { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--blue-050); color: var(--accent); }
.kpi .kpi-ico svg { width: 20px; height: 20px; }
.kpi b { font-size: 1.9rem; font-weight: 850; letter-spacing: -.02em; color: var(--navy-900); display: block; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .84rem; color: var(--text-soft); font-weight: 600; }
.kpi .delta { font-size: .76rem; font-weight: 700; padding: .16em .5em; border-radius: var(--r-pill); }
.kpi .delta.up { background: rgba(18,138,90,.12); color: var(--success); }

/* ---- Panels & tables ----------------------------------------------------- */
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.panel + .panel { margin-top: 1.4rem; }
.panel-head { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 1.05rem; }
.panel-body { padding: 1.3rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.search { position: relative; }
.search input { padding: .55em .8em .55em 2.2em; border: 1.5px solid var(--border); border-radius: var(--r-sm); font: inherit; font-size: .9rem; min-width: 200px; }
.search svg { position: absolute; left: .7em; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--slate-400); }
.btn-sm { padding: .55em 1em; font-size: .86rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--slate-400); font-weight: 700; padding: .8rem 1.3rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: .85rem 1.3rem; border-bottom: 1px solid var(--silver-100); vertical-align: top; color: var(--ink-700); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--silver-050); }
table.data td .muted { color: var(--slate-400); font-size: .82rem; }
.tag { font-size: .72rem; font-weight: 700; padding: .18em .6em; border-radius: var(--r-pill); background: var(--silver-100); color: var(--ink-700); white-space: nowrap; }
.tag.new { background: var(--blue-050); color: var(--accent); }
.tag.done { background: rgba(18,138,90,.12); color: var(--success); }
.tag.active { background: rgba(183,121,31,.14); color: var(--warning); }
.empty { padding: 3rem 1.3rem; text-align: center; color: var(--text-soft); }
.empty svg { width: 40px; height: 40px; color: var(--silver-300); margin: 0 auto .8rem; }

/* ---- Login --------------------------------------------------------------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(120% 80% at 50% 0%, rgba(0, 118, 182,.25), transparent 55%), var(--navy-950); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: var(--r-xl); padding: clamp(1.8rem,4vw,2.6rem); box-shadow: var(--shadow-lg); }
.login-card .mark { width: 56px; height: 56px; margin-bottom: 1.2rem; }
.login-card h2 { font-size: 1.5rem; margin-bottom: .3rem; }
.login-card p.sub { color: var(--text-soft); font-size: .94rem; margin-bottom: 1.4rem; }
.login-demo { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--border); font-size: .86rem; color: var(--text-soft); }

/* ---- Editable stat rows -------------------------------------------------- */
.stat-edit { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.milestone-row { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--silver-100); }
.milestone-row:last-child { border-bottom: none; }
.milestone-row select { padding: .45em .7em; border: 1.5px solid var(--border); border-radius: var(--r-sm); font: inherit; font-size: .86rem; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy-900); color: #fff; padding: .8rem 1.4rem; border-radius: var(--r-pill); font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .3s var(--ease); z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================================
   HUB EXPANSION — role switch, cards, CRM, agents, modal
   Added: 2026-09-03 17:10 UTC
   ========================================================================== */

/* Topbar role switch */
.role-switch { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 600; color: var(--text-soft); }
.role-switch select { font: inherit; font-size: .82rem; font-weight: 650; padding: .3em .5em; border: 1.5px solid var(--border); border-radius: var(--r-sm); background: #fff; color: var(--ink-700); }
@media (max-width: 640px) { .role-switch span, .user-chip #user-email { display: none; } }

.side-link .count[hidden] { display: none !important; }
.btn-xs { padding: .38em .7em; font-size: .78rem; }

/* Dashboard two-column */
.dash-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.4rem; margin-bottom: 1.4rem; }
@media (max-width: 1040px) { .dash-2 { grid-template-columns: 1fr; } }
.cbar { margin-bottom: 1.1rem; }
.cbar:last-child { margin-bottom: 0; }
.cbar-top { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: .45rem; font-size: .9rem; flex-wrap: wrap; }
.agent-quick { display: grid; gap: .6rem; }
.agent-mini { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; cursor: pointer; text-align: left; transition: border-color .2s, box-shadow .2s; }
.agent-mini:hover { border-color: var(--blue-100); box-shadow: var(--shadow-xs); }
.agent-mini b { font-size: .92rem; } .agent-mini span:last-child { font-size: .78rem; color: var(--text-soft); margin-left: auto; }
.agent-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* New-record cards (campaigns, projects) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.ncard { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.4rem; box-shadow: var(--shadow-xs); transition: transform .2s var(--ease), box-shadow .2s; }
.ncard:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.ncard-top { display: flex; gap: .4rem; margin-bottom: .7rem; }
.ncard h4 { margin: 0 0 .3rem; font-size: 1.08rem; }
.ncard p { font-size: .9rem; color: var(--text-soft); margin: 0 0 .3rem; }
.ncard-foot { display: flex; justify-content: space-between; align-items: baseline; font-size: .88rem; }
.ncard-foot b { font-size: 1.15rem; color: var(--navy-900); }
.ncard-meta { font-size: .8rem; margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--silver-100); }

/* status tag colors reuse .tag.new/.done/.active from base */
.tag.done { background: rgba(18,138,90,.12); color: var(--success); }

/* Agents grid + cards */
.agents-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
@media (max-width: 900px) { .agents-grid { grid-template-columns: 1fr; } }
.agent-card { text-align: left; background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 1.3rem; cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s; display: flex; flex-direction: column; }
.agent-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.agent-card.on { border-color: var(--accent); box-shadow: var(--shadow-blue); }
.agent-badge { width: 42px; height: 42px; border-radius: var(--r-md); color: #fff; font-weight: 800; font-size: 1.2rem; display: grid; place-items: center; margin-bottom: .8rem; }
.agent-card b { font-size: 1.1rem; } .agent-role { font-size: .84rem; font-weight: 650; color: var(--ink-700); }
.agent-focus { font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--slate-400); margin: .3rem 0 .5rem; }
.agent-card p { font-size: .88rem; color: var(--text-soft); margin: 0; }

/* Chat console */
.chat-panel { display: flex; flex-direction: column; }
#chat-title { display: flex; align-items: center; gap: .5rem; }
.chat-log { padding: 1.3rem; display: flex; flex-direction: column; gap: 1rem; max-height: 56vh; min-height: 220px; overflow-y: auto; }
.chat-empty { margin: auto; text-align: center; color: var(--text-soft); max-width: 340px; }
.chat-empty svg { width: 36px; height: 36px; color: var(--silver-300); margin: 0 auto .6rem; }
.msg { max-width: 82%; }
.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; max-width: 92%; }
.msg-who { font-size: .74rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; display: block; margin-bottom: .25rem; }
.msg-body { padding: .8rem 1rem; border-radius: var(--r-md); font-size: .92rem; line-height: 1.6; }
.msg.user .msg-body { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .msg-body { background: var(--silver-050); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-body p { margin: 0 0 .6rem; } .msg-body p:last-child { margin-bottom: 0; }
.msg-body ul { margin: .3rem 0 .6rem; padding-left: 1.2rem; } .msg-body li { margin: .15rem 0; }
.msg-h { margin: .5rem 0 .3rem; font-size: .95rem; }
.msg-body code { background: rgba(9,18,38,.06); padding: .1em .35em; border-radius: 4px; font-size: .88em; }
.msg.user .msg-body code { background: rgba(255,255,255,.2); }
.tbl-wrap { overflow-x: auto; margin: .4rem 0 .6rem; }
table.mini { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.mini td { border: 1px solid var(--border); padding: .4rem .6rem; }
table.mini tr:first-child td { background: var(--silver-050); font-weight: 700; }
.typing { display: inline-flex; gap: 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--slate-400); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.chat-starters { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1.3rem .8rem; }
.starter { font: inherit; font-size: .82rem; padding: .45em .8em; border: 1px solid var(--border); border-radius: var(--r-pill); background: #fff; color: var(--ink-700); cursor: pointer; transition: .2s; }
.starter:hover { border-color: var(--accent); color: var(--accent); }
.chat-input { display: flex; gap: .6rem; padding: 1rem 1.3rem 1.3rem; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input textarea { flex: 1; font: inherit; font-size: .95rem; padding: .7em .9em; border: 1.5px solid var(--border); border-radius: var(--r-md); resize: none; max-height: 160px; }
.chat-input textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px rgba(59,130,246,.16); }
.chat-input .btn { padding: .7em .9em; }
.chat-input .btn svg { width: 20px; height: 20px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(5,7,13,.5); display: grid; place-items: center; padding: 20px; }
.modal-card { width: 100%; max-width: 540px; background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-x { border: none; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--slate-400); }
.modal-x:hover { color: var(--ink-900); }
#modal-form { overflow-y: auto; padding: 1.4rem; }
#modal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
#modal-fields .field:has(textarea), #modal-fields .field:last-child:nth-child(odd) { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .6rem; grid-column: 1/-1; }
@media (max-width: 520px) { #modal-fields { grid-template-columns: 1fr; } }
