/* teshapp: Warframe-style UI (dark navy, gold trim, cyan accents, angular panels) */
:root {
  --bg-0: #0a0e17; --bg-1: #101726; --bg-2: #172036; --bg-3: #1d2944; --line: #26324d; --line-hi: #3a4a6e;
  --text: #d8deeb; --muted: #7f8ba6; --gold: #c8a24a; --gold-hi: #e8c874; --cyan: #4fc3d9;
  --pos: #4ade80; --neg: #f2555a; --warn: #f0a93b;
  --head: "Rajdhani", "Bahnschrift", "Segoe UI", sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --cut: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg-0); }
body { background-image: radial-gradient(1200px 600px at 70% -10%, #18233d 0%, var(--bg-0) 60%); background-attachment: fixed;
  color: var(--text); font: 14px/1.5 var(--body); }
a { color: var(--cyan); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
h1 { font-size: 22px; color: var(--gold-hi); } h2 { font-size: 15px; color: var(--gold-hi); } h3 { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .hidden { display: none !important; } .spacer { flex: 1; }
.good { color: var(--pos); } .bad { color: var(--neg); }
.boot { display: grid; place-items: center; height: 100vh; font: 600 28px var(--head); letter-spacing: .3em; color: var(--gold); text-transform: uppercase; }

button, .btn { font: 600 13px var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); padding: 6px 14px; cursor: pointer; clip-path: var(--cut); display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--gold); color: var(--gold-hi); text-decoration: none; }
button.primary, .btn.primary { background: linear-gradient(180deg, #d9b45a, #a8842f); color: #14100a; border-color: var(--gold-hi); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.1); color: #000; }
button.ghost { background: transparent; } button.danger:hover { border-color: var(--neg); color: var(--neg); }
button.on { color: var(--gold-hi); border-color: var(--gold); }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg-0); border: 1px solid var(--line); padding: 8px 10px; width: 100%; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(200, 162, 74, .25); }
textarea { resize: vertical; min-height: 44px; }

.panel { background: linear-gradient(180deg, rgba(23, 32, 54, .92), rgba(16, 23, 38, .92)); border: 1px solid var(--line); padding: 16px;
  clip-path: var(--cut); position: relative; }
.panel::before { content: ""; position: absolute; left: 0; top: 0; width: 40px; height: 2px; background: var(--gold); }
.row { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* shell */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr) 280px; min-height: 100vh; }
.shell.wide { grid-template-columns: 220px minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: rgba(10, 14, 23, .85); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px; }
.rail .logo { display: block; margin: 0 6px 18px; } .rail .logo img { height: 40px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: var(--muted); font: 600 14px var(--head); letter-spacing: .1em;
  text-transform: uppercase; border-left: 2px solid transparent; }
.nav:hover { color: var(--text); text-decoration: none; background: var(--bg-1); }
.nav.active { color: var(--gold-hi); border-left-color: var(--gold); background: linear-gradient(90deg, rgba(200, 162, 74, .12), transparent); }
.nav .ico { width: 18px; text-align: center; }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; font: 700 11px/18px var(--body); text-align: center; background: var(--gold); color: #14100a; }
.me-card { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px 8px; border-top: 1px solid var(--line); }
.main { padding: 20px 24px; min-width: 0; }
.side { padding: 20px 16px; border-left: 1px solid var(--line); }
.side .panel + .panel { margin-top: 14px; }
.topbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.topbar input { max-width: 320px; margin-left: auto; }

.av { width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--bg-3); border: 1px solid var(--line-hi); object-fit: cover; }
.av.sm { width: 24px; height: 24px; } .av.lg { width: 72px; height: 72px; border: 2px solid var(--gold); }
.who { font-weight: 600; color: var(--text); } .who:hover { color: var(--gold-hi); }
.role { font: 700 10px var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold); padding: 0 5px; margin-left: 6px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 16px; color: var(--muted); font: 600 14px var(--head); letter-spacing: .1em; text-transform: uppercase; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--gold-hi); border-bottom-color: var(--gold); }

/* posts */
.composer textarea { min-height: 80px; } .composer .title-in { font: 600 16px var(--head); letter-spacing: .04em; }
.post { margin-bottom: 12px; }
.post-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.post-title { font: 700 19px var(--head); letter-spacing: .03em; color: var(--text); margin: 2px 0 6px; display: block; }
a.post-title:hover { color: var(--gold-hi); text-decoration: none; }
.body { white-space: normal; overflow-wrap: anywhere; }
.body.clamp { max-height: 220px; overflow: hidden; mask-image: linear-gradient(180deg, #000 70%, transparent); }
.body pre { background: var(--bg-0); border: 1px solid var(--line); padding: 10px; overflow: auto; font: 12px var(--mono); }
.body code { font: 12px var(--mono); background: var(--bg-0); padding: 1px 4px; }
.body img { max-width: 100%; max-height: 420px; display: block; margin: 8px 0; border: 1px solid var(--line); }
.tag { color: var(--gold); font-weight: 600; }
.actions { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.actions button { padding: 4px 10px; font-size: 12px; }
.liked { color: var(--neg) !important; border-color: var(--neg) !important; }

.replies { margin-top: 16px; }
.reply { border-left: 2px solid var(--line); padding: 8px 0 4px 14px; margin-top: 8px; }
.reply:hover { border-left-color: var(--line-hi); }
.reply .reply { margin-left: 4px; }
.reply-head { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.reply .actions { margin-top: 4px; } .reply .actions button { padding: 2px 8px; font-size: 11px; }

/* chats */
.chat { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100vh; }
.chat.threaded { grid-template-columns: 250px minmax(0, 1fr) 340px; }
.rooms { border-right: 1px solid var(--line); overflow: auto; padding: 16px 10px; background: rgba(10, 14, 23, .5); }
.room { display: block; padding: 8px 10px; color: var(--text); border-left: 2px solid transparent; }
.room:hover { background: var(--bg-1); text-decoration: none; }
.room.active { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(200, 162, 74, .12), transparent); }
.room .nm { font: 600 14px var(--head); letter-spacing: .06em; display: flex; gap: 6px; align-items: center; }
.room .last { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room.unread .nm { color: var(--gold-hi); }
.pane { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.pane-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; background: rgba(10, 14, 23, .6); }
.pane-head h2 { margin: 0; }
.msgs { flex: 1; overflow: auto; padding: 12px 18px; }
.msg { display: flex; gap: 10px; padding: 4px 6px; margin: 0 -6px; position: relative; }
.msg:hover { background: rgba(29, 41, 68, .45); }
.msg.cont { padding-top: 0; } .msg.cont .av { visibility: hidden; height: 0; }
.msg .meta { font-size: 12px; color: var(--muted); } .msg .meta .who { font-size: 14px; margin-right: 6px; }
.msg .tools { position: absolute; right: 6px; top: -10px; display: none; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); }
.msg:hover .tools { display: flex; } .msg .tools button { clip-path: none; border: 0; padding: 3px 8px; font-size: 11px; }
.thread-chip { display: inline-flex; gap: 6px; margin-top: 4px; font: 600 12px var(--head); letter-spacing: .06em; color: var(--cyan); cursor: pointer; text-transform: uppercase; }
.send { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.send textarea { min-height: 42px; max-height: 200px; }
.thread { border-left: 1px solid var(--line); background: rgba(10, 14, 23, .6); }

/* admin + lists */
.list-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { text-align: center; } .stat b { display: block; font: 700 26px var(--head); color: var(--gold-hi); }
.stat span { font: 600 11px var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.code { font: 12px var(--mono); color: var(--cyan); word-break: break-all; }
.pill { font: 700 10px var(--head); letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; border: 1px solid var(--line-hi); color: var(--muted); }
.pill.ok { color: var(--pos); border-color: var(--pos); } .pill.no { color: var(--neg); border-color: var(--neg); } .pill.wait { color: var(--warn); border-color: var(--warn); }
.notif { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); color: var(--text); }
.notif:hover { background: var(--bg-1); text-decoration: none; } .notif.unread { border-left: 2px solid var(--gold); }
.check { display: flex; gap: 8px; align-items: center; padding: 6px 4px; cursor: pointer; } .check input { width: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); display: inline-block; }

/* gate (signed out / pending) */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .panel { width: min(440px, 100%); text-align: center; padding: 34px 30px; }
.gate .logo-big { height: 64px; margin-bottom: 10px; }
.gate p { color: var(--muted); }
.discord { background: #5865f2; border-color: #7983f5; color: #fff; font-size: 15px; padding: 10px 22px; }
.discord:hover { color: #fff; filter: brightness(1.1); border-color: #fff; }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(5, 8, 14, .75); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal .panel { width: min(480px, 100%); max-height: 90vh; overflow: auto; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; }
#toast div { background: var(--bg-3); border: 1px solid var(--gold); padding: 8px 16px; margin-top: 6px; font-weight: 600; }
#toast div.err { border-color: var(--neg); }

@media (max-width: 1100px) { .shell { grid-template-columns: 200px minmax(0, 1fr); } .side { display: none; } .chat.threaded { grid-template-columns: 220px minmax(0, 1fr); } .chat.threaded .thread { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); z-index: 20; } }
@media (max-width: 760px) {
  .shell, .shell.wide { grid-template-columns: 1fr; }
  .rail { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; z-index: 30; padding: 4px; border-right: 0; border-top: 1px solid var(--line); justify-content: space-around; }
  .rail .logo, .rail .me-card, .nav .lbl { display: none; } .nav { padding: 10px; border-left: 0; } .nav .badge { margin-left: 2px; }
  .main { padding: 14px 12px 70px; } .chat, .chat.threaded { grid-template-columns: 1fr; height: calc(100vh - 52px); }
  .chat .rooms { display: none; } .chat.list .rooms { display: block; } .chat.list .pane { display: none; } .pane { height: calc(100vh - 52px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
