/* AI Dashboard — shared parchment theme.
   Used by every page in this repo. Cartouche header, lock screen,
   card grid, hero stats, tables, charts, cheat-sheet cards, footer.
*/

*{box-sizing:border-box;margin:0;padding:0;}
html,body{width:100%;min-height:100vh;}
body{
  background:#dfc99a;
  font-family:'Crimson Text',serif;
  color:#0f0800;
  min-height:100vh;
  padding:2rem 1rem;
  position:relative;
  overflow-x:hidden;
}
.parchment-bg{position:fixed;inset:0;background:repeating-linear-gradient(0deg,transparent,transparent 28px,rgba(101,67,33,0.04) 29px),repeating-linear-gradient(90deg,transparent,transparent 28px,rgba(101,67,33,0.04) 29px);pointer-events:none;z-index:0;}
.vignette{position:fixed;inset:0;background:radial-gradient(ellipse at center,transparent 40%,rgba(80,40,10,0.35) 100%);pointer-events:none;z-index:0;}

.outer-border{
  position:relative;z-index:1;
  border:3px solid #5a3510;border-radius:4px;padding:4px;
  max-width:920px;width:100%;margin:0 auto;
  background:#dfc99a;
}
.outer-border.narrow{max-width:680px;}
.inner-border{
  border:1.5px solid #7a4e20;border-radius:2px;
  padding:2.4rem 2rem 2.6rem;
}

.corner-ornament{position:absolute;font-size:20px;color:#1a0f00;line-height:1;}
.corner-tl{top:10px;left:10px;}
.corner-tr{top:10px;right:10px;transform:scaleX(-1);}
.corner-bl{bottom:10px;left:10px;transform:scaleY(-1);}
.corner-br{bottom:10px;right:10px;transform:scale(-1);}

.cartouche{text-align:center;margin-bottom:1.6rem;}
.cartouche-border{
  border:2px solid #5a3510;border-radius:50% / 30%;
  padding:1rem 2.2rem 1.2rem;display:inline-block;min-width:60%;
  background:rgba(180,130,70,0.3);position:relative;
}
.cartouche-border::before,.cartouche-border::after{content:'-- * --';display:block;font-size:12px;color:#1a0f00;letter-spacing:0.2em;}
.cartouche-border::before{margin-bottom:0.3rem;}
.cartouche-border::after{margin-top:0.3rem;}

h1{font-family:'Cinzel',serif;font-size:1.7rem;font-weight:700;color:#0f0800;line-height:1.15;letter-spacing:0.04em;}
.subtitle{font-family:'IM Fell English',serif;font-style:italic;font-size:1.05rem;color:#1a0f00;margin-top:0.3rem;}

h2{
  font-family:'Cinzel',serif;font-weight:700;font-size:1.05rem;letter-spacing:0.08em;text-transform:uppercase;
  color:#5a3510;margin:1.8rem 0 0.8rem;padding-bottom:0.4rem;
  border-bottom:1px solid rgba(122,78,32,0.4);
}
h2 .h2-sub{font-family:'IM Fell English',serif;font-style:italic;font-weight:400;font-size:0.85rem;text-transform:none;letter-spacing:0;color:#3a2510;margin-left:0.6rem;}

p{line-height:1.55;margin-bottom:0.8rem;}

/* ---------- Lock screen ---------- */
.lockscreen{display:flex;flex-direction:column;align-items:center;gap:1.4rem;padding:1rem 0;}
.lock-prompt{font-family:'IM Fell English',serif;font-style:italic;font-size:1.1rem;color:#1a0f00;text-align:center;}
.pin-row{display:flex;gap:0.6rem;justify-content:center;}
.pin-row input{
  width:46px;height:58px;font-size:24px;text-align:center;
  background:#f3e6c4;color:#0f0800;
  border:1.5px solid #7a4e20;border-radius:4px;outline:none;
  font-family:'Cinzel',serif;font-weight:700;
  caret-color:#5a3510;
}
.pin-row input:focus{border-color:#5a3510;background:#fbefcf;box-shadow:0 0 0 2px rgba(90,53,16,0.25);}
.pin-error{font-family:'IM Fell English',serif;font-style:italic;color:#7a2a1a;font-size:0.95rem;min-height:1.2em;}

/* ---------- Card grid (used by index "hub" page) ---------- */
.cards{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:1rem;margin-top:0.5rem;
}
.card{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-decoration:none;color:#0f0800;
  border:2px solid #5a3510;border-radius:6px;
  padding:1.4rem 1rem;
  background:rgba(180,130,70,0.18);
  transition:transform 0.18s, background 0.18s, box-shadow 0.18s;
  text-align:center;
  min-height:140px;
}
.card:hover{
  transform:translateY(-2px);
  background:rgba(180,130,70,0.32);
  box-shadow:0 6px 18px rgba(80,40,10,0.18);
}
.card.disabled{opacity:0.55;cursor:default;pointer-events:none;}
.card svg{width:36px;height:36px;color:#5a3510;margin-bottom:0.6rem;}
.card-title{font-family:'Cinzel',serif;font-size:1.05rem;font-weight:700;letter-spacing:0.04em;}
.card-sub{font-family:'IM Fell English',serif;font-style:italic;font-size:0.85rem;color:#1a0f00;margin-top:0.2rem;}

/* ---------- Hero stats ---------- */
.hero{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:1rem;margin:1rem 0 0.5rem;
}
.hero-card{
  border:2px solid #5a3510;border-radius:6px;
  padding:1rem 1rem;
  background:rgba(180,130,70,0.18);
  text-align:center;
}
.hero-label{font-family:'Cinzel',serif;font-size:0.78rem;letter-spacing:0.1em;text-transform:uppercase;color:#5a3510;margin-bottom:0.3rem;}
.hero-value{font-family:'Cinzel',serif;font-weight:700;font-size:1.85rem;color:#0f0800;line-height:1.05;}
.hero-sub{font-family:'IM Fell English',serif;font-style:italic;font-size:0.85rem;color:#3a2510;margin-top:0.25rem;}
.hero-card.green .hero-value{color:#356635;}
.hero-card.gold  .hero-value{color:#7a4e20;}

/* ---------- Chart ---------- */
.chart-wrap{
  background:rgba(180,130,70,0.1);
  border:1px solid rgba(122,78,32,0.4);
  border-radius:4px;
  padding:1rem;
}
.chart{display:block;width:100%;height:200px;}
.chart .bar{fill:#7a4e20;}
.chart .bar:hover{fill:#5a3510;}
.chart .axis{stroke:#3a2510;stroke-width:1;}
.chart .axis-label{font-family:'IM Fell English',serif;font-style:italic;font-size:11px;fill:#3a2510;}
.chart .bar-label{font-family:'IM Fell English',serif;font-style:italic;font-size:10px;fill:#0f0800;text-anchor:middle;}

/* ---------- Tables ---------- */
table{width:100%;border-collapse:collapse;margin:0.5rem 0;font-size:0.95rem;}
th,td{text-align:left;padding:0.42rem 0.6rem;border-bottom:1px solid rgba(122,78,32,0.25);}
th{font-family:'Cinzel',serif;font-size:0.78rem;letter-spacing:0.08em;text-transform:uppercase;color:#5a3510;font-weight:700;}
td.num{text-align:right;font-variant-numeric:tabular-nums;}
tr:last-child td{border-bottom:none;}
tr:hover td{background:rgba(180,130,70,0.12);}

/* ---------- Cheat-sheet cards ---------- */
.cheat{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:1rem;
}
.cheat-card{
  border:1.5px solid rgba(122,78,32,0.5);border-radius:4px;
  padding:0.8rem 1rem 0.9rem;
  background:rgba(180,130,70,0.1);
}
.cheat-card h3{
  font-family:'Cinzel',serif;font-size:0.92rem;font-weight:700;letter-spacing:0.06em;
  color:#5a3510;margin-bottom:0.5rem;
}
.cheat-card dl{display:block;margin:0;}
.cheat-card dt{
  font-family:'Courier New',monospace;font-size:0.85rem;color:#0f0800;
  background:rgba(255,245,210,0.5);padding:0.08rem 0.45rem;border-radius:3px;
  display:inline-block;max-width:100%;word-break:break-all;
}
.cheat-card dd{
  font-size:0.9rem;line-height:1.35;color:#1a0f00;
  margin:0.2rem 0 0.6rem 0.3rem;
}
.cheat-card dd:last-child{margin-bottom:0;}

/* ---------- Agent-row list ---------- */
.agents{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:0.6rem;}
.agent-row{
  border-left:3px solid #7a4e20;
  background:rgba(180,130,70,0.08);
  padding:0.55rem 0.8rem;border-radius:0 4px 4px 0;
}
.agent-name{
  font-family:'Courier New',monospace;font-size:0.92rem;font-weight:700;color:#5a3510;
}
.agent-desc{font-size:0.88rem;color:#1a0f00;margin-top:0.15rem;line-height:1.35;}

/* ---------- Agents dashboard ---------- */
#agents-table td{vertical-align:top;}
.agent-cell{min-width:140px;}
.agent-cell .agent-name{
  font-family:'Courier New',monospace;font-size:0.95rem;font-weight:700;color:#5a3510;
  margin-bottom:0.15rem;
}
.agent-meta{font-family:'IM Fell English',serif;font-style:italic;font-size:0.78rem;color:#3a2510;}
.agent-desc-cell{font-size:0.88rem;line-height:1.4;color:#1a0f00;}
.agent-main{cursor:pointer;}
.agent-main:hover td{background:rgba(180,130,70,0.16);}
.agent-detail{display:none;}
.agent-detail.open{display:table-row;}
.agent-detail td{
  background:rgba(180,130,70,0.06);
  border-bottom:1px solid rgba(122,78,32,0.25);
  padding:0.6rem 1rem 0.9rem;
  font-size:0.88rem;
}
.detail-grid .summaries{list-style:none;padding:0;margin:0.2rem 0 0;}
.detail-grid .summaries li{
  padding:0.25rem 0;display:flex;flex-wrap:wrap;align-items:baseline;gap:0.5rem;
  border-bottom:1px dotted rgba(122,78,32,0.2);
}
.detail-grid .summaries li:last-child{border-bottom:none;}

/* Outcome pills */
.pill{
  display:inline-block;font-family:'Cinzel',serif;font-size:0.68rem;
  letter-spacing:0.08em;text-transform:uppercase;font-weight:700;
  padding:0.1rem 0.5rem;border-radius:10px;border:1px solid currentColor;
  line-height:1.5;
}
.pill.ok{color:#356635;background:rgba(80,140,80,0.12);}
.pill.warn{color:#8a5a10;background:rgba(180,130,40,0.15);}
.pill.bad{color:#7a2a1a;background:rgba(180,60,40,0.12);}
.pill.dim{color:#3a2510;background:rgba(120,90,60,0.10);}
.dim{color:#3a2510;opacity:0.7;}

/* Recent activity feed */
.recent-feed{display:flex;flex-direction:column;gap:0.4rem;}
.recent-row{
  display:grid;grid-template-columns:auto 130px 1fr auto;gap:0.6rem;align-items:baseline;
  padding:0.4rem 0.7rem;
  background:rgba(180,130,70,0.08);
  border-left:3px solid #7a4e20;border-radius:0 4px 4px 0;
  font-size:0.9rem;
}
.recent-agent{font-family:'Courier New',monospace;font-weight:700;color:#5a3510;font-size:0.88rem;}
.recent-summary{color:#1a0f00;line-height:1.35;}
.recent-ts{font-family:'IM Fell English',serif;font-style:italic;font-size:0.82rem;text-align:right;}
.empty-feed{
  padding:1rem;text-align:center;
  font-family:'IM Fell English',serif;font-style:italic;color:#3a2510;
  background:rgba(180,130,70,0.08);border-radius:4px;
}
@media (max-width:640px){
  .recent-row{grid-template-columns:1fr;gap:0.2rem;}
  .recent-ts{text-align:left;}
}

/* ---------- Routines dashboard extras ---------- */
.channel-badge{
  display:inline-block;font-family:'IM Fell English',serif;font-style:italic;
  font-size:0.82rem;color:#3a2510;
  background:rgba(180,130,70,0.15);
  padding:0.08rem 0.5rem;border-radius:3px;border:1px solid rgba(122,78,32,0.4);
  margin-right:0.2rem;
}
#routines-table td code{
  font-family:'Courier New',monospace;font-size:0.85rem;color:#5a3510;
  background:rgba(255,245,210,0.5);padding:0.05rem 0.35rem;border-radius:3px;
}

/* ---------- Brain file links ---------- */
.brain-files{display:flex;flex-wrap:wrap;gap:0.4rem;padding:0.2rem 0;}
.brain-file-link{
  font-family:'Courier New',monospace;font-size:0.82rem;color:#5a3510;
  background:rgba(255,245,210,0.6);
  border:1px solid rgba(122,78,32,0.35);border-radius:3px;
  padding:0.15rem 0.55rem;text-decoration:none;
  transition:background 0.12s,color 0.12s;
}
.brain-file-link:hover{background:rgba(180,130,70,0.35);color:#2a1000;}

/* ---------- Action button ---------- */
.btn-action{
  font-family:'Cinzel',serif;font-size:0.78rem;letter-spacing:0.08em;text-transform:uppercase;font-weight:700;
  color:#5a3510;background:rgba(180,130,70,0.18);
  border:1.5px solid #7a4e20;border-radius:4px;
  padding:0.28rem 0.9rem;cursor:pointer;
  transition:background 0.15s,color 0.15s;
  text-decoration:none !important;font-style:normal;
}
.btn-action:hover{background:rgba(180,130,70,0.38);color:#2a1000;}
.btn-action:disabled{opacity:0.55;cursor:default;}

/* ---------- Footer ---------- */
.footer{
  display:flex;justify-content:space-between;align-items:center;
  margin-top:1.6rem;padding-top:0.8rem;border-top:1px solid rgba(122,78,32,0.4);
  font-family:'IM Fell English',serif;font-style:italic;font-size:0.85rem;color:#3a2510;
}
.footer a, .footer button{
  color:#3a2510;background:none;border:none;cursor:pointer;
  font-family:inherit;font-style:italic;font-size:inherit;text-decoration:underline dotted;padding:0;
}
.footer a:hover, .footer button:hover{color:#7a2a1a;}
.refresh-note{font-family:'IM Fell English',serif;font-style:italic;font-size:0.85rem;color:#3a2510;text-align:center;margin-top:0.4rem;}

.hidden{display:none !important;}
