/* =========================================================
   TORONY — Design tokens
   Ops-console identity: graphite/navy base, signal-amber accent,
   status-blue for active processes, quiet green for completed/AI.
   ========================================================= */
:root{
  --bg:            #12151C;
  --bg-raised:     #171B24;
  --panel:         #1C212C;
  --panel-hover:   #222836;
  --line:          #2A3140;
  --line-soft:     #232937;

  --text:          #E7E9EE;
  --text-dim:      #9BA3B4;
  --text-faint:    #5D6577;

  --amber:         #E8A33D;
  --amber-dim:     #E8A33D33;
  --blue:          #5B8DEF;
  --blue-dim:      #5B8DEF33;
  --green:         #4CAF7D;
  --green-dim:     #4CAF7D33;
  --red:           #E2574C;
  --red-dim:       #E2574C33;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 10px;
  --radius-sm: 6px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
}
button, input{ font-family:inherit; }
::selection{ background:var(--amber-dim); color:var(--text); }

/* =========== LAYOUT =========== */
.app{
  display:grid;
  grid-template-columns:232px 1fr;
  min-height:100vh;
}

/* =========== SIDEBAR =========== */
.sidebar{
  background:var(--bg-raised);
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  padding:22px 14px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:4px 10px 26px 10px;
}
.brand-mark{
  width:10px; height:10px;
  border-radius:2px;
  background:var(--amber);
  box-shadow:0 0 10px var(--amber);
  flex-shrink:0;
}
.brand-name{
  font-family:var(--font-display);
  font-weight:700;
  letter-spacing:0.14em;
  font-size:15px;
}

.nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.nav-group-label{
  font-family:var(--font-mono);
  font-size:10.5px;
  letter-spacing:0.1em;
  text-transform:uppercase;
  color:var(--text-faint);
  margin:16px 10px 6px 10px;
}
.nav-item{
  display:flex;
  align-items:center;
  gap:10px;
  background:transparent;
  border:none;
  color:var(--text-dim);
  text-align:left;
  padding:9px 10px;
  border-radius:var(--radius-sm);
  font-size:13.5px;
  font-weight:500;
  cursor:pointer;
  transition:background .15s, color .15s;
}
.nav-item:hover{ background:var(--panel); color:var(--text); }
.nav-item.is-active{
  background:var(--panel);
  color:var(--text);
  box-shadow:inset 2px 0 0 var(--amber);
}
.nav-icon{
  width:16px;
  text-align:center;
  font-size:13px;
  color:var(--text-faint);
}
.nav-item.is-active .nav-icon{ color:var(--amber); }

.sidebar-footer{ padding-top:14px; border-top:1px solid var(--line-soft); }
.n8n-status{
  display:flex;
  align-items:center;
  gap:8px;
  font-family:var(--font-mono);
  font-size:11px;
  color:var(--text-faint);
  padding:6px 10px;
}
.pulse-dot{
  width:7px; height:7px;
  border-radius:50%;
  background:var(--text-faint);
  flex-shrink:0;
}
.pulse-dot.ok{ background:var(--green); box-shadow:0 0 6px var(--green); animation:pulse 2.4s infinite; }
.pulse-dot.err{ background:var(--red); box-shadow:0 0 6px var(--red); }
@keyframes pulse{
  0%,100%{ opacity:1; }
  50%{ opacity:.35; }
}

/* =========== MAIN / TOPBAR =========== */
.main{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:22px 32px 18px 32px;
}
.topbar-left h1{
  font-family:var(--font-display);
  font-size:22px;
  font-weight:600;
  margin:0;
  letter-spacing:-0.01em;
}
.topbar-sub{
  font-size:12.5px;
  color:var(--text-faint);
}
.topbar-right{ display:flex; align-items:center; gap:14px; }
.weather-chip{
  display:flex; align-items:center; gap:6px;
  font-family:var(--font-mono);
  font-size:12.5px;
  color:var(--text-dim);
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:20px;
  padding:6px 12px;
}
.clock{
  font-family:var(--font-mono);
  font-size:12.5px;
  color:var(--text-dim);
  min-width:64px;
}
.refresh-btn{
  background:var(--panel);
  border:1px solid var(--line);
  color:var(--text-dim);
  width:32px; height:32px;
  border-radius:50%;
  cursor:pointer;
  font-size:15px;
  display:flex; align-items:center; justify-content:center;
  transition:transform .4s ease, color .15s;
}
.refresh-btn:hover{ color:var(--amber); border-color:var(--amber); }
.refresh-btn.spinning{ animation:spin .6s linear; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.signal-line{
  height:1px;
  background:var(--line);
  margin:0 32px 22px 32px;
  position:relative;
  overflow:hidden;
}
.signal-sweep{
  position:absolute; top:0; left:-20%;
  width:20%; height:100%;
  background:linear-gradient(90deg, transparent, var(--amber), transparent);
  animation:sweep 5s ease-in-out infinite;
}
@keyframes sweep{
  0%{ left:-20%; }
  50%{ left:100%; }
  100%{ left:100%; }
}
@media (prefers-reduced-motion: reduce){
  .signal-sweep{ animation:none; }
  .pulse-dot.ok{ animation:none; }
}

.content{ padding:0 32px 40px 32px; flex:1; min-width:0; }

/* =========== OVERVIEW BOARD =========== */
.board{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:18px;
  align-items:start;
}
.board-col-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:10px;
  padding:0 2px;
}
.board-col-head h2{
  font-family:var(--font-display);
  font-size:14px;
  font-weight:600;
  margin:0;
  letter-spacing:0.01em;
}
[data-col="decide"] .board-col-head h2{ color:var(--amber); }
[data-col="running"] .board-col-head h2{ color:var(--blue); }
[data-col="done"] .board-col-head h2{ color:var(--green); }
.count{
  font-family:var(--font-mono);
  font-size:11px;
  color:var(--text-faint);
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:20px;
  padding:2px 8px;
}
.board-col-body{ display:flex; flex-direction:column; gap:10px; }

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:13px 14px;
  border-left:2px solid var(--line);
  transition:border-color .15s, background .15s;
}
.card:hover{ background:var(--panel-hover); }
[data-col="decide"] .card{ border-left-color:var(--amber); }
[data-col="running"] .card{ border-left-color:var(--blue); }
[data-col="done"] .card{ border-left-color:var(--green); }

.card-top{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:5px; }
.card-source{
  font-family:var(--font-mono);
  font-size:10px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--text-faint);
}
.card-time{ font-family:var(--font-mono); font-size:10.5px; color:var(--text-faint); }
.card-title{ font-size:13.5px; font-weight:500; color:var(--text); line-height:1.4; }
.card-desc{ font-size:12.5px; color:var(--text-dim); margin-top:3px; line-height:1.5; }

.card-actions{ display:flex; gap:8px; margin-top:10px; }
.card-actions button{
  font-size:11.5px;
  font-weight:500;
  border-radius:6px;
  padding:5px 10px;
  cursor:pointer;
  border:1px solid var(--line);
  background:transparent;
  color:var(--text-dim);
}
.card-actions button.primary{
  background:var(--amber-dim);
  border-color:var(--amber);
  color:var(--amber);
}
.card-actions button:hover{ filter:brightness(1.15); }

.status-badge{
  font-family:var(--font-mono);
  font-size:10px;
  letter-spacing:0.04em;
  padding:2px 7px;
  border-radius:10px;
}
.status-badge.running{ background:var(--blue-dim); color:var(--blue); }
.status-badge.success{ background:var(--green-dim); color:var(--green); }
.status-badge.error{ background:var(--red-dim); color:var(--red); }

.progress-track{
  height:3px;
  background:var(--line);
  border-radius:2px;
  margin-top:10px;
  overflow:hidden;
}
.progress-fill{ height:100%; background:var(--blue); border-radius:2px; }

.empty-state{
  grid-column:1/-1;
  border:1px dashed var(--line);
  border-radius:var(--radius);
  padding:26px;
  text-align:center;
  color:var(--text-faint);
  font-size:12.5px;
}

/* =========== LIST VIEWS =========== */
.list-toolbar{ display:flex; justify-content:flex-end; margin-bottom:12px; }
.demo-badge{
  font-family:var(--font-mono);
  font-size:11px;
  color:var(--amber);
  background:var(--amber-dim);
  border:1px solid var(--amber);
  border-radius:20px;
  padding:4px 10px;
}
.list-body{ display:flex; flex-direction:column; gap:8px; }
.list-row{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:12px 14px;
  display:flex;
  align-items:center;
  gap:14px;
}
.list-row-main{ flex:1; min-width:0; }
.list-row-title{ font-size:13.5px; font-weight:500; }
.list-row-sub{ font-size:12px; color:var(--text-dim); margin-top:2px; }
.list-row-meta{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); white-space:nowrap; }

/* =========== WEATHER =========== */
.weather-hero{
  padding:30px 0 26px 0;
  border-bottom:1px solid var(--line);
  margin-bottom:20px;
}
.weather-hero-temp{
  font-family:var(--font-display);
  font-size:56px;
  font-weight:600;
  color:var(--amber);
  line-height:1;
}
.weather-hero-desc{ font-size:14px; color:var(--text-dim); margin-top:6px; }
.weather-hero-loc{ font-family:var(--font-mono); font-size:11.5px; color:var(--text-faint); margin-top:4px; }
.weather-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(120px,1fr));
  gap:10px;
}
.weather-day{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:12px;
  text-align:center;
}
.weather-day-label{ font-family:var(--font-mono); font-size:10.5px; color:var(--text-faint); text-transform:uppercase; }
.weather-day-temp{ font-size:15px; font-weight:600; margin-top:6px; }

/* =========== SETTINGS =========== */
.settings-view{ max-width:760px; }
.settings-intro{
  font-size:13px;
  color:var(--text-dim);
  line-height:1.6;
  margin-bottom:24px;
  max-width:640px;
}
.settings-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px 16px;
}
.settings-field{ display:flex; flex-direction:column; gap:6px; }
.settings-field span{
  font-family:var(--font-mono);
  font-size:11px;
  color:var(--text-faint);
  letter-spacing:0.02em;
}
.settings-field input{
  background:var(--bg-raised);
  border:1px solid var(--line);
  color:var(--text);
  border-radius:var(--radius-sm);
  padding:9px 11px;
  font-size:13px;
  outline:none;
  transition:border-color .15s;
}
.settings-field input:focus{ border-color:var(--amber); }
.settings-divider{ height:1px; background:var(--line-soft); margin:24px 0; }
.settings-actions{ display:flex; align-items:center; gap:12px; margin-top:24px; }
.btn-primary{
  background:var(--amber);
  color:#1A1206;
  border:none;
  font-weight:600;
  font-size:13px;
  padding:10px 18px;
  border-radius:var(--radius-sm);
  cursor:pointer;
}
.btn-primary:hover{ filter:brightness(1.08); }
.btn-ghost{
  background:transparent;
  border:1px solid var(--line);
  color:var(--text-dim);
  font-size:13px;
  padding:10px 16px;
  border-radius:var(--radius-sm);
  cursor:pointer;
}
.btn-ghost:hover{ border-color:var(--text-dim); color:var(--text); }
.save-confirm{ font-family:var(--font-mono); font-size:12px; color:var(--green); }

/* =========== RESPONSIVE =========== */
@media (max-width:980px){
  .board{ grid-template-columns:1fr; }
  .settings-grid{ grid-template-columns:1fr; }
}
@media (max-width:760px){
  .app{ grid-template-columns:1fr; }
  .sidebar{
    flex-direction:row;
    align-items:center;
    overflow-x:auto;
    padding:12px;
    border-right:none;
    border-bottom:1px solid var(--line);
  }
  .brand{ padding:0 12px 0 0; }
  .nav{ flex-direction:row; }
  .nav-group-label{ display:none; }
  .sidebar-footer{ display:none; }
  .topbar{ padding:18px 18px 14px 18px; flex-wrap:wrap; gap:10px; }
  .content{ padding:0 18px 30px 18px; }
  .signal-line{ margin:0 18px 18px 18px; }
}

/* focus visibility */
button:focus-visible, input:focus-visible{
  outline:2px solid var(--amber);
  outline-offset:2px;
}
