/* Suan Terminal — ODA 5 uslubidagi shisha (glass) dizayn */
:root {
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.38);
  --panel: rgba(10, 26, 56, 0.55);
  --panel-2: rgba(10, 26, 56, 0.35);
  --field: #0f1e3c;
  --border: rgba(255, 255, 255, 0.12);
  --border-2: rgba(255, 255, 255, 0.2);
  --hover: rgba(255, 255, 255, 0.08);
  --blue: #59c3ff;
  --teal: #57e6d9;
  --green: #5af78e;
  --lime: #a4d65e;
  --yellow: #ffcf3f;
  --red: #ff5b6b;
  --violet: #7b6bff;
  --term-bg: #05070d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Inter", Arial, sans-serif;
  color: var(--text);
  background: #071122;
  overflow: hidden;
}
button, input { font-family: inherit; }

.bg-video {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -3;
}
.bg-overlay {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(circle at top left, rgba(20, 55, 110, 0.25), transparent 32%),
    radial-gradient(circle at top right, rgba(16, 83, 145, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(5, 13, 26, 0.45), rgba(8, 22, 46, 0.40), rgba(12, 40, 78, 0.38));
}

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

/* ── Brend nomi: «Suan» kumush perelivi, «Terminal» logotip ranglarida ── */
.brand-name {
  background-image: linear-gradient(100deg, #fff 0%, #eef2f8 16%, #c7cfdb 32%, #fff 48%, #d9dfe9 64%, #f4f6fa 80%, #fff 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: st-shimmer 11s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}
.brand-ver {
  font-weight: 900;
  background-image: linear-gradient(90deg, #59c3ff 0%, #3b5bdb 18%, #1f8fb5 34%, #57e6d9 50%, #5af78e 66%, #a4d65e 82%, #59c3ff 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: st-shimmer 6s linear infinite, st-glow 6s ease-in-out infinite;
}
@keyframes st-shimmer { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
@keyframes st-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(89, 195, 255, 0.5)); }
  50% { filter: drop-shadow(0 0 12px rgba(90, 247, 142, 0.5)); }
}
@media (prefers-reduced-motion: reduce) {
  .brand-name, .brand-ver { animation-duration: 40s; }
}

/* ── Login ── */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; padding: 40px 36px; border-radius: 28px; }
.login-logo { width: 84px; height: 84px; display: block; margin: 0 auto 14px; filter: drop-shadow(0 0 18px rgba(89, 195, 255, 0.35)); }
.login-title { font-size: 32px; font-weight: 800; text-align: center; letter-spacing: -0.5px; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 30px; }

.field { margin-bottom: 14px; position: relative; }
.field label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px 4px; }
.field input {
  width: 100%; height: 48px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--field); color: #fff;
  font-size: 15px; outline: none; transition: border-color .2s;
}
.field input::placeholder { color: rgba(255, 255, 255, 0.3); }
.field input:focus { border-color: rgba(89, 195, 255, 0.55); }
.field .err { color: #ff8a95; font-size: 12px; margin: 5px 0 0 4px; }
.field-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border-2); background: rgba(255, 255, 255, 0.08);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .15s, border-color .2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.btn-primary { border-color: rgba(89, 195, 255, 0.45); background: rgba(89, 195, 255, 0.16); }
.btn-primary:hover { background: rgba(89, 195, 255, 0.28); }
.btn-danger { border-color: rgba(255, 91, 107, 0.45); background: rgba(255, 91, 107, 0.14); }
.btn-danger:hover { background: rgba(255, 91, 107, 0.26); }
.btn-block { width: 100%; height: 50px; border-radius: 14px; font-size: 15px; margin-top: 8px; }
.btn svg { width: 16px; height: 16px; }

.login-error {
  color: #ff8a95; font-size: 13px; margin-bottom: 16px; padding: 10px 14px; border-radius: 10px;
  background: rgba(255, 91, 107, 0.10); border: 1px solid rgba(255, 91, 107, 0.25);
}
.pwd-toggle {
  position: absolute; right: 12px; bottom: 12px; background: none; border: none; cursor: pointer;
  padding: 2px; display: flex; opacity: .45; transition: opacity .2s;
}
.pwd-toggle:hover { opacity: .85; }
.pwd-toggle svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Asosiy ekran ── */
.app { position: fixed; left: 0; right: 0; top: 0; height: var(--app-h, 100dvh); display: grid; grid-template-rows: auto 1fr; gap: 14px; padding: 14px; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.brand img { width: 38px; height: 38px; filter: drop-shadow(0 0 10px rgba(89, 195, 255, 0.35)); }
.topbar .spacer { flex: 1; }
.clock { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); padding: 8px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.06); color: #fff; cursor: pointer;
  transition: background .2s, border-color .2s; flex: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); border-color: var(--border-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.menu-btn { display: none; }

.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; min-height: 0; }
.sidebar { border-radius: 22px; padding: 16px 12px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 18px; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 8px; }
.sec-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sec-count { font-size: 11px; color: var(--faint); font-weight: 600; }
.empty-note { color: var(--faint); font-size: 13px; padding: 10px 8px; line-height: 1.5; }

.item {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
  cursor: pointer; transition: background .15s, border-color .15s; border: 1px solid transparent;
}
.item:hover { background: var(--hover); border-color: var(--border); }
.item .ico {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(59, 91, 219, 0.35), rgba(90, 247, 142, 0.25)); border: 1px solid var(--border);
}
.item .ico svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.item .meta { min-width: 0; flex: 1; }
.item .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12px; color: var(--faint); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item .actions { display: none; gap: 4px; }
.item:hover .actions, .item:focus-within .actions { display: flex; }
.item.pinned .ico { background: linear-gradient(135deg, rgba(255, 207, 63, 0.35), rgba(255, 140, 60, 0.2)); }
.badge { font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 8px; white-space: nowrap; flex: none; }
.badge.ttl { color: var(--muted); background: rgba(255, 255, 255, 0.08); }
.badge.ttl.soon { color: #ff8a95; background: rgba(255, 91, 107, 0.14); }
.badge.pin { color: var(--yellow); background: rgba(255, 207, 63, 0.14); }
.item:hover .badge { display: none; }
.group-label { font-size: 11px; color: var(--faint); padding: 6px 8px 4px; }

/* ── Terminal paneli ── */
.term-panel { min-width: 0; border-radius: 22px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-height: 0; overflow: hidden; }
.tabbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 0; min-height: 50px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; align-self: flex-end; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border-radius: 12px 12px 0 0;
  background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; border-bottom: none; max-width: 240px; transition: background .15s, color .15s;
}
.tab:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.tab.active { background: var(--term-bg); color: #fff; border-color: var(--border); }
.tab .label { overflow: hidden; text-overflow: ellipsis; }
.tab .x { width: 20px; height: 20px; border-radius: 6px; border: none; background: none; color: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: .5; flex: none; }
.tab .x:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
.tab .x svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.connecting { background: var(--yellow); animation: pulse 1s ease-in-out infinite; }
.dot.online { background: var(--green); box-shadow: 0 0 8px rgba(90, 247, 142, 0.7); }
.dot.offline { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.tools { display: flex; gap: 6px; padding-bottom: 6px; flex: none; }
.btn-claude { height: 34px; font-size: 13px; padding: 0 12px; border-radius: 10px; border-color: rgba(217, 119, 87, 0.5); background: rgba(217, 119, 87, 0.16); }
.btn-claude:hover { background: rgba(217, 119, 87, 0.3); }
.btn-claude[disabled] { opacity: .35; pointer-events: none; }

.term-area {
  position: relative; background: var(--term-bg); margin: 0 10px 10px; border-radius: 0 12px 12px 12px; border: 1px solid var(--border);
  min-height: 0; overflow: hidden; display: grid; gap: 6px; padding: 4px;
  grid-auto-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr);
}
.term-host { position: relative; display: none; min-width: 0; min-height: 0; border-radius: 10px; border: 1px solid transparent; }
.term-host.visible { display: block; }
.term-inner { position: absolute; inset: 6px 2px 2px 8px; }
.term-host .xterm { height: 100%; }
.term-area.multi .term-host { border-color: var(--border); background: rgba(255, 255, 255, 0.012); }
.term-area.multi .term-host.focused { border-color: rgba(89, 195, 255, 0.6); box-shadow: 0 0 14px rgba(89, 195, 255, 0.12); }
.pane-label {
  display: none; position: absolute; top: 4px; right: 8px; z-index: 3; max-width: 60%; pointer-events: none;
  font-size: 11px; color: var(--muted); padding: 2px 8px; border-radius: 8px; background: rgba(10, 26, 56, 0.75);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.term-area.multi .pane-label { display: block; }
.term-area.multi .term-host.focused .pane-label { color: #fff; background: rgba(89, 195, 255, 0.28); }
.tab.shown:not(.active) { color: #fff; box-shadow: inset 0 -2px 0 rgba(89, 195, 255, 0.45); }
.new-tab { width: 32px; height: 32px; border-radius: 10px; align-self: center; margin-bottom: 4px; }
.term-host .xterm-viewport { background-color: transparent !important; }
.term-host .xterm-viewport::-webkit-scrollbar { width: 8px; }
.term-host .xterm-viewport::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
.term-overlay {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; font-size: 13px;
  background: rgba(10, 26, 56, 0.85); border: 1px solid var(--border-2); backdrop-filter: blur(12px); max-width: calc(100% - 32px);
}
.term-overlay.error { border-color: rgba(255, 91, 107, 0.5); color: #ffc2c8; }

.welcome { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.welcome img { width: 120px; opacity: .9; filter: drop-shadow(0 0 24px rgba(89, 195, 255, 0.3)); }
.welcome h2 { margin: 0; font-size: 26px; font-weight: 800; }
.welcome p { margin: 0; color: var(--muted); font-size: 14px; max-width: 460px; line-height: 1.6; }
.welcome kbd { font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--border); }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-top: 6px; font-family: var(--mono); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Mobil qo'shimcha tugmalar qatori (Esc, Tab, Ctrl, strelkalar…) ── */
.keybar {
  display: none; gap: 6px; padding: 0 10px 10px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.keybar::-webkit-scrollbar { display: none; }
.keybar button {
  flex: none; min-width: 44px; height: 38px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.07); color: #e6edf3;
  font-family: var(--mono); font-size: 14px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.keybar button:active { background: rgba(89, 195, 255, 0.28); }
.keybar button.on { background: rgba(89, 195, 255, 0.32); border-color: rgba(89, 195, 255, 0.7); color: #fff; }
.keybar button.k-danger { color: #ff8a95; border-color: rgba(255, 91, 107, 0.35); }
.keybar button.k-wide { font-family: inherit; font-size: 13px; }
.side-backdrop { display: none; }

/* ── Navigator tugmalari ── */
.nav { display: flex; gap: 8px; margin-left: 10px; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.nav-btn:hover, .nav-btn[aria-expanded="true"] { background: rgba(89, 195, 255, 0.16); border-color: rgba(89, 195, 255, 0.45); }
.nav-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn .chev { width: 14px; height: 14px; opacity: .6; transition: transform .2s; }
.nav-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ── Ochiladigan panellar (Serverlar / Apps) ── */
.pop-back { position: fixed; inset: 0; z-index: 44; display: none; }
@media (max-width: 860px) { .pop-back.open { display: block; } }
.pop {
  position: fixed; z-index: 45; width: 360px; max-height: min(560px, calc(var(--app-h, 100dvh) - 100px));
  border-radius: 20px; display: none; flex-direction: column; overflow: hidden; background: rgba(10, 26, 56, 0.9);
}
.pop.open { display: flex; animation: pop-in .16s ease-out; }
.pop-wide { width: 640px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--border); }
.pop-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.pop-title svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pop-actions { display: flex; gap: 6px; align-items: center; }
.pop-body { overflow-y: auto; padding: 10px; overscroll-behavior: contain; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mini-select, .select {
  height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--field); color: #fff;
  font-size: 13px; padding: 0 8px; outline: none; max-width: 150px;
}
.select { width: 100%; max-width: none; height: 48px; border-radius: 14px; font-size: 15px; padding: 0 14px; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.app-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px 12px;
  border-radius: 16px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); cursor: pointer;
  text-align: center; transition: background .15s, border-color .15s, transform .15s;
}
.app-card:hover { background: rgba(89, 195, 255, 0.1); border-color: rgba(89, 195, 255, 0.4); transform: translateY(-2px); }
.app-logo {
  width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
}
.app-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.app-logo .ph { font-size: 22px; font-weight: 800; color: var(--blue); }
.app-name { font-size: 14px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-path { font-size: 11px; color: var(--faint); font-family: var(--mono); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.app-acts { display: flex; gap: 6px; margin-top: 2px; }
.app-acts .btn { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 9px; }
.app-acts .btn svg { width: 13px; height: 13px; }
.app-edit { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; }
.app-card:hover .app-edit, .app-card:focus-within .app-edit { opacity: 1; }
.item .ico img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.item .ico:has(img) { background: rgba(255, 255, 255, 0.08); }

.logo-row { display: flex; align-items: flex-end; gap: 14px; }
.logo-pick {
  width: 72px; height: 72px; flex: none; border-radius: 18px; border: 1px dashed var(--border-2); background: var(--field);
  display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden;
}
.logo-pick:hover { border-color: rgba(89, 195, 255, 0.6); }
.logo-pick img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo-pick svg { width: 26px; height: 26px; fill: none; stroke: var(--muted); stroke-width: 2; }
.hint code { font-family: var(--mono); font-size: 11px; color: var(--teal); }

/* ── Oynalar joylashuvi tugmalari ── */
.seg { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: rgba(255, 255, 255, 0.04); }
.seg button { width: 34px; height: 36px; border: none; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.seg button.on { background: rgba(89, 195, 255, 0.22); color: #fff; }
.seg svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Modal ── */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(2, 8, 20, 0.55); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-back.open { display: flex; }
.modal { width: 100%; max-width: 440px; border-radius: 24px; padding: 28px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h3 { margin: 0 0 20px; font-size: 20px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 6px; cursor: pointer; }
.hint { font-size: 12px; color: var(--faint); margin-top: 6px; line-height: 1.5; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; padding: 12px 16px; border-radius: 14px; font-size: 14px;
  background: rgba(10, 26, 56, 0.9); border: 1px solid var(--border-2); backdrop-filter: blur(12px);
  transform: translateY(20px); opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { transform: none; opacity: 1; }

/* Butun ekran rejimi */
.app.fullscreen { grid-template-rows: 1fr; padding: 0; }
.app.fullscreen .topbar, .app.fullscreen .sidebar { display: none; }
.app.fullscreen .workspace { grid-template-columns: minmax(0, 1fr); }
.app.fullscreen .term-panel { border-radius: 0; }

@media (max-width: 860px) {
  .app { padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 8px; }
  .menu-btn { display: inline-flex; }
  .clock { display: none; }
  .topbar { padding: 6px 8px; border-radius: 16px; gap: 8px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand { min-width: 0; white-space: nowrap; }
  .brand > span { overflow: hidden; text-overflow: ellipsis; }
  .brand img { width: 30px; height: 30px; flex: none; }
  /* Mobil: Serverlar/Apps faqat ikonka, o'ng tomonda Chiqish tugmasiga yopishgan */
  .topbar .spacer { order: 1; }
  .topbar .nav { order: 2; }
  .topbar > a.icon-btn { order: 3; margin-left: -2px; }
  .topbar .icon-btn { width: 36px; height: 36px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar {
    position: fixed; z-index: 40; top: 8px; bottom: 8px; left: 8px; width: min(330px, calc(100vw - 48px));
    transform: translateX(-110%); transition: transform .25s; background: rgba(10, 26, 56, 0.94);
  }
  .sidebar.open { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(2, 8, 20, 0.5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sidebar.open ~ .side-backdrop, .side-backdrop.open { opacity: 1; pointer-events: auto; }
  .item { padding: 12px 10px; }
  .item .actions { display: flex; }
  .item .badge { display: none; }
  .icon-btn.sm { width: 34px; height: 34px; }

  .term-panel { border-radius: 16px; }
  .tabbar { padding: 6px 6px 0; min-height: 44px; gap: 4px; }
  .tab { padding: 8px 6px 8px 10px; font-size: 12.5px; max-width: 150px; gap: 6px; }
  .tab .x { width: 26px; height: 26px; opacity: .7; }
  .tools { gap: 4px; padding-bottom: 4px; }
  .tools .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .tools .btn-claude { width: 34px; padding: 0; }
  .tools .btn-claude .txt { display: none; }
  .term-area.multi .pane-label { display: none; }
  .term-area { margin: 0 6px 6px; border-radius: 0 10px 10px 10px; padding: 2px; gap: 4px; }
  .term-inner { inset: 4px 1px 2px 4px; }
  .wide-only, .font-btn { display: none !important; }
  .seg button { width: 34px; height: 34px; }
  .new-tab { width: 30px; height: 30px; }
  .nav { margin-left: 0; gap: 6px; flex: none; }
  .nav-btn { height: 36px; width: 36px; padding: 0; justify-content: center; font-size: 13px; gap: 0; }
  .nav-btn .nav-txt { display: none; }
  .nav-btn .chev { display: none; }
  .pop, .pop-wide {
    left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto;
    max-height: calc(var(--app-h, 100dvh) * 0.78); border-radius: 22px; background: rgba(10, 26, 56, 0.96);
  }
  .pop.open { animation: sheet-in .2s ease-out; }
  .pop-back { background: rgba(2, 8, 20, 0.5); }
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-edit { opacity: 1; }
  .pop-head { flex-wrap: wrap; }
  .keybar { padding: 0 6px 6px; }
  .welcome { justify-content: flex-start; padding-top: 32px; overflow-y: auto; }
  .welcome img { width: 84px; }
  .welcome h2 { font-size: 22px; }
  .welcome .desk-only { display: none; }
  .term-overlay { bottom: 12px; font-size: 12.5px; flex-wrap: wrap; justify-content: center; }

  .modal { padding: 22px 18px; border-radius: 20px; }
  .field input { font-size: 16px; } /* iOS'da avtomatik zoom bo'lmasligi uchun */
  .toast { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); text-align: center; }

  /* Klaviatura ochiq: joy tejash uchun yuqori panel yashiriladi */
  .app.kb-open { grid-template-rows: 1fr; }
  .app.kb-open .topbar { display: none; }
}

/* Sensorli qurilmalarda (planshet ham) tugmalar qatori doim ko'rinadi */
@media (pointer: coarse) {
  .item .actions { display: flex; }
  .item .badge { display: none; }
}
.mob-only { display: none; }
@media (max-width: 860px) { .mob-only { display: block; } }

/* Telefon yotiq holatda: balandlik kam — panellar ixchamroq */
@media (max-height: 500px) and (pointer: coarse) {
  .app { gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .topbar { padding: 3px 8px; }
  .topbar .icon-btn { width: 30px; height: 30px; }
  .brand { font-size: 15px; }
  .brand img { width: 24px; height: 24px; }
  .tabbar { min-height: 38px; padding-top: 4px; }
  .tab { padding-top: 6px; padding-bottom: 6px; }
  .tools .icon-btn, .btn-claude { width: 30px; height: 30px; }
  .keybar { padding-bottom: 4px; }
  .keybar button { height: 32px; }
}

@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 360px) { .brand { font-size: 15px; } }
@media (max-width: 400px) {
  .pop-actions .nav-txt { display: none; }
  .mini-select { max-width: 110px; }
}
@media (pointer: coarse) {
  .app-edit { opacity: 1; }
}

@media (max-width: 1280px) { .tools .btn-claude .txt { display: none; } .tools .btn-claude { width: 36px; padding: 0; } }

/* ── Tezlik: terminal paneli ortidagi video har kadrda blur qilinmasin ── */
.term-panel.glass {
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: rgba(8, 19, 42, 0.9);
}
.term-area { contain: strict; }
.term-host { contain: strict; }
@media (pointer: coarse) {
  /* Telefonda blur umuman yo'q — GPU terminal chizishga band bo'lsin */
  .glass { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar.glass, .sidebar.glass { background: rgba(10, 26, 56, 0.9); }
  .pop, .modal.glass { background: rgba(10, 26, 56, 0.97); }
}

/* ── Klaviatura ochiq: klaviatura bilan dastur orasida bo'sh joy qolmasin ── */
.app.kb-open { padding: 2px 2px 0 !important; gap: 0; }
.app.kb-open .term-panel { border-radius: 12px 12px 0 0; border-bottom: none; }
.app.kb-open .tabbar { min-height: 36px; padding-top: 2px; }
.app.kb-open .term-area { margin-bottom: 2px; }
.app.kb-open .keybar { padding-bottom: 2px; }
.app.kb-open .keybar button { height: 34px; }
.app.kb-open { grid-template-rows: minmax(0, 1fr); }
.app.kb-open .topbar { display: none; }
body.term-page { position: fixed; inset: 0; overscroll-behavior: none; touch-action: manipulation; }

/* Qo'shimcha tugmalar qatori faqat yoqilganda; tugmaning o'zi faqat sensorli qurilmada */
.app.keys-on .keybar { display: flex; }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: inline-flex; } }
.icon-btn.on { background: rgba(89, 195, 255, 0.22); border-color: rgba(89, 195, 255, 0.55); }
.term-overlay .btn-primary { flex: none; }
.term-overlay .btn { white-space: normal; max-width: 100%; }
@media (max-width: 860px) {
  .term-overlay { flex-direction: column; text-align: center; width: calc(100% - 24px); }
  .term-overlay .btn { width: 100%; }
}

/* ── Mobil: yuborish tugmasi (faqat ikonka) — terminal ustida o'ng pastda ── */
.term-panel { position: relative; }
.send-btn {
  position: absolute; right: 14px; bottom: 14px; z-index: 6;
  width: 48px; height: 48px; border-radius: 50%; border: none; padding: 0;
  align-items: center; justify-content: center; cursor: pointer;
  background: #2f9bff; color: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.send-btn svg { width: 22px; height: 22px; margin: 2px 2px 0 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send-btn:active { transform: scale(0.92); background: #1f86e6; }
.app.keys-on .send-btn { bottom: 62px; }
.app:not(.has-tabs) .send-btn { display: none; }

/* Klaviatura ochiq: terminal pastga yopishadi — qatorga sig'magan qoldiq piksellar
   klaviatura bilan terminal orasida emas, tepada qoladi */
.app.kb-open .term-inner { display: flex; flex-direction: column; justify-content: flex-end; }
.app.kb-open .term-host .xterm { height: auto; }

/* ── Fayl yuklash ── */
.attach-fab {
  /* Yuborish tugmasi ustida — yozilayotgan matnni to'smaydi */
  position: absolute; right: 18px; bottom: 72px; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%; padding: 0; cursor: pointer;
  align-items: center; justify-content: center;
  background: rgba(20, 34, 62, 0.92); color: #cfe6ff; border: 1px solid var(--border-2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.attach-fab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach-fab:active { transform: scale(0.92); background: rgba(47, 155, 255, 0.35); }
.app.keys-on .attach-fab { bottom: 120px; }
.app:not(.has-tabs) .attach-fab { display: none; }
/* Telefonda 📎 pastdagi suzuvchi tugmada — yuqori panelda takrorlanmaydi */
@media (pointer: coarse) { #attachBtn { display: none; } }

.upload-tray {
  position: absolute; left: 14px; bottom: 14px; z-index: 7; width: min(340px, calc(100% - 150px));
  display: none; flex-direction: column; gap: 6px; max-height: 50%; overflow-y: auto;
}
.upload-tray.open { display: flex; }
.up-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px 9px 10px; border-radius: 12px;
  background: rgba(10, 26, 56, 0.96); border: 1px solid var(--border-2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  animation: sheet-in .18s ease-out;
}
.up-ic {
  flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(89, 195, 255, 0.14); color: #8ad6ff; font: 700 10px var(--mono); letter-spacing: .3px; overflow: hidden;
}
.up-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.up-main { flex: 1; min-width: 0; }
.up-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); margin: 2px 0 5px; }
.up-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2f9bff, #57e6d9); border-radius: 2px; transition: width .15s linear; }
.up-row.saving .up-bar i { animation: up-pulse 1s ease-in-out infinite; }
.up-row.done .up-ic { background: rgba(90, 247, 142, 0.16); color: #5af78e; }
.up-row.done .up-bar i { background: #5af78e; }
.up-row.error { border-color: rgba(255, 91, 107, 0.5); }
.up-row.error .up-ic { background: rgba(255, 91, 107, 0.14); color: #ff8a95; }
.up-row.error .up-st { color: #ff8a95; }
.up-row.error .up-bar { display: none; }
.up-x {
  flex: none; width: 28px; height: 28px; border-radius: 8px; border: none; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--muted);
}
.up-x:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.up-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@keyframes up-pulse { 50% { opacity: .45; } }

.drop-zone {
  position: absolute; inset: 0; z-index: 20; display: none; place-items: center; padding: 18px;
  background: rgba(5, 12, 28, 0.72); pointer-events: none;
}
.drop-zone.on { display: grid; }
.drop-card {
  width: 100%; height: 100%; border: 2px dashed rgba(89, 195, 255, 0.7); border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  background: rgba(47, 155, 255, 0.08); color: #e6edf3;
}
.drop-card svg { width: 44px; height: 44px; fill: none; stroke: #59c3ff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-card b { font-size: 18px; }
.drop-card span { font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  /* O'ngdagi tugmalar ustuniga tegmaydi */
  .upload-tray { left: 8px; bottom: 14px; width: calc(100% - 84px); }
  .app.keys-on .upload-tray { bottom: 62px; }
}
