/* UranUz.ai — ranglar shu yerda. Boshqa ranglar kerak bo'lsa faqat :root'ni o'zgartiring. */
:root {
  --brand-900: #0a2a5e;   /* eng to'q ko'k — sidebar, hero */
  --brand-800: #0f3a7d;
  --brand-700: #1546a0;
  --brand-600: #1a5fd6;   /* asosiy tugma */
  --brand-500: #2f7bf0;
  --accent:    #ffffff;   /* oq urg'u */
  --accent-ink:#0a2a5e;
  --sky:       #7cc4ff;

  --bg:        #f4f7fc;
  --surface:   #ffffff;
  --ink:       #0f1d36;
  --ink-2:     #44536d;
  --ink-3:     #7a879c;
  --line:      #dfe6f1;
  --danger:    #c62828;
  --ok:        #12704a;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(10, 42, 94, .06), 0 8px 24px rgba(10, 42, 94, .08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
code { font-family: var(--mono); font-size: .9em; }

.view { min-height: 100vh; }
.center { display: grid; place-items: center; padding: 24px 16px; }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand-600);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.brand b { color: var(--sky); font-weight: 700; }
.brand-light { color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.org-logo { max-height: 56px; max-width: 180px; object-fit: contain; }
.org-logo.small { max-height: 32px; margin-left: auto; }

/* ---------- auth ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(700px 400px at 85% 15%, rgba(124, 196, 255, .30), transparent 60%),
    radial-gradient(600px 500px at 0% 100%, rgba(47, 123, 240, .45), transparent 60%),
    var(--brand-900);
  color: #e6eefb;
  padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.auth-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
.hero-copy { position: relative; z-index: 1; max-width: 520px; }
.hero-copy h1 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 16px; color: #fff; }
.hero-copy p { font-size: 17px; line-height: 1.6; color: #b8c9e6; margin: 0 0 28px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; gap: 12px; align-items: center; color: #d6e3f7; }
.hero-points li::before {
  content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--sky); box-shadow: 0 0 0 4px rgba(124, 196, 255, .22);
}
.auth-hero .org-logo { position: relative; z-index: 1; align-self: flex-start; filter: brightness(0) invert(1); opacity: .85; }

.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 16px; gap: 16px; }
.card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 28px;
}
.card.narrow { text-align: center; display: grid; gap: 12px; }
.card.narrow h2 { margin: 4px 0 0; font-size: 22px; }
.card.narrow p { margin: 0; color: var(--ink-2); line-height: 1.55; }
.foot { color: var(--ink-3); font-size: 13px; margin: 0; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tab { border: 0; background: transparent; padding: 10px; border-radius: 8px; color: var(--ink-2); font-weight: 600; }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.form small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; line-height: 1.4; }
input, textarea {
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(47, 123, 240, .18); }

.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 11px 16px;
  font-weight: 600; transition: background .15s, transform .05s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand-600); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-700); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: var(--bg); }
.link { border: 0; background: none; color: var(--brand-600); font-weight: 500; padding: 4px; justify-self: center; }
.link:hover { text-decoration: underline; }

.msg { min-height: 1.2em; margin: 14px 0 0; font-size: 14px; color: var(--danger); text-align: center; }
.msg.ok { color: var(--ok); }
.dev-note { background: #fff8db; border: 1px dashed #d9b400; color: #6b5400; border-radius: 10px; padding: 8px 10px; font-size: 13px; margin: 0; }

.icon-badge {
  justify-self: center; min-width: 56px; height: 56px; padding: 0 12px; border-radius: 16px;
  display: grid; place-items: center; font-size: 24px;
  background: rgba(47, 123, 240, .1); color: var(--brand-700); font-weight: 700;
}
.icon-badge.warn { background: #fdecea; color: var(--danger); font-size: 16px; }

.otp {
  text-align: center; font-family: var(--mono); font-size: 30px; letter-spacing: 12px;
  padding: 14px 10px 14px 22px;
}

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100vh; }
.sidebar {
  background: var(--brand-900); color: #dbe5f5;
  display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; min-height: 0;
}
.sidebar .brand { padding: 2px 6px 6px; }
.new-chat { background: var(--accent); color: var(--accent-ink); text-align: left; }
.new-chat:hover { background: #eaf2ff; }
.chat-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.chat-item {
  display: flex; align-items: center; gap: 6px;
  border-radius: 9px; padding: 9px 10px; color: #c3d3ee; font-size: 14px;
  background: none; border: 0; text-align: left; width: 100%;
}
.chat-item:hover { background: rgba(255,255,255,.06); }
.chat-item.active { background: rgba(255,255,255,.1); color: #fff; }
.chat-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .del { opacity: 0; border: 0; background: none; color: #9fb4d6; padding: 0 4px; font-size: 16px; }
.chat-item:hover .del { opacity: 1; }
.chat-item .del:hover { color: #fff; }
.list-empty { color: #7f95bb; font-size: 13px; padding: 8px 10px; }

.me { display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--brand-600); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.me-info { flex: 1; min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-seat { font-size: 12px; color: #8fa6cc; }
.icon-btn { border: 0; background: none; color: inherit; font-size: 18px; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: rgba(255,255,255,.08); }

.main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h3 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; color: var(--ink); }
.menu-btn:hover { background: var(--bg); }

.messages { flex: 1; overflow-y: auto; padding: 28px 24px 12px; }
.welcome { max-width: 760px; margin: 6vh auto 0; text-align: center; }
.welcome-mark { width: 56px; height: 56px; border-radius: 14px; }
.welcome h2 { font-size: 26px; margin: 16px 0 6px; letter-spacing: -.01em; }
.welcome p { color: var(--ink-2); margin: 0 0 24px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sugg {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 14px; color: var(--ink-2); font-size: 14px; line-height: 1.45; transition: border-color .15s, color .15s;
}
.sugg:hover { border-color: var(--brand-500); color: var(--ink); }

.msg-row { max-width: 820px; margin: 0 auto 22px; display: flex; gap: 12px; }
.msg-row.user { justify-content: flex-end; }
.bubble { line-height: 1.6; font-size: 15px; overflow-wrap: anywhere; }
.msg-row.user .bubble {
  background: var(--brand-800); color: #fff; padding: 11px 15px; border-radius: 16px 16px 4px 16px;
  max-width: 80%; white-space: pre-wrap;
}
.msg-row.ai .ai-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; margin-top: 2px; }
.msg-row.ai .bubble { flex: 1; min-width: 0; }
.bubble p { margin: 0 0 .7em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { padding-left: 1.3em; margin: .3em 0 .8em; }
.bubble li { margin: .2em 0; }
.bubble h1, .bubble h2, .bubble h3 { font-size: 1.05em; margin: 1em 0 .4em; }
.bubble pre { background: #0d1f3f; color: #e3ecfa; padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.bubble :not(pre) > code { background: #eef3fb; padding: 1px 5px; border-radius: 5px; }
.bubble table { border-collapse: collapse; width: 100%; margin: .6em 0; font-size: 14px; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.bubble th { background: var(--bg); }
.bubble.error { color: var(--danger); }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-500); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer {
  max-width: 820px; width: calc(100% - 32px); margin: 0 auto;
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px; box-shadow: var(--shadow);
}
.composer textarea { flex: 1; border: 0; resize: none; max-height: 220px; padding: 9px 10px; box-shadow: none; }
.composer .send { width: 44px; height: 44px; padding: 0; border-radius: 12px; font-size: 18px; }
.disclaimer { text-align: center; color: var(--ink-3); font-size: 12px; margin: 8px 16px 14px; }

/* ---------- mobil ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px; }
  .hero-copy h1 { font-size: 26px; }
  .hero-copy p { font-size: 15px; margin-bottom: 18px; }
  .auth-hero .org-logo { display: none; }
}
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 82%; max-width: 300px; z-index: 20;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-block; }
  .topbar { padding: 10px 16px; }
  .messages { padding: 18px 16px 8px; }
  .suggestions { grid-template-columns: 1fr; }
  .composer { width: calc(100% - 24px); }
  .card { padding: 22px 18px; }
}
.logout-btn { font-size: 12.5px; color: #9fb4d6; border: 1px solid rgba(255,255,255,.12); }
.logout-btn:hover { color: #fff; }
.card.narrow > *, .form > * { min-width: 0; }
.form input { width: 100%; }
@media (max-width: 900px) { .hero-points { display: none; } }
