/* ============================================================
   Tandy Services — Control Tower / app shell
   Builds on style.css variables (dark electric-violet)
   ============================================================ */
.app { display: flex; min-height: 100vh; }
.app::after { display: none; } /* kill the public grid overlay weight under content */

/* ---------- sidebar ---------- */
.side {
  width: 248px; flex: 0 0 248px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border-right: 1px solid var(--border); padding: 20px 14px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; font-family: var(--font-display); font-size: 1rem; line-height: 1.15; }
.side-brand img { width: 36px; height: 36px; filter: drop-shadow(0 4px 12px var(--glow)); }
.side-brand b { color: var(--violet-lt); font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: .94rem; font-weight: 500; transition: background .15s, color .15s;
}
.side-nav a svg { width: 19px; height: 19px; flex: 0 0 19px; }
.side-nav a:hover { background: rgba(139,92,246,.08); color: var(--text); }
.side-nav a.on { background: linear-gradient(100deg, rgba(139,92,246,.22), rgba(139,92,246,.06)); color: #fff; border: 1px solid var(--border-2); }
.side-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 10px; }
.side-foot .who { display: flex; flex-direction: column; font-size: .9rem; color: var(--text); padding: 0 8px 10px; }
.side-foot .who small { color: var(--text-faint); font-size: .76rem; }
.dot-on { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px #22c55e; display: inline-block; margin-right: 6px; }
.logout { display: block; text-align: center; padding: 9px; border-radius: 9px; border: 1px solid var(--border-2); color: var(--text-dim); font-size: .88rem; }
.logout:hover { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.4); color: #fca5a5; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 30px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(10,7,18,.82); backdrop-filter: blur(12px); z-index: 10; }
.topbar h1 { font-family: var(--font-display); font-size: 1.35rem; }
.fleet-chip { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 500; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-dim); }
.fleet-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.fleet-chip.all .dot { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.fleet-chip.some .dot { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
.fleet-chip.none .dot { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.content { padding: 30px; max-width: 1100px; width: 100%; }

/* ---------- flash ---------- */
.flash { margin: 18px 30px -6px; padding: 13px 18px; border-radius: 10px; font-size: .95rem; }
.flash-ok { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); color: #86efac; }
.flash-err { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #fca5a5; }

/* ---------- cards / panels ---------- */
.card { background: linear-gradient(165deg, var(--surface), var(--bg-2)); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card h2, .card h3 { font-family: var(--font-display); }
.card h3 { font-size: 1.1rem; margin-bottom: 4px; }
.card .muted { color: var(--text-faint); font-size: .92rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }

/* stat tiles */
.tile { background: linear-gradient(165deg, var(--surface), var(--bg-2)); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.tile .n { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; }
.tile .l { color: var(--text-faint); font-size: .82rem; }

/* ---------- fleet grid ---------- */
.fleet { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 12px; }
.head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 11px; border: 1px solid var(--border); background: rgba(0,0,0,.2); }
.head .s { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; }
.head.up .s { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.head.down .s { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.head .nm { font-size: .92rem; font-weight: 500; color: var(--text); }
.head .meta { font-size: .76rem; color: var(--text-faint); }
.head .ms { margin-left: auto; font-size: .76rem; color: var(--text-faint); font-family: var(--font-display); }
.group-label { font-family: var(--font-display); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--violet-2); margin: 22px 0 10px; }

/* ---------- forms ---------- */
.lbl { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.inp, textarea.inp, select.inp { width: 100%; padding: 12px 14px; font: inherit; color: var(--text); background: rgba(0,0,0,.3); border: 1px solid var(--border); border-radius: 10px; }
.inp:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
textarea.inp { resize: vertical; min-height: 90px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.row > * { flex: 1; }
.btn-sm { padding: 9px 16px; font-size: .88rem; }

/* ---------- chat ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 6px 2px; }
.msg { max-width: 80%; padding: 13px 16px; border-radius: 14px; font-size: .96rem; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(100deg, var(--violet), var(--violet-2)); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg .tag { display: block; font-size: .7rem; opacity: .7; margin-top: 6px; font-family: var(--font-display); }
.chat-form { display: flex; gap: 10px; margin-top: 14px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 52px; max-height: 160px; }
/* Override the global "form .btn { width:100% }" from style.css — chat Send must stay compact */
.chat-form .btn { width: auto; flex-shrink: 0; min-width: 80px; padding-left: 22px; padding-right: 22px; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; color: var(--text-faint); font-weight: 500; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.tbl tr:hover td { background: rgba(139,92,246,.04); }
.badge2 { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.b-active { background: rgba(34,197,94,.14); color: #86efac; }
.b-susp { background: rgba(239,68,68,.14); color: #fca5a5; }
.b-owner { background: rgba(252,211,77,.14); color: #fcd34d; }
.b-admin { background: rgba(139,92,246,.16); color: var(--violet-lt); }
.b-member { background: rgba(56,189,248,.14); color: #7dd3fc; }
.act-link { color: var(--violet-2); font-size: .86rem; margin-right: 12px; }
.act-link.danger { color: #fca5a5; }

/* output box */
.out { background: rgba(0,0,0,.32); border: 1px solid var(--border); border-radius: 10px; padding: 16px; white-space: pre-wrap; word-wrap: break-word; font-size: .92rem; color: var(--text); margin-top: 14px; }
.out img { border-radius: 10px; margin-top: 8px; }
.pill-meta { display: inline-block; font-family: var(--font-display); font-size: .74rem; padding: 3px 10px; border-radius: 999px; background: rgba(139,92,246,.12); border: 1px solid var(--border-2); color: var(--violet-lt); margin-right: 6px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: linear-gradient(165deg, var(--surface), var(--bg-2)); border: 1px solid var(--border); border-radius: 18px; padding: 38px; box-shadow: var(--shadow-violet); }
.login-card .logo { width: 60px; height: 60px; margin: 0 auto 18px; display: block; filter: drop-shadow(0 8px 24px var(--glow)); }
.login-card h1 { font-family: var(--font-display); font-size: 1.5rem; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-faint); font-size: .9rem; margin-bottom: 26px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- hamburger + overlay ---------- */
.ham {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 9px;
  border: 1px solid var(--border-2); background: transparent;
  cursor: pointer; color: var(--text-dim); flex-shrink: 0;
}
.ham svg { width: 20px; height: 20px; }
.ham:hover { background: rgba(139,92,246,.1); color: var(--text); }
.side-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 99;
  backdrop-filter: blur(2px);
}
.side-overlay.open { display: block; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); transition: transform .22s cubic-bezier(.4,0,.2,1); z-index: 100; overflow-y: auto; }
  .side.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.7); }
  .ham { display: flex; }
  .topbar { padding: 14px 16px; gap: 10px; }
  .topbar h1 { font-size: 1.1rem; }
  .fleet-chip { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .card { overflow-x: auto; }
  .chat-wrap { height: calc(100svh - 220px); min-height: 280px; }
  .msg { max-width: 95%; }
}
