/* ==========================================================================
   OneChat — visual theme v3 "Midnight Glass"
   Premium dark edition with sharp edges, high contrast & gold accents.
   Layout/markup contract with app.js is untouched.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root{
  --canvas:#12101C;
  --bg:#12101C;
  --bg2:#1E1B2E;
  --surface:#1B1828;
  --panel:#211E32;
  --panel2:#252138;
  --surface-2:#2A2640;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.14);
  --text:#F0ECFF;
  --ink:#F0ECFF;
  --muted:#A8A0C8;
  --muted-dim:#6E6890;

  --accent:#7B6FE0;        /* Iris — slightly lifted for dark bg */
  --accent-2:#9A8FFF;
  --lime:#7B6FE0;
  --lime2:#9A8FFF;
  --lime-deep:#5A4FBF;

  --raspberry:#FF5277;     /* more vibrant on dark */
  --raspberry-soft: rgba(255,82,119,.16);

  --gold:#F5C542;          /* premium accent */

  --success:#34D399;
  --danger:#F87171;

  --shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.06);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08);
  --radius: 12px;           /* sharper edges */
  --radius-sm: 10px;
  --radius-lg: 16px;
  --thin: 1px solid var(--line);
  --thin-strong: 1px solid var(--line-strong);
  --glow: 0 0 0 1px rgba(123,111,224,.45), 0 8px 24px rgba(123,111,224,.2);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: 'Manrope', var(--font);

  --bubble-in: var(--surface-2);
  --bubble-in-line: var(--line);
  --bubble-me: var(--accent);
  --bubble-me-line: var(--accent);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  background:
    radial-gradient(circle at 8% 0%, rgba(123,111,224,.12), transparent 32%),
    radial-gradient(circle at 100% 12%, rgba(255,82,119,.1), transparent 34%),
    radial-gradient(circle at 40% 100%, rgba(245,197,66,.06), transparent 40%),
    var(--canvas);
  color:var(--text);
  overflow:hidden;
  -webkit-tap-highlight-color: transparent;
}
button,input,textarea,select{font:inherit}
.hidden{display:none !important}

/* Scrollbars */
*{scrollbar-width:thin; scrollbar-color: rgba(123,111,224,.28) transparent;}
*::-webkit-scrollbar{width:8px; height:8px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background:rgba(123,111,224,.22); border-radius:999px}
*::-webkit-scrollbar-thumb:hover{background:rgba(123,111,224,.45)}

@media (prefers-reduced-motion: reduce){
  *{animation-duration:.001ms !important; transition-duration:.001ms !important; scroll-behavior:auto !important}
}

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app{
  height:100vh;
  height:100dvh;
  display:grid;
  grid-template-columns: 336px 1fr;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar{
  border-right:var(--thin-strong);
  background: linear-gradient(180deg, rgba(27,24,40,.96), rgba(33,30,50,.92));
  backdrop-filter: blur(20px);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  min-width:290px;
  min-height:0;
  height:100%;
  overflow:hidden;
}

.brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:var(--thin);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  flex:0 0 auto;
}
.brand > div:first-child{
  position:relative;
  padding-left:52px;
  min-height:40px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-width:0;
}
.brand > div:first-child::before{
  content:'';
  position:absolute;
  left:0; top:50%;
  transform:translateY(-50%);
  width:40px; height:40px;
  border-radius:10px;
  background: linear-gradient(135deg, var(--accent), var(--raspberry) 130%);
  box-shadow: 0 6px 16px rgba(123,111,224,.4), inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand h1{
  font-family: var(--font-display);
  font-weight:800;
  font-size:19px;
  margin:0;
  letter-spacing:-.01em;
  white-space:nowrap;
  color:var(--ink);
}
.badge{
  font-family: var(--font-display);
  font-size:11px;
  font-weight:700;
  letter-spacing:.02em;
  color:var(--gold);
  border:1px solid rgba(245,197,66,.35);
  padding:6px 10px;
  border-radius:999px;
  background: rgba(245,197,66,.12);
  flex:0 0 auto;
  white-space:nowrap;
}
.badge[data-tone="idle"]{ color:var(--muted); border-color:var(--line); background:rgba(255,255,255,.05) }

.panel{
  border:var(--thin);
  border-radius:var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.userbox{
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  flex:0 0 auto;
}
.userrow{display:flex; align-items:center; gap:12px;}
.avatar{
  width:46px; height:46px; border-radius:12px;
  display:grid; place-items:center;
  background: linear-gradient(150deg, rgba(123,111,224,.35), rgba(123,111,224,.1));
  border:1px solid rgba(123,111,224,.3);
  color:var(--accent);
  font-family: var(--font-display);
  font-weight:800;
  font-size:15px;
  flex:0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.user-meta{flex:1; min-width:0}
.user-meta .name{font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:14.5px; color:var(--ink)}
.user-meta .sub{font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px}

.btn{
  border:none;
  border-radius:10px;
  padding:12px 16px;
  color:#fff;
  background: linear-gradient(135deg, var(--accent), var(--raspberry) 145%);
  font-weight:700;
  font-size:13.5px;
  cursor:pointer;
  transition:.16s ease;
  box-shadow: 0 8px 20px rgba(123,111,224,.35), 0 0 0 1px rgba(255,255,255,.08);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.btn:hover{transform:translateY(-1px); filter:brightness(1.1); box-shadow: 0 12px 26px rgba(123,111,224,.5)}
.btn:active{transform:translateY(0) scale(.98)}
.btn:disabled{opacity:.4; cursor:not-allowed; transform:none; box-shadow:none}
.btn.secondary{
  background: var(--surface-2);
  color:var(--ink);
  border:var(--thin);
  box-shadow:none;
}

.btn.secondary1{
  background: rgba(245,197,66,.15);
  color:var(--gold);
  border:1px solid rgba(245,197,66,.3);
  box-shadow:none;
}

.btn.secondary:hover{ border-color:var(--line-strong); background:var(--panel2) }
.btn.secondary.active{ border-color: var(--accent); background: rgba(123,111,224,.14); color: var(--accent); }
.btn.danger{
  background: rgba(248,113,113,.12);
  color:var(--danger);
  border:1px solid rgba(248,113,113,.25);
  box-shadow:none;
}
.btn.danger:hover{ background:rgba(248,113,113,.2) }

.inline{display:flex; gap:10px}
.inline > *{flex:1}

.search{
  padding:12px 16px 12px 44px;
  width:100%;
  border-radius:10px;
  border:var(--thin);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A8A0C8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 16px center;
  color:var(--text);
  outline:none;
  flex:0 0 auto;
  transition:.15s ease;
}
.search::placeholder{color:var(--muted-dim)}
.search:focus{border-color: var(--accent); box-shadow: var(--glow); background-color: var(--surface)}

.sidebar-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  display:flex;
  flex-direction:column;
  gap:6px;
  scroll-behavior:auto;
  margin-right:-6px;
  padding-right:6px;
}

.section{
  padding:10px 4px 6px;
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:0 0 auto;
}
.section h3{
  font-family: var(--font-display);
  margin:2px 6px;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.14em;
  color:var(--muted-dim);
  font-weight:700;
}
.list{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.item{
  display:flex;
  align-items:center;
  gap:13px;
  border:var(--thin);
  border-radius:12px;
  padding:9px 12px;
  background: var(--surface);
  cursor:pointer;
  transition:.14s ease;
  position:relative;
}
.item:hover{transform:translateX(2px); border-color: var(--accent); background: var(--panel2)}
.item:active{transform:translateX(2px) scale(.99)}
.item.active{background: rgba(123,111,224,.14); border-color: var(--accent)}

.item .dot{
  width:46px; height:46px; border-radius:50%;
  flex:0 0 auto;
  position:relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
  background: linear-gradient(150deg, rgba(123,111,224,.5), rgba(123,111,224,.15));
}
.list .item:nth-child(2n) .dot{ background: linear-gradient(150deg, rgba(96,165,250,.45), rgba(96,165,250,.1)); }
.list .item:nth-child(3n) .dot{ background: linear-gradient(150deg, rgba(245,197,66,.5), rgba(245,197,66,.12)); }
.list .item:nth-child(4n) .dot{ background: linear-gradient(150deg, rgba(52,211,153,.4), rgba(52,211,153,.1)); }
.list .item:nth-child(5n) .dot{ background: linear-gradient(150deg, rgba(255,82,119,.45), rgba(255,82,119,.1)); }

.item .dot::after{
  content:"";
  position:absolute;
  right:-1px; bottom:-1px;
  width:12px; height:12px;
  border-radius:50%;
  background:#34D399;
  border:2.5px solid var(--surface);
}
.item.offline .dot::after{ background:#6E6890; }

.item .title{font-weight:700; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--ink)}
.item .preview{font-size:12.5px; color:var(--muted); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}

.item .check{
  width:22px; height:22px;
  border-radius:50%;
  border:1.6px solid rgba(123,111,224,.45);
  flex:0 0 auto;
  margin-left:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:.14s ease;
  background:transparent;
}
.item .check::after{
  content:"";
  width:11px; height:6px;
  border-left:2px solid #fff;
  border-bottom:2px solid #fff;
  transform:rotate(-45deg) translateY(-1px);
  opacity:0;
  transition:.14s ease;
}
.item.selected .check{
  background:var(--accent);
  border-color:var(--accent);
}
.item.selected .check::after{ opacity:1; }

.item.selected{
  background: rgba(123,111,224,.14);
  border-color: var(--accent);
}

/* ==========================================================================
   Main column
   ========================================================================== */
.main{
  display:grid;
  grid-template-rows: auto 1fr auto;
  min-width:0;
  min-height:0;
  height:100%;
}
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:18px 24px;
  border-bottom:var(--thin-strong);
  background: rgba(27,24,40,.92);
  backdrop-filter: blur(16px);
  flex:0 0 auto;
}
.titleblock{min-width:0}
.titleblock h2{
  font-family: var(--font-display);
  margin:0;
  font-size:19px;
  font-weight:800;
  color:var(--ink);
  display:flex;
  align-items:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.titleblock h2::before{
  content:'';
  display:inline-block;
  width:9px; height:9px;
  border-radius:50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(245,197,66,.6);
  margin-right:10px;
  flex:0 0 auto;
}
.titleblock p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:12.5px;
  letter-spacing:.02em;
}
.toolbar{display:flex; gap:10px; flex-wrap:wrap}

.top-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:auto;
}
.icon-btn{
  width:42px;
  height:42px;
  border-radius:10px;
  border:var(--thin);
  background:var(--surface);
  color:var(--ink);
  display:grid;
  place-items:center;
  cursor:pointer;
  box-shadow: var(--shadow);
  transition:.15s ease;
  flex:0 0 auto;
  font-weight:800;
}
.icon-btn:hover{transform:translateY(-1px); border-color:var(--accent); background:var(--panel2)}
.icon-btn:active{transform:translateY(0) scale(.98)}
.icon-btn svg{width:18px; height:18px}
.mobile-only{display:none}
.desktop-only{display:flex}
.action-shell{position:relative; flex:0 0 auto}
.action-menu{
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  min-width:220px;
  padding:8px;
  border:var(--thin-strong);
  border-radius:12px;
  background:rgba(33,30,50,.98);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  display:none;
  z-index:60;
}
.action-menu.open{display:flex; flex-direction:column; gap:6px}
.action-menu button{
  width:100%;
  justify-content:flex-start;
  padding:11px 13px;
  border-radius:10px;
}
.action-menu .hint{
  padding:8px 10px 2px;
  font-size:11px;
  color:var(--muted-dim);
}
.profile-body{
  display:flex;
  gap:14px;
  align-items:flex-start;
  padding:4px 0 2px;
}
.profile-avatar{
  width:60px;
  height:60px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background: linear-gradient(150deg, rgba(123,111,224,.3), rgba(255,82,119,.18));
  border:1px solid rgba(123,111,224,.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
  font-family: var(--font-display);
  font-weight:800;
  color:var(--accent);
  font-size:18px;
  flex:0 0 auto;
}
.profile-lines{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.profile-lines .label{
  font-size:11px;
  color:var(--muted-dim);
  letter-spacing:.12em;
  text-transform:uppercase;
  font-weight:700;
}
.profile-lines .value{
  font-size:14px;
  color:var(--ink);
  font-weight:700;
  word-break:break-word;
}
.modal-actions.tight{justify-content:space-between}
.modal-actions.tight .btn{flex:1}

.quick-actions-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.quick-action{
  min-height:54px;
  width:100%;
}

/* Když je poslední položka v lichém počtu, vycentruje se na posledním řádku */
.quick-actions-grid > .quick-action:last-child:nth-child(odd){
  grid-column:1 / -1;
  justify-self:center;
  width:calc((100% - 12px) / 2);
}

.quick-actions-entry{
  width:100%;
  background-color: rgba(245,197,66,.1);
}

.devices-card{
  width:min(720px, 100%);
}
.requests-card{
  width:min(860px, 100%);
}
.admin-card{
  width:min(1040px, 100%);
}
.devices-toolbar{
  display:flex;
  justify-content:flex-end;
  margin-bottom:12px;
}
.devices-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.devices-loading,
.devices-empty{
  padding:18px;
  border:var(--thin);
  border-radius:14px;
  background:var(--surface-2);
  color:var(--muted);
  text-align:center;
}
.device-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:16px;
  border:var(--thin);
  border-radius:16px;
  background:var(--surface-2);
}
.device-row.current{
  border-color:rgba(123,111,224,.45);
  background:rgba(123,111,224,.08);
}
.device-main{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.device-title{
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:var(--muted-dim);
}
.device-name{
  font-size:16px;
  font-weight:800;
  color:var(--ink);
}
.device-meta{
  font-size:13px;
  color:var(--muted);
  line-height:1.45;
  word-break:break-word;
}
.device-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
  flex:0 0 auto;
}
.device-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:0 10px;
  border-radius:999px;
  background:rgba(123,111,224,.12);
  color:var(--accent);
  border:1px solid rgba(123,111,224,.2);
  font-size:12px;
  font-weight:800;
}
.requests-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}
.request-column,
.admin-column{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.request-column h4,
.admin-section h4{
  margin:0;
  font-size:14px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.12em;
}
.request-list,
.admin-list,
.admin-detail{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.request-item,
.admin-row,
.admin-request-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px;
  border:var(--thin);
  border-radius:16px;
  background:var(--surface-2);
}
.request-actions,
.admin-detail-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.admin-layout{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:16px;
}
.admin-detail-card{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:16px;
  border:var(--thin);
  border-radius:16px;
  background:var(--surface-2);
}
.admin-chat-body{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.admin-msg{
  padding:12px;
  border:var(--thin);
  border-radius:14px;
  background:var(--surface-2);
}
.admin-msg .meta{display:flex; justify-content:space-between; gap:8px; color:var(--muted-dim); font-size:12px; margin-bottom:8px}
.admin-msg .text{color:var(--ink); font-size:14px; line-height:1.45; white-space:pre-wrap; word-break:break-word}
@media (max-width: 640px){
  .device-row{
    flex-direction:column;
  }
  .device-actions{
    align-items:flex-start;
    width:100%;
  }
  .device-actions .btn{
    width:100%;
  }
}

.context-menu{
  position:fixed;
  z-index:12000;
  min-width:220px;
  max-width:min(92vw, 320px);
  padding:8px;
  border:var(--thin-strong);
  border-radius:12px;
  background:rgba(33,30,50,.98);
  box-shadow:var(--shadow-lg);
  backdrop-filter:blur(20px);
  display:flex;
  flex-direction:column;
  gap:6px;
}
.context-menu-item{
  appearance:none;
  border:none;
  background:transparent;
  width:100%;
  text-align:left;
  padding:11px 12px;
  border-radius:10px;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:2px;
  transition:.14s ease;
}
.context-menu-item:hover{
  background:var(--surface-2);
}
.context-menu-item.danger:hover{
  background:rgba(248,113,113,.1);
}
.context-menu-label{
  font-weight:700;
  color:var(--ink);
}
.context-menu-hint{
  font-size:11px;
  color:var(--muted-dim);
}
.context-menu-item.danger .context-menu-label{
  color:var(--danger);
}

.content{
  display:grid;
  grid-template-columns: 1fr 320px;
  min-height:0;
  overflow:hidden;
}
.content.call-mode{
  grid-template-columns: 1fr;
}
.content.call-mode .sidepanel{
  display:none;
}

/* ==========================================================================
   Chat pane
   ========================================================================== */
.chatpane{
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  padding:18px;
  gap:14px;
  width:100%;
  max-width:960px;
  margin:0 auto;
}
.messages{
  flex:1;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:20px;
  border:var(--thin);
  border-radius:var(--radius);
  background:
    radial-gradient(rgba(123,111,224,.08) 1px, transparent 1px),
    var(--surface);
  background-size: 22px 22px, auto;
  box-shadow: var(--shadow);
  scroll-behavior:auto;
  display:flex;
  flex-direction:column;
}
.msg{
  position:relative;
  max-width:min(72%, 560px);
  margin:0 0 16px;
  padding:12px 15px;
  border-radius:12px;
  background: var(--bubble-in);
  border:1px solid var(--bubble-in-line);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.msg::after{
  content:'';
  position:absolute;
  bottom:6px;
  width:0; height:0;
  border:7px solid transparent;
}
.msg:not(.me)::after{
  left:-6px;
  border-right-color: var(--bubble-in);
  border-bottom-color: var(--bubble-in);
  border-left:0;
  border-top:0;
}
.msg.me{
  margin-left:auto;
  background: var(--bubble-me);
  border-color: var(--bubble-me-line);
  color:#fff;
  box-shadow: 0 8px 22px rgba(123,111,224,.4), inset 0 1px 0 rgba(255,255,255,.15);
}
.msg.system{
  margin-left:auto;
  margin-right:auto;
  max-width:min(86%, 620px);
  background: rgba(245,197,66,.08);
  color: var(--ink);
  border-style:dashed;
  text-align:center;
}
.msg.system::after{display:none}
.msg.system .meta{
  justify-content:center;
}
.msg.system .text{
  font-weight:600;
}
.msg.me::after{
  right:-6px;
  border-left-color: var(--bubble-me);
  border-bottom-color: var(--bubble-me);
  border-right:0;
  border-top:0;
}
.msg .meta{
  display:flex;
  justify-content:space-between;
  gap:14px;
  margin-bottom:6px;
  font-size:11px;
  color:var(--muted-dim);
  letter-spacing:.02em;
}
.msg.me .meta{ color: rgba(255,255,255,.7) }
.msg .text{
  white-space:pre-wrap;
  line-height:1.5;
  word-break:break-word;
  font-size:14.5px;
}

.empty{
  position:relative;
  display:grid;
  place-items:center;
  min-height:100%;
  flex:1;
  text-align:center;
  color:var(--muted);
  padding:24px;
}
.empty::before{
  content:'';
  position:absolute;
  width:220px; height:220px;
  border-radius:50%;
  background: radial-gradient(circle, rgba(123,111,224,.15), rgba(255,82,119,.08) 60%, transparent 72%);
  pointer-events:none;
}
.empty h3{font-family: var(--font-display); color:var(--ink); margin:0 0 8px; position:relative; font-size:17px; font-weight:800}
.empty div{position:relative}

/* ==========================================================================
   Composer
   ========================================================================== */
.composer{
  border:var(--thin-strong);
  border-radius:var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding:14px 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:0 0 auto;
}
.composer textarea{
  min-height:64px;
  max-height:220px;
  resize:vertical;
  overflow-y:auto;
  border-radius:10px;
  border:var(--thin);
  background: var(--surface-2);
  color:var(--text);
  padding:14px 16px;
  outline:none;
  line-height:1.5;
  transition:.15s ease;
}
.composer textarea::placeholder{color:var(--muted-dim)}
.composer textarea:focus{border-color: var(--accent); box-shadow: var(--glow); background:var(--surface)}
.composer textarea:disabled{opacity:.5}
.composer-readonly{
  padding:16px;
  border:var(--thin);
  border-radius:18px;
  background:var(--surface-2);
  margin-top:14px;
}
.composer-row{display:flex; justify-content:space-between; gap:10px; align-items:center}
.composer-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.call-btn{min-width:92px}
.btn.secondary.call-btn{background: rgba(52,211,153,.1); color: var(--success); border:1px solid rgba(52,211,153,.25);}
.btn.secondary.call-btn:hover{background: rgba(52,211,153,.18)}
#sendBtn{padding:12px 22px}
#sendBtn::before{
  content:'';
  width:0; height:0;
  border-top:5px solid transparent;
  border-bottom:5px solid transparent;
  border-left:8px solid currentColor;
  flex:0 0 auto;
}

.small{
  font-size:12.5px;
  color:var(--muted);
}

/* ==========================================================================
   Right details panel
   ========================================================================== */
.sidepanel{
  border-left:var(--thin-strong);
  background: rgba(27,24,40,.5);
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:0;
  overflow-y:auto;
  scroll-behavior:smooth;
}
.card{
  border:var(--thin);
  border-radius:var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding:16px;
  flex:0 0 auto;
}
.card h4{font-family: var(--font-display); margin:0 0 12px; font-size:13.5px; font-weight:800; letter-spacing:.01em; color:var(--ink)}
.card .stack{display:flex; flex-direction:column; gap:10px}

.mini-input, .mini-textarea{
  width:100%;
  border-radius:10px;
  border:var(--thin);
  background: var(--surface-2);
  color:var(--text);
  padding:11px 13px;
  outline:none;
}
.mini-input:focus, .mini-textarea:focus{border-color: var(--accent); box-shadow: var(--glow); background:var(--surface)}
.mini-textarea{min-height:88px; resize:vertical}

/* ==========================================================================
   Auth / login screen
   ========================================================================== */
.login-wrap{
  min-height:100vh;
  min-height:100dvh;
  display:grid;
  place-items:center;
  padding:28px 24px;
  overflow-y:auto;
}
.auth{
  width:min(1000px, 100%);
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:20px;
  align-items:stretch;
}
.hero{
  padding:32px;
  border:var(--thin-strong);
  border-radius:var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(123,111,224,.2), transparent 32%),
    radial-gradient(circle at bottom left, rgba(255,82,119,.15), transparent 36%),
    var(--surface);
  box-shadow: var(--shadow-lg);
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.hero h1{
  font-family: var(--font-display);
  font-size:52px;
  line-height:.98;
  margin:0 0 16px;
  letter-spacing:-.03em;
  font-weight:800;
  background: linear-gradient(135deg, var(--ink) 35%, var(--gold) 75%, var(--raspberry) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p{margin:0 0 18px; color:var(--muted); max-width:58ch; line-height:1.6}
.pillrow{display:flex; flex-wrap:wrap; gap:10px; margin-top:6px}
.pill{
  padding:10px 15px;
  border-radius:999px;
  background: rgba(123,111,224,.12);
  border:1px solid rgba(123,111,224,.25);
  color:var(--accent);
  font-size:12px;
  font-weight:700;
}
.authbox{
  padding:26px;
  border:var(--thin-strong);
  border-radius:var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display:flex;
  flex-direction:column;
  gap:16px;
  justify-content:center;
}
.tabs{display:flex; gap:8px; background:var(--surface-2); padding:5px; border-radius:10px; border:var(--thin)}
.tab{
  flex:1;
  text-align:center;
  padding:11px;
  border-radius:8px;
  color:var(--muted);
  cursor:pointer;
  user-select:none;
  font-weight:700;
  font-size:13.5px;
  transition:.15s ease;
}
.tab.active{
  background: var(--surface);
  color:var(--gold);
  box-shadow: inset 0 0 0 1px rgba(245,197,66,.3), 0 4px 12px rgba(245,197,66,.15);
}
.field{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.field label{font-size:12px; color:var(--muted); font-weight:700; letter-spacing:.02em}
.field input{
  width:100%;
  border-radius:10px;
  border:var(--thin);
  background: var(--surface-2);
  color:var(--text);
  padding:13px 14px;
  outline:none;
  transition:.15s ease;
}
.field input::placeholder{color:var(--muted-dim)}
.field input:focus{border-color: var(--accent); box-shadow: var(--glow); background:var(--surface)}
.status{
  min-height:20px;
  font-size:13px;
  color:var(--muted);
}
.status.err{color: var(--danger)}
.status.ok{color: var(--success)}
.badge-k{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 13px; border-radius:999px;
  background: rgba(245,197,66,.1); border:1px solid rgba(245,197,66,.25);
  color:var(--gold); font-size:12px; font-weight:700;
  margin-bottom:18px;
  width:fit-content;
}

/* ==========================================================================
   Call screen
   ========================================================================== */
.call-screen{
  flex:1;
  min-height:0;
  display:grid;
  place-items:center;
  padding:18px;
}
.call-card{
  width:min(540px, 100%);
  border:var(--thin-strong);
  border-radius:var(--radius-lg);
  background:
    radial-gradient(circle at top right, rgba(123,111,224,.2), transparent 30%),
    radial-gradient(circle at bottom left, rgba(255,82,119,.12), transparent 34%),
    var(--surface);
  box-shadow: var(--shadow-lg);
  padding:24px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  text-align:center;
}
.call-avatar{
  width:84px;
  height:84px;
  border-radius:20px;
  display:grid;
  place-items:center;
  background: linear-gradient(150deg, rgba(123,111,224,.35), rgba(255,82,119,.2));
  border:1px solid rgba(123,111,224,.3);
  color:var(--accent);
  font-family: var(--font-display);
  font-weight:800;
  font-size:28px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.call-copy h3{
  margin:0;
  font-size:28px;
  line-height:1.05;
  font-family: var(--font-display);
  color:var(--ink);
}
.call-kicker{
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--muted-dim);
  font-weight:700;
}
.call-status{
  color:var(--muted);
  font-size:14px;
  font-weight:700;
}
.call-timer{
  font-size:34px;
  font-weight:800;
  letter-spacing:-.04em;
  font-family: var(--font-display);
  color:var(--gold);
}
.call-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
}
.call-actions .btn{
  min-width:120px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-host{
  position:fixed;
  left:50%;
  bottom:22px;
  transform:translateX(-50%);
  display:flex;
  flex-direction:column-reverse;
  align-items:center;
  gap:8px;
  z-index:9999;
  pointer-events:none;
}
.toast{
  background: var(--ink);
  color: #12101C;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 11px 18px;
  font-size:13.5px;
  font-weight:500;
  box-shadow: var(--shadow-lg);
  opacity:0;
  transform:translateY(10px);
  transition: .18s ease;
  max-width:min(86vw, 420px);
  text-align:center;
}
.toast.show{
  opacity:1;
  transform:translateY(0);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay{
  position:fixed;
  inset:0;
  background: rgba(12,10,20,.65);
  backdrop-filter: blur(12px);
  display:grid;
  place-items:center;
  padding:18px;
  z-index: 10000;
}
.modal-card{
  width:min(520px, 100%);
  max-height:min(88vh, 720px);
  overflow-y:auto;
  border: var(--thin-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 20px;
}
.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding-bottom:16px;
  border-bottom: var(--thin);
  margin-bottom:16px;
}
.modal-head h3{
  font-family: var(--font-display);
  margin:0;
  font-size:21px;
  font-weight:800;
  color:var(--ink);
}
.modal-head p{
  margin:7px 0 0;
  color: var(--muted);
  font-size:13px;
  line-height:1.5;
}
.modal-close{
  width:38px;
  height:38px;
  border-radius:10px;
  border: var(--thin);
  background: var(--surface-2);
  color: var(--ink);
  cursor:pointer;
  font-size:22px;
  line-height:1;
  flex:0 0 auto;
  transition:.15s ease;
}
.modal-close:hover{ border-color:var(--accent); background:rgba(123,111,224,.15); color:var(--accent) }
.modal-form{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.modal-body{
  display:flex;
  flex-direction:column;
  gap:14px;
}
.modal-field{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.modal-field span{
  font-size:12px;
  color: var(--muted);
  letter-spacing:.02em;
  font-weight:700;
}
.modal-field input,
.modal-field textarea{
  width:100%;
  border-radius:10px;
  border: var(--thin);
  background: var(--surface-2);
  color: var(--text);
  padding:12px 14px;
  outline:none;
  resize: vertical;
}
.modal-field input::placeholder,
.modal-field textarea::placeholder{color:var(--muted-dim)}
.modal-field input:focus,
.modal-field textarea:focus{
  border-color: var(--accent);
  box-shadow: var(--glow);
  background:var(--surface);
}
.modal-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.modal-actions.tight{justify-content:space-between}
.modal-actions.tight .btn{flex:1}

/* ==========================================================================
   Responsive (unchanged layout, only background adjustments)
   ========================================================================== */
@media (max-width: 1180px){
  .app{grid-template-columns: 296px 1fr}
}

@media (max-width: 1020px){
  .content{grid-template-columns: 1fr}
  .sidepanel{display:none}
}

@media (max-width: 860px){
  .mobile-only{display:grid}
  .desktop-only{display:none}
  .top-actions{gap:8px}
  .topbar{align-items:flex-start}
  .toolbar{display:none}
  .userbox{
    display:flex;
    padding:12px;
  }
  .search{order:3}
  .sidebar-scroll{order:2}
  .sidebar .search{
    position:sticky;
    bottom:0;
    z-index:6;
    box-shadow: 0 -10px 24px rgba(0,0,0,.3);
  }
  html,body{height:100%}
  body{
    overflow:hidden;
    background:
      radial-gradient(circle at top, rgba(123,111,224,.1), transparent 30%),
      var(--canvas);
  }

  .app{
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height:100vh;
    height:100dvh;
  }

  .sidebar{
    border-right:none;
    border-bottom:var(--thin-strong);
    min-width:0;
    padding:10px;
    gap:10px;
    max-height:38dvh;
    overflow:hidden;
    background: rgba(27,24,40,.98);
  }

  .brand{
    padding:12px 14px;
    border-radius:10px;
  }

  .userbox{
    padding:12px;
  }

  .search{
    padding:13px 14px 13px 42px;
    border-radius:10px;
  }

  .sidebar-scroll{
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:minmax(220px, 74vw);
    gap:10px;
    overflow-x:auto;
    overflow-y:hidden;
    padding:2px 2px 8px;
    scroll-snap-type:x proximity;
  }
  .sidebar-scroll > *{
    scroll-snap-align:start;
  }

  .section{
    min-width:0;
    margin-right:0;
  }
  .list{
    max-height:none;
  }
  .item{
    min-height:70px;
  }

  .main{
    min-height:0;
    display:grid;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .content{
    overflow:hidden;
    min-height:0;
    grid-row:1;
    grid-template-columns:1fr;
  }

  .topbar{
    grid-row:2;
    order:2;
    position:sticky;
    bottom:0;
    top:auto;
    z-index:20;
    flex-direction:column;
    align-items:stretch;
    gap:10px;
    padding:12px;
    border-top:var(--thin-strong);
    border-bottom:none;
    background: rgba(27,24,40,.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 -12px 30px rgba(0,0,0,.4);
  }

  .toolbar{
    display:none !important;
  }

  .toolbar .btn{
    width:100%;
    justify-content:center;
    padding:12px 10px;
    font-size:12px;
    border-radius:10px;
  }

  .chatpane{
    padding:10px;
    gap:10px;
  }

  .messages{
    padding:14px;
    border-radius:12px;
    min-height:0;
  }

  .msg{
    max-width:92%;
    border-radius:10px;
    margin-bottom:12px;
  }

  .composer{
    padding:12px;
    border-radius:12px;
    position:sticky;
    bottom:74px;
    z-index:10;
    background: rgba(27,24,40,.98);
    backdrop-filter: blur(16px);
  }

  .composer textarea{
    min-height:58px;
    border-radius:10px;
  }

  .composer-row{
    align-items:flex-start;
    flex-direction:column;
  }

  #sendBtn{
    width:100%;
    padding:13px 18px;
  }

  .auth{
    grid-template-columns:1fr;
    gap:14px;
  }

  .hero{
    padding:22px;
    border-radius:14px;
  }

  .hero h1{font-size:38px}

  .authbox{
    padding:18px;
    border-radius:14px;
  }

  .modal-card{
    width:min(96vw, 560px);
    max-height:90dvh;
    border-radius:14px;
  }

  .modal-body{
    max-height:calc(90dvh - 176px);
  }
  .mobile-chat-open .app{
    height:100dvh;
  }
  .mobile-chat-open .main{
    position:fixed;
    inset:0;
    z-index:40;
    width:100vw;
    height:100dvh;
    background:rgba(18,16,28,.96);
    backdrop-filter: blur(16px);
  }
  .mobile-chat-open .content{
    display:grid;
    grid-template-columns:1fr;
    overflow:hidden;
  }
  .mobile-chat-open .sidepanel{display:none}
  .mobile-chat-close{display:grid}
}

@media (max-width: 540px){
  .sidebar{
    max-height:42dvh;
  }

  .brand > div:first-child{
    padding-left:46px;
  }
  .brand > div:first-child::before{
    width:34px;
    height:34px;
  }

  .toolbar{
    display:none !important;
  }
  .toolbar .btn:last-child{
    grid-column:1 / -1;
  }

  .titleblock h2{
    font-size:17px;
  }
  .titleblock p{
    font-size:11.5px;
  }

  .msg{
    max-width:96%;
  }
}

.mobile-only{display:none}
.desktop-only{display:flex}

.top-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:auto;
}

.action-shell{
  position:relative;
  flex:0 0 auto;
}

.action-menu{
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  min-width:220px;
  padding:8px;
  border:var(--thin-strong);
  border-radius:12px;
  background:rgba(33,30,50,.98);
  box-shadow:var(--shadow-lg);
  backdrop-filter:blur(20px);
  display:none;
  z-index:60;
}

.action-menu.open{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.action-menu button{
  width:100%;
  justify-content:flex-start;
  padding:11px 13px;
  border-radius:10px;
}

@media (max-width: 860px){
  .mobile-only{display:grid}
  .desktop-only{display:none !important}

  .sidebar{
    height:100dvh;
    max-height:none;
    padding:10px;
  }

  .userbox{display:none}

  .sidebar-scroll{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:10px;
    padding-bottom:12px;
  }

  .search{
    position:sticky;
    bottom:0;
    z-index:8;
    margin-top:auto;
  }
  .quick-actions-entry{
    margin-top:2px;
  }

  .mobile-no-chat .main{
    display:none;
  }

  .mobile-chat-open .sidebar{
    display:none;
  }

  .mobile-chat-open .main{
    position:fixed;
    inset:0;
    z-index:40;
    width:100vw;
    height:100dvh;
    display:grid;
    grid-template-rows:auto 1fr;
    background:rgba(18,16,28,.96);
    backdrop-filter:blur(16px);
  }

  .mobile-chat-open .content{
    grid-template-columns:1fr;
    height:100%;
    overflow:hidden;
  }

  .mobile-chat-open .sidepanel{
    display:none;
  }

  .mobile-chat-open .content.call-mode{
    grid-template-columns:1fr;
  }

  .mobile-chat-open .chatpane{
    padding:8px 8px calc(8px + env(safe-area-inset-bottom));
    gap:8px;
    max-width:none;
  }

  .mobile-chat-open .messages{
    margin:0;
    min-height:0;
    padding:14px;
  }

  .mobile-chat-open .composer{
    position:sticky;
    bottom:0;
    z-index:12;
    margin-top:0;
    padding:10px;
  }

  .mobile-chat-open .composer textarea{
    min-height:54px;
  }

  .action-menu{
    position:fixed;
    inset:0;
    padding:72px 14px 14px;
    background:rgba(12,10,20,.8);
    backdrop-filter:blur(16px);
    z-index:3000;
    overflow:auto;
    pointer-events:auto;
  }

  .action-menu.open{
    display:flex;
    flex-direction:column;
    gap:10px;
  }

  .action-menu .hint{
    color:#fff;
    opacity:.75;
    padding:8px 10px 0;
  }

  .action-menu button{
    min-height:54px;
  }
}

@media (max-width: 540px){
  .sidebar{
    height:100dvh;
    max-height:none;
  }

  .chatpane{
    padding:8px;
  }

  .messages{
    padding:12px;
  }

  .msg{
    max-width:96%;
  }
}
@media (max-width: 540px){
  .call-card{
    padding:18px;
  }
  .call-copy h3{
    font-size:24px;
  }
  .call-timer{
    font-size:28px;
  }
  .composer-actions{
    width:100%;
    justify-content:space-between;
  }
  .call-btn{
    flex:1;
  }
}


/* OneChat calls */
.composer-actions{display:flex; gap:10px; align-items:center; justify-content:flex-end; flex-wrap:wrap;}
.call-btn{min-width:92px;}
.call-overlay{position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; padding:18px; background:rgba(8,6,16,.82); backdrop-filter:blur(18px);}
.call-card{width:min(540px, 100%); border:var(--thin-strong); border-radius:20px; background:linear-gradient(180deg, rgba(33,30,50,.98), rgba(27,24,40,.96)); box-shadow:var(--shadow-lg); padding:22px; display:flex; flex-direction:column; gap:16px;}
.call-top{display:flex; align-items:center; gap:14px;}
.call-avatar{width:60px; height:60px; border-radius:16px; display:grid; place-items:center; font-family:var(--font-display); font-weight:800; font-size:20px; color:white; background:linear-gradient(135deg, var(--accent), var(--raspberry)); box-shadow:0 14px 30px rgba(123,111,224,.4); flex:0 0 auto;}
.call-head{min-width:0; flex:1 1 auto;}
.call-name{font-family:var(--font-display); font-size:22px; font-weight:800; letter-spacing:-.02em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.call-status{margin-top:4px; color:var(--muted); font-size:14px;}
.call-close-wrap{display:flex; justify-content:flex-end;}
.call-x{width:42px; height:42px; border-radius:10px;}
.call-timer{font-family:var(--font-display); font-size:44px; font-weight:800; letter-spacing:-.03em; text-align:center; padding:4px 0; color:var(--gold);}

.call-voice-panel{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  border-radius:14px;
  border:var(--thin);
  background: rgba(255,255,255,.04);
}
.call-voice-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.call-voice-title{
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.call-audio-state{
  font-size:12.5px;
  color:var(--muted);
  text-align:right;
}
.call-audio-state[data-tone="live"]{color:#34D399;}
.call-audio-state[data-tone="connecting"]{color:#9A8FFF;}
.call-audio-state[data-tone="blocked"]{color:#F5C542;}
.call-audio-state[data-tone="error"]{color:#F87171;}

.call-visualizer{
  width:100%;
  height:140px;
  display:block;
  border-radius:14px;
  border:1px solid rgba(123,111,224,.18);
  background: linear-gradient(180deg, rgba(123,111,224,.1), rgba(123,111,224,.02));
}

.call-actions{display:flex; gap:10px; justify-content:center; flex-wrap:wrap;}
.call-audio{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
  left:-9999px;
}

@media (max-width: 860px){
  .call-card{width:100%; padding:18px;}
  .call-name{font-size:20px;}
  .call-timer{font-size:36px;}
  .composer-actions{width:100%; justify-content:space-between;}
  .call-btn{flex:1 1 auto;}
  .call-voice-panel{padding:12px;}
  .call-visualizer{height:112px;}
}


/* ==========================================================================
   Mobile chat fix — topbar nahoře, composer dole
   ========================================================================== */
@media (max-width: 860px){
  .modal-overlay{
    padding:0;
    place-items:stretch;
  }
  .modal-card{
    width:100%;
    max-height:100vh;
    border-radius:0;
  }
  .requests-grid,
  .admin-layout{
    grid-template-columns:1fr;
  }
  .request-item,
  .admin-row,
  .admin-request-row,
  .device-row{
    flex-direction:column;
    align-items:stretch;
  }
  .request-actions,
  .admin-detail-actions,
  .device-actions{
    justify-content:stretch;
    align-items:stretch;
  }
  .request-actions .btn,
  .admin-detail-actions .btn,
  .device-actions .btn{
    width:100%;
  }
  .mobile-chat-open .main{
    grid-template-rows: auto 1fr !important;
  }

  .mobile-chat-open .topbar{
    grid-row: 1 !important;
    position: sticky !important;
    top: 0 !important;
    bottom: auto !important;
    z-index: 25 !important;
    border-top: none !important;
    border-bottom: var(--thin-strong) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.25) !important;
  }

  .mobile-chat-open .content{
    grid-row: 2 !important;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-chat-open .chatpane{
    min-height: 0;
    height: 100%;
  }

  .mobile-chat-open .composer{
    position: sticky !important;
    bottom: 0 !important;
    z-index: 15 !important;
    margin-top: auto;
  }
}

/* ==========================================================================
   KRAYI SOCIAL LAYER
   Mobile-first: glass, cinematic forest-black, ruby + gold.
   ========================================================================== */
:root{
  --kr-bg:#101415;
  --kr-surface:#171b1d;
  --kr-surface-2:#1d2022;
  --kr-surface-3:#272a2c;
  --kr-text:#e0e3e5;
  --kr-muted:#e4bdc2;
  --kr-outline:rgba(255,255,255,.08);
  --kr-pink:#ffb2be;
  --kr-ruby:#e0115f;
  --kr-gold:#ffdb3c;
  --kr-teal:#5b7972;
}
.krayi-shell{height:100dvh;min-height:0;background:
 radial-gradient(circle at 5% 0%,rgba(224,17,95,.13),transparent 32%),
 radial-gradient(circle at 95% 10%,rgba(255,219,60,.08),transparent 26%),
 linear-gradient(180deg,#101415,#0d1112 78%,#101415);color:var(--kr-text);overflow:auto;padding-bottom:78px}
.krayi-topbar{position:sticky;top:0;z-index:80;height:64px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid var(--kr-outline);background:rgba(16,20,21,.76);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)}
.kr-logo{border:0;background:none;color:var(--kr-pink);font-weight:800;font-size:27px;letter-spacing:-.07em;text-shadow:0 0 15px rgba(255,178,190,.24);cursor:pointer}
.kr-top-actions{display:flex;gap:8px;align-items:center}.kr-icon{width:38px;height:38px;border:0;border-radius:12px;background:transparent;color:var(--kr-text);display:grid;place-items:center;font-size:22px;cursor:pointer}.kr-icon:hover{background:rgba(255,255,255,.06);color:var(--kr-pink)}
.kr-avatar-mini{font-size:13px;border:1px solid rgba(255,178,190,.2);background:linear-gradient(135deg,rgba(224,17,95,.65),rgba(91,121,114,.4));font-weight:800}
.krayi-main{width:min(720px,100%);margin:0 auto;padding:22px 16px 40px}
.krayi-page{animation:krFade .24s ease}.krayi-heading{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;margin:4px 0 18px}.krayi-heading h1{margin:2px 0 0;font-size:31px;line-height:1.1;letter-spacing:-.055em}.krayi-heading p{margin:6px 0 0;color:rgba(228,189,194,.78);font-size:14px}.kr-eyebrow{font-size:10px;letter-spacing:.19em;color:var(--kr-gold);font-weight:800}
.kr-pill,.kr-primary,.kr-secondary{border:1px solid var(--kr-outline);border-radius:12px;padding:10px 14px;font-weight:700;cursor:pointer;transition:.16s ease}.kr-primary{background:linear-gradient(135deg,var(--kr-ruby),#bc004d);color:white;border-color:rgba(255,178,190,.15);box-shadow:0 10px 28px rgba(224,17,95,.18)}.kr-primary:hover{filter:brightness(1.08);transform:translateY(-1px)}.kr-secondary,.kr-pill{background:rgba(255,255,255,.04);color:var(--kr-text)}.kr-secondary.active,.kr-pill:hover{border-color:rgba(255,178,190,.3);background:rgba(224,17,95,.09)}
.kr-feed-tabs{display:flex;gap:4px;background:rgba(255,255,255,.035);padding:4px;border-radius:14px;margin-bottom:14px}.kr-feed-tabs button{flex:1;border:0;background:transparent;color:#9ea6aa;border-radius:10px;padding:10px;font-weight:700;cursor:pointer}.kr-feed-tabs button.active{background:rgba(255,255,255,.07);color:var(--kr-pink)}
.kr-feed-list{display:flex;flex-direction:column;gap:14px}.kr-post{background:linear-gradient(180deg,rgba(29,32,34,.87),rgba(20,24,25,.92));border:1px solid var(--kr-outline);border-radius:20px;padding:14px;box-shadow:0 14px 35px rgba(0,0,0,.18);backdrop-filter:blur(18px)}.kr-post-head{display:flex;justify-content:space-between;gap:10px;align-items:center}.kr-user-hit{display:flex;align-items:center;gap:10px;border:0;background:none;color:inherit;padding:0;text-align:left;cursor:pointer;min-width:0}.kr-user-hit span:last-child{display:flex;flex-direction:column;min-width:0}.kr-user-hit b{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kr-user-hit small{color:#949ca0;font-size:11px;margin-top:2px}.kr-more{border:0;background:none;color:#8f989c;font-size:15px;cursor:pointer}.kr-avatar{width:42px;height:42px;border-radius:14px;display:grid;place-items:center;flex:0 0 auto;background:linear-gradient(135deg,rgba(224,17,95,.75),rgba(91,121,114,.55));border:1px solid rgba(255,255,255,.1);color:#fff;font-weight:800;object-fit:cover}
.kr-post-text{font-size:16px;line-height:1.52;margin:13px 0 8px;word-break:break-word}.kr-tags{font-size:13px;color:var(--kr-pink);margin-bottom:10px;word-break:break-word}.kr-location{font-size:12px;color:#9ba5a9;margin-bottom:10px}.kr-post-media{display:block;width:100%;max-height:520px;object-fit:cover;border-radius:16px;margin:9px 0;background:#0a0d0e}.kr-music{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid rgba(255,219,60,.13);background:rgba(255,219,60,.05);border-radius:12px;color:#ffe788;font-size:12px}.kr-repost-label{font-size:12px;color:#aebcb9;margin-top:10px}.kr-post-stats{display:flex;gap:13px;color:#7f898d;font-size:11px;padding:11px 0 8px}.kr-post-actions{display:flex;justify-content:space-between;border-top:1px solid var(--kr-outline);padding-top:8px}.kr-post-actions button{width:42px;height:38px;border:0;background:transparent;border-radius:10px;color:#9ba4a8;font-size:19px;cursor:pointer}.kr-post-actions button:hover{background:rgba(255,255,255,.05);color:var(--kr-pink)}.kr-post-actions button.active{color:var(--kr-pink);text-shadow:0 0 12px rgba(255,178,190,.35)}.kr-comments{display:flex;flex-direction:column;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid var(--kr-outline);font-size:12px;color:#adb5b8}.kr-verified{display:inline-grid;place-items:center;width:15px;height:15px;border-radius:50%;background:var(--kr-gold);color:#3e3100;font-size:10px;font-weight:900}.kr-verified.big{width:19px;height:19px}
.kr-empty{padding:58px 20px;text-align:center;border:1px dashed rgba(255,255,255,.1);border-radius:20px;background:rgba(255,255,255,.02)}.kr-empty.compact{padding:32px 16px}.kr-empty-icon{font-size:40px;color:var(--kr-gold)}.kr-empty h3{margin:10px 0 5px}.kr-empty p{margin:0 0 18px;color:#8c969a}
.krayi-bottom-nav{position:fixed;left:0;right:0;bottom:0;height:70px;z-index:100;display:grid;grid-template-columns:repeat(5,1fr);background:rgba(12,16,17,.84);border-top:1px solid rgba(255,255,255,.08);backdrop-filter:blur(20px);padding-bottom:env(safe-area-inset-bottom)}.krayi-bottom-nav button{border:0;background:none;color:#7f898d;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;cursor:pointer}.krayi-bottom-nav button span{font-size:22px;line-height:1}.krayi-bottom-nav button small{font-size:10px;font-weight:700;letter-spacing:.02em}.krayi-bottom-nav button.active{color:var(--kr-pink)}
.kr-search{width:100%;height:50px;padding:0 16px;border-radius:15px;border:1px solid var(--kr-outline);background:rgba(255,255,255,.04);color:var(--kr-text);outline:none}.kr-search:focus{border-color:rgba(255,178,190,.35);box-shadow:0 0 0 3px rgba(224,17,95,.08)}.kr-search-results{display:flex;flex-direction:column;margin-top:12px;gap:6px}.kr-search-user{width:100%;display:flex;align-items:center;gap:10px;padding:10px;border:1px solid transparent;background:transparent;border-radius:14px;color:inherit;text-align:left;cursor:pointer}.kr-search-user:hover{background:rgba(255,255,255,.04);border-color:var(--kr-outline)}.kr-search-user span{min-width:0;flex:1;display:flex;flex-direction:column}.kr-search-user small{font-size:11px;color:#8e979b}.kr-search-user i{font-style:normal;color:var(--kr-pink);font-size:11px}
.kr-create-card{background:linear-gradient(180deg,rgba(29,32,34,.88),rgba(17,21,22,.92));border:1px solid var(--kr-outline);border-radius:20px;padding:16px}.kr-create-user{display:flex;gap:10px;align-items:center;margin-bottom:12px}.kr-create-user>div:last-child{display:flex;flex-direction:column}.kr-create-user small{color:#8e979b;margin-top:2px}.kr-compose{width:100%;min-height:170px;resize:vertical;border:0;outline:0;background:transparent;color:var(--kr-text);font:inherit;font-size:17px;line-height:1.5}.kr-media-preview img,.kr-media-preview video{width:100%;max-height:380px;object-fit:cover;border-radius:14px;margin:10px 0}.kr-create-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding-top:10px;border-top:1px solid var(--kr-outline)}.file-label{cursor:pointer}.kr-inline-input{flex:1;min-width:160px;border:1px solid var(--kr-outline);background:rgba(255,255,255,.03);color:var(--kr-text);border-radius:12px;padding:11px 12px;outline:none}.kr-helper{margin-top:10px;font-size:11px;color:#717a7e}
.kr-profile-hero{overflow:hidden;border:1px solid var(--kr-outline);border-radius:22px;background:linear-gradient(180deg,rgba(29,32,34,.88),rgba(17,21,22,.94))}.kr-banner{height:180px;background:linear-gradient(135deg,#2b111d,#183b35);background-size:cover;background-position:center}.kr-profile-core{padding:0 16px 18px;margin-top:-42px}.kr-profile-avatar{width:88px;height:88px;border-radius:25px;border:4px solid #101415;font-size:22px}.kr-profile-name{font-size:27px;font-weight:800;letter-spacing:-.05em;margin-top:10px}.kr-profile-handle{color:#a3abad;font-size:13px}.kr-profile-id{display:inline-block;margin-top:7px;padding:5px 9px;background:rgba(255,219,60,.08);border:1px solid rgba(255,219,60,.14);border-radius:9px;color:#ffe88c;font-size:10px;font-weight:800;letter-spacing:.08em}.kr-bio{font-size:14px;line-height:1.5;color:#ccd2d4;white-space:pre-wrap}.kr-links{display:flex;gap:8px;flex-wrap:wrap}.kr-links a{font-size:11px;color:var(--kr-pink);text-decoration:none;padding:6px 8px;border-radius:9px;background:rgba(224,17,95,.07);border:1px solid rgba(224,17,95,.14)}.kr-profile-stats{display:flex;gap:23px;margin:18px 0}.kr-profile-stats b{font-size:17px}.kr-profile-stats span{display:block;color:#858f93;font-size:10px;font-weight:500;margin-top:2px}.kr-profile-actions{display:flex;gap:8px}.kr-profile-actions button{flex:1}.kr-section-title{display:flex;align-items:center;justify-content:space-between;margin:24px 2px 10px}.kr-section-title h2{font-size:17px;margin:0}
@keyframes krFade{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
@media (min-width:861px){
 .krayi-shell{padding-bottom:0}.krayi-main{padding:38px 24px 60px}.krayi-bottom-nav{width:620px;left:50%;right:auto;transform:translateX(-50%);border:1px solid rgba(255,255,255,.08);border-bottom:0;border-radius:18px 18px 0 0}.mobile-menu-btn{display:none}
}
@media (max-width:520px){
 .krayi-heading h1{font-size:27px}.kr-profile-actions{flex-wrap:wrap}.kr-profile-actions button{min-width:0}.kr-post{border-radius:17px}.kr-post-media{max-height:440px}.kr-banner{height:150px}
}
\n/* KRAYI Section 02: compact media, stories, notification UI */\n.kr-media-preview{display:flex;justify-content:center;min-height:0;margin:10px 0}.kr-preview-card{width:min(100%,360px);border:1px solid var(--kr-outline);background:rgba(255,255,255,.028);border-radius:16px;padding:10px;overflow:hidden;box-shadow:0 8px 24px rgba(0,0,0,.15)}.kr-preview-head{display:flex;justify-content:space-between;align-items:center;color:#b8c0c3;font-size:11px;text-transform:uppercase;letter-spacing:.08em;margin-bottom:8px}.kr-preview-head button{border:0;background:rgba(255,255,255,.07);color:#fff;border-radius:8px;width:26px;height:26px;cursor:pointer}.kr-preview-card img,.kr-preview-card video{display:block;width:100%;height:190px;max-height:190px;object-fit:contain;background:#070909;border-radius:12px}.kr-preview-card small{display:block;color:#737d81;font-size:10px;margin-top:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kr-profile-uploaders{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 14px}.kr-upload-box{border:1px solid var(--kr-outline);border-radius:14px;padding:10px;background:rgba(255,255,255,.025);display:flex;flex-direction:column;gap:8px}.kr-upload-box>span{font-size:11px;color:#adb5b8}.kr-upload-thumb{height:68px;border-radius:10px;overflow:hidden;background:#090c0d;border:1px solid rgba(255,255,255,.06);display:grid;place-items:center}.kr-upload-thumb.banner{height:58px}.kr-upload-thumb img{width:100%;height:100%;object-fit:cover}.kr-story-strip{display:flex;gap:12px;overflow-x:auto;padding:4px 2px 12px;scrollbar-width:none}.kr-story-strip::-webkit-scrollbar{display:none}.kr-story,.kr-story-add{flex:0 0 67px;border:0;background:transparent;color:var(--kr-text);display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer}.kr-story span,.kr-story-add span{width:58px;height:58px;border-radius:18px;display:grid;place-items:center;background:linear-gradient(135deg,rgba(224,17,95,.28),rgba(255,219,60,.18));border:1px solid rgba(255,178,190,.18)}.kr-story-add span{font-size:23px;color:var(--kr-pink)}.kr-story-avatar{width:54px;height:54px;border-radius:16px}.kr-story small,.kr-story-add small{width:67px;font-size:10px;color:#9ca5a8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kr-notif-list{display:flex;flex-direction:column;gap:7px}.kr-notif-row{width:100%;display:flex;gap:10px;align-items:center;text-align:left;border:1px solid var(--kr-outline);background:rgba(255,255,255,.025);color:var(--kr-text);border-radius:12px;padding:10px;cursor:pointer}.kr-notif-row:hover{background:rgba(255,255,255,.05)}.kr-notif-row small{display:block;color:#80898d;margin-top:3px;font-size:10px}.kr-notif-dot{width:28px;height:28px;border-radius:9px;display:grid;place-items:center;background:rgba(224,17,95,.1);color:var(--kr-pink);flex:0 0 auto}\n@media (max-width:600px){.kr-create-card{padding:13px}.kr-preview-card{width:min(100%,320px)}.kr-preview-card img,.kr-preview-card video{height:170px;max-height:170px}.kr-profile-uploaders{grid-template-columns:1fr}.kr-profile-actions{position:sticky;bottom:78px;padding-bottom:4px;background:linear-gradient(180deg,transparent,rgba(12,15,16,.95) 32%);z-index:5}}\n.kr-story-viewer{position:relative;width:min(94vw,520px);height:min(88dvh,820px);border-radius:24px;overflow:hidden;background:#080b0c;border:1px solid rgba(255,255,255,.08);box-shadow:0 24px 80px rgba(0,0,0,.55);display:flex;flex-direction:column;padding:16px}.kr-story-close{position:absolute;z-index:3;right:12px;top:12px;width:36px;height:36px;border:0;border-radius:12px;background:rgba(0,0,0,.55);color:#fff;font-size:24px;cursor:pointer}.kr-story-view-author{display:flex;align-items:center;gap:10px;position:relative;z-index:2}.kr-story-view-author small{display:block;color:#8e989c;font-size:10px;margin-top:2px}.kr-story-view-media{flex:1;min-height:0;display:grid;place-items:center;margin-top:12px;border-radius:18px;overflow:hidden;background:#050707}.kr-story-view-media img,.kr-story-view-media video{width:100%;height:100%;object-fit:contain}.kr-story-text-only{width:100%;height:100%;display:grid;place-items:center;text-align:center;padding:34px;font-size:28px;font-weight:800;line-height:1.2;background:radial-gradient(circle at 50% 20%,rgba(224,17,95,.23),transparent 50%),radial-gradient(circle at 50% 80%,rgba(255,219,60,.14),transparent 46%),#131617}.kr-story-view-caption{padding:11px 4px 2px;color:#dce1e2;font-size:13px;line-height:1.4}.kr-story-composer .modal-body{padding-top:4px}

/* KRAYI scroll fix: keep the social shell as the actual mobile viewport */
#app{height:100dvh;min-height:0;overflow:hidden;}
.krayi-shell{height:100dvh;max-height:100dvh;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;}
.krayi-main{min-height:max-content;}


/* KRAYI Section 03 scroll hardening */
html, body { min-height: 100%; }
body { overflow-x: hidden; }
.krayi-shell { height: 100dvh; min-height: 0; overflow-y: auto; overscroll-behavior-y: auto; touch-action: pan-y; }
.krayi-main { min-height: calc(100dvh - 112px); padding-bottom: 96px; }
@supports not (height: 100dvh) { .krayi-shell { height: 100vh; } .krayi-main { min-height: calc(100vh - 112px); } }
