/* =========================================================================
   AI Agent Panel — design tokens
   Palette: deep indigo-charcoal base, dual accent (mint = active/positive,
   amber = pending/attention) rather than a single flat accent.
   Type: Sora (display) + Inter (body) + JetBrains Mono (data/status/IDs).
   Signature: a soft breathing pulse on "live" indicators — this system runs
   unattended 24/7, so active states should read as quietly alive, not static.
   ========================================================================= */
:root{
  --bg: #0d1117;
  --bg-panel: #141a24;
  --bg-panel-2: #1b2330;
  --border: #262f3d;
  --border-soft: #1e2733;
  --text: #e6ebf3;
  --text-dim: #8891a1;
  --text-faint: #5b6473;

  --accent: #5eead4;        /* mint — active, positive, primary actions */
  --accent-dim: #1f4a44;
  --accent-soft: #16302b;
  --accent-2: #f5a623;      /* amber — pending, attention */
  --accent-2-soft: #3a2d14;
  --danger: #f87171;
  --danger-soft: #3a1f1e;
  --info: #7db2ec;
  --info-soft: #16233a;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --font-display: "Sora", "Inter", -apple-system, sans-serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.24);
  --shadow-md: 0 4px 16px rgba(0,0,0,.28);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.36);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(94,234,212,.05), transparent 60%),
    var(--bg);
  color:var(--text);
  font-family:var(--font-ui);
  font-size:14px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;}
::selection{ background:var(--accent-dim); color:var(--text); }

@keyframes pulse-glow{
  0%, 100% { box-shadow: 0 0 0 0 rgba(94,234,212,.55); }
  50%      { box-shadow: 0 0 0 4px rgba(94,234,212,0); }
}
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.app-shell{
  display:grid;
  grid-template-columns: 232px 1fr;
  min-height:100vh;
}

.sidebar{
  background:var(--bg-panel);
  border-right:1px solid var(--border-soft);
  padding:22px 14px;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.sidebar .brand{
  font-family:var(--font-display);
  font-weight:700;
  font-size:14px;
  letter-spacing:.02em;
  color:var(--text);
  margin-bottom:22px;
  padding:0 10px;
  display:flex;
  align-items:center;
  gap:8px;
}
.sidebar .brand::before{
  content:"";
  width:8px; height:8px; border-radius:50%;
  background:var(--accent);
  animation:pulse-glow 2.4s ease-in-out infinite;
  flex-shrink:0;
}
.sidebar a{
  display:flex;
  align-items:center;
  gap:11px;
  padding:9px 12px;
  border-radius:var(--radius-sm);
  text-decoration:none;
  color:var(--text-dim);
  font-size:13.5px;
  font-weight:500;
  border-left:2px solid transparent;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.sidebar a:hover{ background:var(--bg-panel-2); color:var(--text); }
.sidebar a.active{
  background:var(--bg-panel-2);
  color:var(--accent);
  border-left-color:var(--accent);
}
.sidebar .spacer{flex:1;}
.sidebar .user-box{
  border-top:1px solid var(--border-soft);
  padding-top:14px;
  margin-top:10px;
  font-size:12.5px;
  color:var(--text-dim);
  padding-left:10px;
}
.sidebar .user-box .role-badge{
  display:inline-block;
  background:var(--accent-soft);
  color:var(--accent);
  padding:2px 8px;
  border-radius:20px;
  font-size:10px;
  font-weight:600;
  letter-spacing:.03em;
  text-transform:uppercase;
  margin-left:6px;
}
.sidebar .logout{
  color:var(--danger);
  font-size:12.5px;
  text-decoration:none;
  opacity:.85;
}
.sidebar .logout:hover{ opacity:1; }

.main{padding:30px 36px; max-width:1220px;}
.page-title{
  font-family:var(--font-display);
  font-size:22px;
  font-weight:700;
  letter-spacing:-.01em;
  margin:0 0 5px;
}
.page-sub{color:var(--text-dim); margin:0 0 26px; font-size:13.5px;}

.panel{
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px 22px;
  box-shadow:var(--shadow-sm);
}

.btn{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--accent);
  color:#062622;
  border:none;
  padding:9px 17px;
  border-radius:var(--radius-sm);
  font-weight:600;
  font-size:13.5px;
  cursor:pointer;
  transition:filter .15s ease, transform .1s ease;
}
.btn:hover{filter:brightness(1.08);}
.btn:active{transform:translateY(1px);}
.btn.secondary{
  background:transparent;
  color:var(--text);
  border:1px solid var(--border);
}
.btn.secondary:hover{ background:var(--bg-panel-2); }
.btn.danger{ background:var(--danger); color:#2a0d0c; }
.btn.small{ padding:6px 11px; font-size:12px; }

input, textarea, select{
  width:100%;
  background:var(--bg-panel-2);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:var(--radius-sm);
  padding:9px 12px;
  font-family:var(--font-ui);
  font-size:13.5px;
  transition:border-color .15s ease;
}
input:focus, textarea:focus, select:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
label{display:block; font-size:12.5px; color:var(--text-dim); margin:0 0 6px; font-weight:500;}
.field{margin-bottom:14px;}

.badge{
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600;
  font-family:var(--font-mono);
}
.badge.active{ background:var(--accent-soft); color:var(--accent); }
.badge.active::before{ content:""; width:5px; height:5px; border-radius:50%; background:var(--accent); animation:pulse-glow 2.4s ease-in-out infinite; }
.badge.paused{ background:var(--accent-2-soft); color:var(--accent-2); }
.badge.cancelled{ background:var(--danger-soft); color:var(--danger); }
.badge.done{ background:var(--info-soft); color:var(--info); }

.grid-cards{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap:14px;
}
.card{
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  cursor:pointer;
  transition:border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover{ border-color:var(--accent-dim); transform:translateY(-2px); box-shadow:var(--shadow-md); }
.card .emoji{ font-size:27px; }
.card h3{ font-family:var(--font-display); margin:10px 0 3px; font-size:14.5px; font-weight:600; }
.card p{ margin:0; color:var(--text-dim); font-size:12.5px; }

.error-box{
  background:var(--danger-soft); color:#ffb3ae; border:1px solid #5c2e2b;
  padding:11px 15px; border-radius:var(--radius-sm); font-size:13px; margin-bottom:16px;
}
.info-box{
  background:var(--accent-soft); color:var(--accent); border:1px solid var(--accent-dim);
  padding:11px 15px; border-radius:var(--radius-sm); font-size:13px; margin-bottom:16px;
}

/* Chat */
.chat-layout{ display:grid; grid-template-columns: 260px 1fr; gap:16px; height:calc(100vh - 140px); min-height:0; }
.agent-list{ overflow-y:auto; padding-right:4px; min-height:0; }
.agent-item{
  display:flex; align-items:center; gap:10px;
  padding:10px 11px; border-radius:var(--radius-sm); cursor:pointer; margin-bottom:3px;
  border-left:2px solid transparent;
  transition:background .15s ease;
}
.agent-item:hover{ background:var(--bg-panel-2); }
.agent-item.selected{ background:var(--bg-panel-2); border-left-color:var(--accent); }
.agent-item .emoji{ font-size:19px; }
.agent-item .name{ font-size:13.5px; font-weight:500; }
.agent-item .status-dot{ width:7px; height:7px; border-radius:50%; background:var(--accent); margin-left:auto; animation:pulse-glow 2.4s ease-in-out infinite; }
.agent-item .status-dot.paused{ background:var(--text-faint); animation:none; }

.chat-panel{ display:flex; flex-direction:column; min-height:0; overflow:hidden; }
.chat-messages{ flex:1; min-height:0; overflow-y:auto; padding:6px 10px 16px 6px; display:flex; flex-direction:column; gap:10px; scroll-behavior:smooth; }
.msg{ max-width:72%; padding:10px 14px; border-radius:var(--radius); font-size:13.5px; white-space:pre-wrap; word-break:break-word; box-shadow:var(--shadow-sm); }
.msg.owner{ align-self:flex-end; background:var(--accent-dim); color:#d9fff2; border-bottom-right-radius:4px; }
.msg.agent{ align-self:flex-start; background:var(--bg-panel-2); border:1px solid var(--border); border-bottom-left-radius:4px; }
.chat-input-row{ display:flex; gap:8px; margin-top:10px; flex-shrink:0; }
.chat-input-row textarea{ resize:none; height:46px; }
.chat-empty{ color:var(--text-dim); text-align:center; margin-top:60px; font-size:13px; }

table{ width:100%; border-collapse:collapse; font-size:13.5px; }
th{ text-align:left; color:var(--text-faint); font-weight:600; font-size:11px; letter-spacing:.03em; text-transform:uppercase; padding:9px 12px; border-bottom:1px solid var(--border); }
td{ padding:11px 12px; border-bottom:1px solid var(--border-soft); vertical-align:top; }
tr:last-child td{ border-bottom:none; }
tr:hover td{ background:var(--bg-panel-2); }

.login-shell{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(700px 500px at 20% 15%, rgba(94,234,212,.07), transparent 60%),
    radial-gradient(600px 500px at 85% 85%, rgba(245,166,35,.05), transparent 60%),
    var(--bg);
}
.login-card{ width:350px; background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius-lg); padding:32px 28px; box-shadow:var(--shadow-lg); }
.login-card .brand{
  font-family:var(--font-display); font-weight:700; color:var(--text); font-size:15px;
  margin-bottom:22px; display:flex; align-items:center; gap:8px;
}
.login-card .brand::before{ content:""; width:8px; height:8px; border-radius:50%; background:var(--accent); animation:pulse-glow 2.4s ease-in-out infinite; }
