/* Miners Universe Workspace — palette lifted from the logo:
   emerald hoodie, ice-blue hoodie, gold crystal + gold lettering, stone/obsidian. */
:root {
  --obsidian: #0b0f16;
  --stone-900: #101725;
  --stone-850: #141c2c;
  --stone-800: #182133;
  --stone-700: #1f2b40;
  --stone-600: #2a3853;
  --edge: #26334b;
  --edge-1: #26334b;
  --edge-2: #33425f;

  --green: #57c72b;
  --green-lo: #3f9a1d;
  --green-hi: #8ede4a;
  --blue: #2f8fe0;
  --blue-lo: #1c6ab0;
  --blue-hi: #7cc9ff;
  --gold: #f5a623;
  --gold-hi: #ffd24a;
  --gold-lo: #b9761a;

  --text: #e8eefb;
  --muted: #8ea0bd;
  --faint: #62738f;
  --danger: #ef5350;
  --danger-hi: #ff8f8a;

  --r: 12px;
  --shadow: 0 18px 44px #00000066;
  --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1100px 620px at 12% -10%, #17361c33, transparent 70%),
    radial-gradient(1000px 600px at 88% -6%, #12395f44, transparent 70%),
    var(--obsidian);
  color: var(--text);
  font: 14.5px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-hi); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--stone-600); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }

/* ---------------- Brand ---------------- */
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img, .brand .fallback { width: 42px; height: 42px; flex: none; object-fit: contain; }
.brand .fallback {
  border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--green), var(--blue));
  box-shadow: inset 0 0 0 2px #ffffff26, 0 6px 0 #0006;
}
.brand-text { line-height: 1; min-width: 0; }
.brand-text b {
  display: block; font-size: 17px; font-weight: 900; letter-spacing: .6px;
  background: linear-gradient(180deg, var(--gold-hi) 30%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 1px 0 #00000040;
}
.brand-text span { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: 2.1px; color: var(--blue-hi); margin-top: 4px; white-space: nowrap; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--edge-2);
  background: var(--stone-700); color: var(--text); font-weight: 600; font-size: 13.5px;
  transition: background .14s, border-color .14s, transform .06s;
}
.btn:hover { background: var(--stone-600); border-color: #4a5d80; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--green-hi), var(--green)); color: #0d2206;
  border-color: var(--green-lo); box-shadow: 0 3px 0 var(--green-lo);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:active { box-shadow: 0 1px 0 var(--green-lo); }
.btn.gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #3a2500; border-color: var(--gold-lo); box-shadow: 0 3px 0 var(--gold-lo); }
.btn.blue { background: linear-gradient(180deg, var(--blue-hi), var(--blue)); color: #052238; border-color: var(--blue-lo); box-shadow: 0 3px 0 var(--blue-lo); }
.btn.danger { border-color: #6d2c2c; color: var(--danger-hi); background: #2a1717; }
.btn.wide { width: 100%; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--faint);
  border-radius: 8px; padding: 6px; display: inline-grid; place-items: center;
}
.icon-btn:hover { color: var(--text); background: #ffffff0f; border-color: var(--edge-1); }

/* ---------------- Fields ---------------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--obsidian);
  border: 1px solid var(--edge-2); transition: border-color .14s, box-shadow .14s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #2f8fe033; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.6; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.check input { width: 17px; height: 17px; accent-color: var(--green); }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(430px, 100%); background: linear-gradient(180deg, var(--stone-850), var(--stone-900));
  border: 1px solid var(--edge-2); border-radius: 20px; padding: 34px; text-align: center; box-shadow: var(--shadow);
}
.login-card .brand { justify-content: center; }
.login-card .brand img, .login-card .brand .fallback { width: 108px; height: 108px; }
.login-card .brand { flex-direction: column; gap: 14px; margin-bottom: 22px; }
.login-card h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: .3px; }
.login-card > p { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.btn.discord { background: #5865f2; border-color: #4650c8; box-shadow: 0 3px 0 #3a43ab; color: #fff; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 11px; letter-spacing: 2px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--edge-2); }
.hint { font-size: 12px; color: var(--faint); margin-top: 20px; line-height: 1.6; }

/* ---------------- Shell ---------------- */
.shell { display: grid; grid-template-columns: 244px 1fr; height: 100vh; }
.side {
  background: linear-gradient(180deg, var(--stone-900), var(--obsidian));
  border-right: 1px solid var(--edge-1); display: flex; flex-direction: column; padding: 18px 12px; overflow: auto;
}
.side .brand { padding: 4px 8px 20px; }
.nav-group { font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px; color: var(--faint); padding: 16px 12px 7px; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; margin-bottom: 2px;
  border-radius: 10px; background: none; border: none; color: var(--muted); font-weight: 600; font-size: 13.5px; text-align: left;
}
.nav-btn:hover { background: #ffffff0d; color: var(--text); }
.nav-btn.active { background: linear-gradient(90deg, #57c72b26, #2f8fe01f); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.nav-btn.active .icon { color: var(--green-hi); }
.nav-btn .count { margin-left: auto; background: var(--gold); color: #3a2500; border-radius: 99px; padding: 1px 8px; font-size: 11px; font-weight: 900; }
.nav-btn .count.blue { background: var(--blue-hi); color: #052238; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--edge-1); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: var(--stone-600); flex: none; }
.avatar.sm { width: 26px; height: 26px; border-radius: 7px; }
.who { min-width: 0; flex: 1; }
.who b { display: block; font-size: 13px; }
.who small { display: block; font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Topbar + main ---------------- */
.content { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 13px 24px;
  border-bottom: 1px solid var(--edge-1); background: #0d131dcc; backdrop-filter: blur(8px);
}
.topbar h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: .2px; }
.topbar .spacer { flex: 1; }
.searchbox {
  display: flex; align-items: center; gap: 9px; background: var(--obsidian); border: 1px solid var(--edge-2);
  border-radius: 10px; padding: 7px 12px; width: min(340px, 34vw); color: var(--faint);
}
.searchbox input { background: none; border: none; outline: none; flex: 1; min-width: 0; }
.kbd {
  font: 700 10.5px var(--mono); border: 1px solid var(--edge-2); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; color: var(--muted); background: var(--stone-800);
}
.main { flex: 1; overflow: auto; padding: 22px 24px 60px; }

/* ---------------- Cards & metrics ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 13px; margin-bottom: 22px; }
.card { background: linear-gradient(180deg, var(--stone-850), var(--stone-900)); border: 1px solid var(--edge-1); border-radius: var(--r); padding: 15px 16px; }
.metric .k { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted); }
.metric .v { font-size: 30px; font-weight: 900; line-height: 1.25; margin-top: 6px; }
.metric.green .v, .metric.green .icon { color: var(--green-hi); }
.metric.blue .v, .metric.blue .icon { color: var(--blue-hi); }
.metric.gold .v, .metric.gold .icon { color: var(--gold-hi); }
.metric.red .v, .metric.red .icon { color: var(--danger-hi); }
.metric .sub { font-size: 12px; color: var(--faint); }
.panel { background: linear-gradient(180deg, var(--stone-850), var(--stone-900)); border: 1px solid var(--edge-1); border-radius: var(--r); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--edge-1); }
.panel-head h3 { margin: 0; font-size: 13.5px; font-weight: 800; letter-spacing: .4px; }
.panel-head .spacer { flex: 1; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); margin: 26px 0 11px; }

/* Sparkline bar chart */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 108px; padding: 16px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .bar i { display: block; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .bar .c { background: linear-gradient(180deg, var(--blue-hi), var(--blue)); }
.chart .bar .s { background: linear-gradient(180deg, var(--green-hi), var(--green)); }
.legend { display: flex; gap: 16px; padding: 0 16px 14px; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* ---------------- Lists / rows ---------------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--edge-1); }
.row:last-child { border-bottom: none; }
.row.click { cursor: pointer; }
.row.click:hover { background: #ffffff08; }
.row.sel { background: #2f8fe01f; box-shadow: inset 3px 0 0 var(--blue); }
.grow { flex: 1; min-width: 0; }
.title-line { display: flex; align-items: center; gap: 8px; }
.title-line b { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub, .who .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { color: var(--muted); font-size: 12.5px; }
p.sub { max-width: 74ch; }
.ref { font: 700 11px var(--mono); color: var(--faint); }
time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.empty { padding: 46px 20px; text-align: center; color: var(--faint); }
.empty b { display: block; color: var(--muted); margin-bottom: 5px; font-size: 14px; }
.done { text-decoration: line-through; color: var(--faint); }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; padding: 3px 9px; border-radius: 99px;
  background: var(--stone-700); color: var(--muted); border: 1px solid var(--edge-2); white-space: nowrap;
}
.badge.open { background: #2f8fe024; color: var(--blue-hi); border-color: #2f8fe055; }
.badge.pending { background: #f5a62322; color: var(--gold-hi); border-color: #f5a62355; }
.badge.solved { background: #57c72b22; color: var(--green-hi); border-color: #57c72b55; }
.badge.closed { background: #ffffff10; color: var(--faint); }
.badge.urgent, .badge.breach { background: #ef535024; color: var(--danger-hi); border-color: #ef535055; }
.badge.high { background: #f5a62322; color: var(--gold-hi); border-color: #f5a62355; }
.badge.low { background: #ffffff0d; color: var(--faint); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }

/* ---------------- Filter bar ---------------- */
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip {
  padding: 6px 13px; border-radius: 99px; border: 1px solid var(--edge-2); background: var(--stone-800);
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.chip:hover { color: var(--text); border-color: #4a5d80; }
.chip.on { background: linear-gradient(180deg, var(--blue-hi), var(--blue)); color: #052238; border-color: var(--blue-lo); }

/* ---------------- Ticket workspace ---------------- */
.desk { display: grid; grid-template-columns: 370px 1fr; gap: 16px; align-items: start; }
.queue { max-height: calc(100vh - 190px); overflow: auto; }
.thread { display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.thread-head { padding: 16px; border-bottom: 1px solid var(--edge-1); }
.thread-head h3 { margin: 0 0 8px; font-size: 17px; }
.thread-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.thread-body { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.msg { border: 1px solid var(--edge-1); border-radius: 11px; padding: 12px 14px; background: var(--stone-850); }
.msg.out { background: #12243a; border-color: #24456b; margin-left: 26px; }
.msg.note { background: #2a220f; border-color: #5d4a17; margin-left: 26px; }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.msg-head b { color: var(--text); font-size: 13px; }
.msg-body { white-space: pre-wrap; line-height: 1.65; font-size: 14px; word-break: break-word; }
.composer { border-top: 1px solid var(--edge-1); padding: 12px 14px; background: var(--stone-900); }
.composer .tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.composer .tabs .chip.on[data-mode="note"] { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #3a2500; border-color: var(--gold-lo); }
.composer textarea { min-height: 92px; }
.composer .actions { display: flex; gap: 9px; align-items: center; margin-top: 9px; }
.props { display: grid; gap: 10px; }

/* ---------------- Modal + palette ---------------- */
.overlay { position: fixed; inset: 0; background: #05080dcc; backdrop-filter: blur(3px); display: grid; z-index: 40; padding: 24px; }
.overlay.center { place-items: center; }
.overlay.top { align-items: start; justify-items: center; padding-top: 12vh; }
.box { width: min(660px, 100%); background: linear-gradient(180deg, var(--stone-850), var(--stone-900)); border: 1px solid var(--edge-2); border-radius: 16px; box-shadow: var(--shadow); max-height: 84vh; display: flex; flex-direction: column; }
.box > h3 { margin: 0; padding: 17px 20px; border-bottom: 1px solid var(--edge-1); font-size: 15px; letter-spacing: .3px; }
.box .body { padding: 20px; overflow: auto; }
.box .foot { padding: 14px 20px; border-top: 1px solid var(--edge-1); display: flex; gap: 10px; justify-content: flex-end; }
.palette input { width: 100%; background: none; border: none; outline: none; padding: 16px 20px; font-size: 16px; border-bottom: 1px solid var(--edge-1); }
.palette .res { overflow: auto; max-height: 52vh; }
.palette .res .row { cursor: pointer; }
.palette .res .row.cursor { background: #2f8fe022; box-shadow: inset 3px 0 0 var(--blue); }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 60; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 11px; font-size: 13.5px;
  background: var(--stone-800); border: 1px solid var(--edge-2); box-shadow: var(--shadow); animation: rise .18s ease-out;
  max-width: 380px;
}
.toast.ok { border-color: #3f9a1d; color: var(--green-hi); }
.toast.err { border-color: #8d3733; color: var(--danger-hi); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.grid-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.note-card { cursor: pointer; }
.note-card:hover { border-color: var(--edge-2); }
.note-card h4 { margin: 0 0 7px; font-size: 14.5px; }
.note-card p { margin: 0; color: var(--muted); font-size: 12.5px; white-space: pre-wrap; max-height: 88px; overflow: hidden; }
.chk { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.err-banner { background: #ef53501f; border: 1px solid #ef535055; color: var(--danger-hi); padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) { .desk { grid-template-columns: 1fr; } .queue { max-height: 340px; } }
@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .brand { width: 100%; }
  .nav-group { display: none; }
  .nav-btn { width: auto; }
  .side-foot { width: 100%; }
  .searchbox { width: 100%; }
  .topbar { flex-wrap: wrap; }
}
