/* ============================================================================
   GuestBee — Админ-панель (Phase 3 real UI). Vanilla CSS, mobile-first (Telegram
   Mini App) + responsive for browser. GuestBee visual language: Inter, navy
   #283044, blue #2563eb, teal, amber. Read-only.
   ============================================================================ */
:root {
  --navy:#283044; --blue:#2563eb; --blue-soft:#eff4ff; --teal:#0fa9af; --teal-soft:#ccfbf1;
  --green:#16ba5e; --green-soft:#e7f8ee; --amber:#f59e0b; --amber-soft:#fff7e6;
  --red:#ef4444; --red-soft:#fdecec; --violet:#7c3aed; --violet-soft:#f3edff;
  --bg:#f5f6f8; --surface:#fff; --surface-2:#fafbfc; --ink:#111827; --muted:#6b7280;
  --faint:#9ca3af; --line:#e8eaed; --line-2:#eef0f3; --radius:14px;
  --shadow-sm:0 1px 2px rgba(16,24,40,.05); --shadow:0 4px 16px rgba(16,24,40,.08);
  --font:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --safe-top:env(safe-area-inset-top,0px); --safe-bot:env(safe-area-inset-bottom,0px);
}
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body { margin:0; height:100%; }
body { font-family:var(--font); background:var(--bg); color:var(--ink); font-size:14px; line-height:1.45; -webkit-font-smoothing:antialiased; }
button { font-family:inherit; cursor:pointer; }
.mono { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
.muted { color:var(--muted); }

/* ---- Full-screen states (login / errors) ---- */
.center { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.loading { color:var(--muted); font-weight:600; }
.state-card {
  background:var(--surface); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow);
  max-width:380px; width:100%; padding:28px 24px; text-align:center;
}
.state-card .logo { width:52px; height:52px; border-radius:14px; margin:0 auto 16px;
  background:linear-gradient(135deg,var(--amber),#ffb84d); display:grid; place-items:center; font-size:28px; }
.state-card h1 { font-size:19px; margin:0 0 8px; }
.state-card p { color:var(--muted); font-size:13.5px; margin:0 0 6px; }
.state-card .ic { font-size:40px; margin-bottom:12px; }
.state-card.err h1 { color:var(--red); }

/* ---- App shell ---- */
.shell { min-height:100vh; display:flex; flex-direction:column; padding-bottom:calc(64px + var(--safe-bot)); }
.topbar {
  position:sticky; top:0; z-index:20; background:var(--surface); border-bottom:1px solid var(--line);
  padding:calc(12px + var(--safe-top)) 16px 12px; display:flex; align-items:center; gap:12px;
}
.topbar .ttl { font-size:17px; font-weight:750; letter-spacing:-.01em; }
.topbar .sp { flex:1; }
.who { display:flex; align-items:center; gap:9px; }
.avatar { width:34px; height:34px; border-radius:50%; background:var(--navy); color:#fff; display:grid; place-items:center; font-weight:700; font-size:13px; }
.who .nm { line-height:1.15; text-align:right; }
.who .nm b { font-size:12.5px; font-weight:700; display:block; }
.who .nm span { font-size:11px; color:var(--muted); }

.content { flex:1; padding:16px; max-width:760px; width:100%; margin:0 auto; }
.screen-sub { color:var(--muted); font-size:12.5px; margin:-4px 0 14px; }

/* ---- Bottom nav ---- */
.nav {
  position:fixed; bottom:0; left:0; right:0; z-index:30; background:var(--surface);
  border-top:1px solid var(--line); display:flex; padding:6px 6px calc(6px + var(--safe-bot));
}
.nav button {
  flex:1; border:none; background:none; color:var(--muted); font-size:11px; font-weight:600;
  display:flex; flex-direction:column; align-items:center; gap:3px; padding:7px 4px; border-radius:10px;
}
.nav button .ic { font-size:19px; line-height:1; }
.nav button.active { color:var(--blue); background:var(--blue-soft); }

/* ---- Cards / dashboard ---- */
.grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.stat { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:15px 16px; box-shadow:var(--shadow-sm); display:flex; flex-direction:column; gap:6px; }
.stat .label { font-size:12px; color:var(--muted); font-weight:600; min-height:2.4em; }
.stat .value { font-size:30px; font-weight:780; letter-spacing:-.02em; line-height:1; }

.rdy { display:inline-flex; align-items:center; gap:5px; font-size:10px; font-weight:700; padding:2px 8px; border-radius:999px; white-space:nowrap; align-self:flex-start; }
.rdy::before { content:''; width:6px; height:6px; border-radius:50%; }
.rdy.available_now { background:var(--green-soft); color:#0a7d3e; } .rdy.available_now::before{ background:var(--green);}
.rdy.derived { background:var(--blue-soft); color:#1d4ed8; } .rdy.derived::before{ background:var(--blue);}
.rdy.new_schema { background:var(--amber-soft); color:#a35a00; } .rdy.new_schema::before{ background:var(--amber);}

/* ---- Lists ---- */
.filter-row { display:flex; gap:10px; align-items:center; margin-bottom:14px; flex-wrap:wrap; }
select.flt { height:38px; border:1px solid var(--line); border-radius:10px; background:var(--surface); padding:0 30px 0 12px; font-size:13px; font-weight:600; color:var(--ink); outline:none; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 11px center; }
.count-note { font-size:12px; color:var(--faint); margin-left:auto; }

.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:14px 15px; margin-bottom:10px; }
.card .row1 { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.card .id { font-family:ui-monospace,Menlo,monospace; font-size:12px; color:var(--muted); }
.card .kv { display:grid; grid-template-columns:96px 1fr; gap:5px 12px; font-size:13px; }
.card .kv dt { color:var(--muted); } .card .kv dd { margin:0; }

.pill { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 10px; border-radius:999px; white-space:nowrap; }
.pill::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill.new,.pill.pending { background:var(--blue-soft); color:#1d4ed8; }
.pill.assigned,.pill.review { background:var(--violet-soft); color:#6b21d6; }
.pill.awaiting_host,.pill.contact_initiated,.pill.awaiting_information { background:var(--amber-soft); color:#a35a00; }
.pill.resolved,.pill.approved { background:var(--green-soft); color:#0a7d3e; }
.pill.spam,.pill.rejected { background:var(--red-soft); color:#b42318; }
.pill.closed,.pill.archived { background:#f1f3f5; color:var(--muted); }
.pill.listing_active { background:var(--green-soft); color:#0a7d3e; }
.pill.listing_suspended { background:var(--amber-soft); color:#a35a00; }
.chip { display:inline-block; font-size:11px; font-weight:600; padding:2px 8px; border-radius:8px; background:#f1f3f5; color:var(--ink); }

.empty { text-align:center; color:var(--muted); padding:48px 20px; font-size:14px; }
.empty .ic { font-size:34px; display:block; margin-bottom:10px; opacity:.5; }
.loadmore { display:block; width:100%; height:40px; border:1px solid var(--line); background:var(--surface); border-radius:10px; font-weight:600; color:var(--blue); margin-top:4px; }
.loadmore:hover { background:var(--surface-2); }

/* ---- Profile ---- */
.profile { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:22px; text-align:center; box-shadow:var(--shadow-sm); }
.profile .big-av { width:64px; height:64px; border-radius:50%; background:var(--navy); color:#fff; display:grid; place-items:center; font-size:24px; font-weight:700; margin:0 auto 14px; }
.profile .pname { font-size:19px; font-weight:750; }
.profile .prole { color:var(--muted); font-size:13px; margin-top:2px; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; height:44px; padding:0 20px; border-radius:11px; font-size:14px; font-weight:650; border:1px solid var(--line); background:var(--surface); color:var(--ink); }
.btn.danger { border-color:#f4b4b4; color:var(--red); background:#fff; }
.btn.danger:hover { background:var(--red-soft); }
.btn.block { width:100%; margin-top:18px; }
.btn.primary { background:var(--blue); border-color:var(--blue); color:#fff; }

/* ---- Card actions (Phase 4) ---- */
.actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; padding-top:12px; border-top:1px solid var(--line-2); }
.abtn { height:34px; padding:0 12px; border-radius:9px; font-size:12.5px; font-weight:650; border:1px solid var(--line); background:var(--surface); color:var(--ink); }
.abtn:hover { background:var(--surface-2); }
.abtn.primary { background:var(--blue); border-color:var(--blue); color:#fff; }
.abtn.primary:hover { background:#1d55d0; }
.abtn.danger { border-color:#f4b4b4; color:var(--red); background:#fff; }
.abtn.danger:hover { background:var(--red-soft); }
.abtn:disabled { opacity:.5; }
.assign-row { display:flex; gap:8px; align-items:center; margin-top:10px; }
.assign-row select { flex:1; height:34px; border:1px solid var(--line); border-radius:9px; background:var(--surface); padding:0 30px 0 10px; font-size:12.5px; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; }
.note-box { width:100%; min-height:60px; border:1px solid var(--line); border-radius:9px; padding:9px 11px; font-family:inherit; font-size:13px; resize:vertical; outline:none; margin-top:10px; }
.note-box:focus { border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-soft); }

/* ---- Toast ---- */
.toast { position:fixed; left:50%; bottom:calc(76px + var(--safe-bot)); transform:translateX(-50%); z-index:200;
  background:var(--navy); color:#fff; padding:11px 18px; border-radius:11px; font-size:13px; font-weight:600; box-shadow:0 8px 30px rgba(0,0,0,.28); max-width:90vw; text-align:center; }
.toast.err { background:#b42318; }

/* ---- Modal ---- */
.scrim { position:fixed; inset:0; background:rgba(17,24,39,.44); z-index:150; display:flex; align-items:center; justify-content:center; padding:20px; }
.modal { background:#fff; border-radius:16px; width:100%; max-width:400px; box-shadow:0 20px 60px rgba(0,0,0,.3); overflow:hidden; }
.modal h3 { margin:0; padding:18px 20px 6px; font-size:16px; }
.modal p { margin:0; padding:0 20px; color:var(--muted); font-size:13px; }
.modal .body { padding:12px 20px 4px; }
.modal .field-label { display:block; font-size:12px; font-weight:600; color:var(--ink-2,#374151); margin-bottom:6px; }
.modal textarea { width:100%; min-height:72px; border:1px solid var(--line); border-radius:10px; padding:10px 12px; font-family:inherit; font-size:13px; resize:vertical; outline:none; }
.modal textarea:focus { border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-soft); }
.modal textarea.invalid { border-color:var(--red); }
.modal .foot { display:flex; gap:10px; justify-content:flex-end; padding:14px 20px 18px; }
.mbtn { height:40px; padding:0 16px; border-radius:10px; font-size:13.5px; font-weight:650; border:1px solid var(--line); background:#fff; color:var(--ink); }
.mbtn.primary { background:var(--blue); border-color:var(--blue); color:#fff; }
.mbtn.danger { background:var(--red); border-color:var(--red); color:#fff; }

@media (min-width:640px){ .grid { grid-template-columns:repeat(3,1fr); } }
