:root { --ink: #11131a; --slate: #596173; --line: #e4e7ee; --canvas: #f7f8fb; --violet: #7767d8; --green: #2fb36b; --red: #d0452f; --amber: #e0963a; }
* { box-sizing: border-box; margin: 0; }
body { min-height: 100vh; color: var(--ink); font: 13.5px/1.55 Inter, system-ui, sans-serif; background: radial-gradient(circle at 18% -10%, #edf8ff 0, transparent 26%), radial-gradient(circle at 88% 0, #f2edff 0, transparent 24%), var(--canvas); }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.topbar { height: 64px; padding: 0 32px; display: flex; align-items: center; gap: 24px; background: rgba(255,255,255,.78); border-bottom: 1px solid rgba(228,231,238,.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.topbar nav { display: flex; gap: 6px; flex: 1; font-size: 12.5px; color: var(--slate); }
.topbar nav a { padding: 7px 10px; border-radius: 9px; }
.topbar nav a:hover, .topbar nav a.active { background: #eef0f7; color: var(--ink); }
.actions { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--slate); }
.button { min-height: 36px; padding: 0 14px; border: 1px solid #d7dbe4; border-radius: 10px; background: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 13px Inter, sans-serif; color: var(--ink); cursor: pointer; }
.button:hover { border-color: #b9bfcc; }
.button.primary { color: #fff; background: #111; border-color: #111; }
.button.primary:hover { background: #2a2a2a; }
.button.danger { color: var(--red); }
.button.full { width: 100%; }
.button:disabled { opacity: .55; cursor: default; }
.muted { color: var(--slate); }
.small { font-size: 12px; }
.error { color: var(--red); margin-top: 10px; font-weight: 500; }
main { padding: 28px 24px 60px; }

.center-card { max-width: 460px; margin: 48px auto 0; padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 18px 50px rgba(32,38,58,.06); text-align: center; display: grid; gap: 14px; }
.center-card.wide { max-width: 620px; text-align: left; }
.center-card h1 { font-size: 24px; letter-spacing: -.5px; }
.hero-logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto; }
.lock { font-size: 32px; }
.field { display: grid; gap: 6px; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=password], input:not([type]), textarea { width: 100%; border: 1px solid #d6dae3; border-radius: 10px; padding: 10px 12px; font: 14px Inter, sans-serif; outline: none; background: #fff; }
input:focus, textarea:focus { border-color: #8c93a5; box-shadow: 0 0 0 3px rgba(119,103,216,.12); }
#unlockForm { display: grid; gap: 10px; text-align: left; }
.check { display: flex; gap: 8px; align-items: center; color: var(--slate); font-size: 12.5px; }
.code { font: 700 30px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 3px; text-align: center; padding: 18px; border: 1px dashed #c9cde0; border-radius: 14px; background: #fafbff; user-select: all; }
.steps { padding-left: 20px; display: grid; gap: 6px; margin-top: 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid #e3e5ee; border-top-color: var(--violet); border-radius: 50%; margin: 20px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dash { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.side { position: sticky; top: 84px; border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 110px); }
.device { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-bottom: 1px solid var(--line); }
.grow { flex: 1; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c7cad3; margin-top: 5px; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(47,179,107,.15); }
.dot.busy { background: var(--violet); box-shadow: 0 0 0 4px rgba(119,103,216,.18); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(119,103,216,.05); } }
.icon-btn { border: 1px solid #f0c9c1; color: var(--red); background: #fff6f4; border-radius: 8px; padding: 4px 8px; font: 600 11.5px Inter, sans-serif; cursor: pointer; }
.tabs { display: grid; padding: 8px; gap: 2px; border-bottom: 1px solid var(--line); }
.tabs button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 9px; font: 500 13px Inter, sans-serif; color: var(--slate); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.tabs button:hover { background: #f3f4f8; }
.tabs button.active { background: #eef0f7; color: var(--ink); font-weight: 600; }
.badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.badge.soft { background: #e6e8f0; color: var(--slate); }
.side-list { overflow: auto; padding: 6px; flex: 1; }
.chat-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; font: 13px Inter, sans-serif; color: var(--ink); }
.chat-item:hover { background: #f3f4f8; }
.chat-item.active { background: #eef0f7; }
.chat-item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .p { font-size: 11.5px; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .s { font-size: 10.5px; color: #8a90a0; }
.side-foot { display: flex; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.link { border: 0; background: none; color: var(--slate); font: 500 12px Inter, sans-serif; cursor: pointer; padding: 0; }
.link:hover { color: var(--ink); }

.main { min-height: 60vh; display: grid; gap: 12px; align-content: start; }
.main h2 { font-size: 18px; letter-spacing: -.3px; display: flex; align-items: center; gap: 10px; }
.card { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 16px 18px; display: grid; gap: 10px; }
.card.pending { border-color: #d9d3fb; box-shadow: 0 10px 30px rgba(119,103,216,.10); background: linear-gradient(135deg, #fff, #fbfaff); }
.card-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.card-head b { font-size: 14px; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eef0f7; color: var(--slate); }
.tag.pending { background: #efecff; color: #5a49c9; }
.tag.approved, .tag.done { background: #e5f6ec; color: #1f8a50; }
.tag.denied, .tag.failed { background: #fdecea; color: var(--red); }
.tag.expired { background: #f1f1f1; color: #888; }
.when { margin-left: auto; font-size: 11.5px; color: #8a90a0; }
pre { margin: 0; padding: 10px 12px; border-radius: 10px; background: #0f1117; color: #e7e9ee; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; }
pre.light { background: #f6f7fa; color: var(--ink); border: 1px solid var(--line); }
.diff .add { color: #7ee2a8; } .diff .del { color: #ff9a8a; } .diff .hunk { color: #a9b4ff; }
.warn { color: #9a5a12; background: #fff6e8; border: 1px solid #f3dcb5; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; }
.approve-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.approve-row input { width: 150px; letter-spacing: 3px; }
.empty { padding: 40px; text-align: center; color: var(--slate); border: 1px dashed #d8dbe6; border-radius: 14px; background: rgba(255,255,255,.6); }

.thread { display: grid; gap: 10px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user { justify-self: end; background: #111; color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { justify-self: start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; background-image: linear-gradient(135deg, #f7fbff, #fff 45%, #f7f3ff); }
.msg .tools { display: grid; gap: 4px; margin-bottom: 6px; }
.msg .tool { font-size: 11.5px; color: var(--slate); }
.msg .meta { font-size: 11px; color: #8a90a0; margin-top: 4px; }
.msg.error { border-color: #f3c3bb; }
.composer { position: sticky; bottom: 12px; display: flex; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.95); box-shadow: 0 10px 30px rgba(32,38,58,.08); }
.composer textarea { min-height: 44px; max-height: 200px; resize: vertical; border: 0; box-shadow: none !important; }
.device-list { display: grid; gap: 8px; }
.device-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 500; box-shadow: 0 12px 30px rgba(0,0,0,.2); z-index: 20; max-width: 90vw; }
.toast.bad { background: var(--red); }

@media (max-width: 820px) {
  .topbar { padding: 0 14px; } .topbar nav { display: none; }
  main { padding: 16px 10px 40px; }
  .dash { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .side-list { max-height: 260px; }
  .msg { max-width: 100%; }
}
.n-add { color: #1f8a50; font-weight: 600; } .n-del { color: #d0452f; font-weight: 600; } .err-text { color: #d0452f !important; }
.actions { margin-left: auto; }
.msg code { font: 12px ui-monospace, Consolas, monospace; background: rgba(17,19,26,.06); padding: 1px 5px; border-radius: 5px; }
.msg pre { margin: 6px 0; white-space: pre-wrap; }

.crumbs { max-width: 1240px; margin: 0 auto 14px; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--slate); }
.crumbs a:hover { color: var(--ink); }
.account-menu { display: grid; gap: 2px; padding: 8px; border-top: 1px solid var(--line); }
.account-menu a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--slate); font-size: 12.5px; font-weight: 500; }
.account-menu a:hover { background: #f3f4f8; color: var(--ink); }
.account-menu a.active { background: #eef0f7; color: var(--ink); font-weight: 600; }
.account-menu svg { width: 16px; height: 16px; flex: none; }
