:root, [data-theme="dark"] {
  --bg: #09090b;
  --surface: #0f0f14;
  --surface2: #16161d;
  --surface3: #1c1c25;
  --border: rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.10);
  --border-hover: rgba(255,255,255,0.16);
  --accent: #6d4aff;
  --accent2: #5b21b6;
  --accent-soft: rgba(109,74,255,0.12);
  --accent-glow: rgba(109,74,255,0.25);
  --primary: var(--accent);
  --green: #22c55e;
  --green-soft: rgba(34,197,94,0.12);
  --red: #ef4444;
  --text: #f4f4f5;
  --text2: #d4d4d8;
  --muted: #71717a;
  --muted2: #a1a1aa;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  --fd: "Syne", sans-serif;
  --fb: "DM Sans", sans-serif;
  --r: 14px;
  --rs: 10px;
}
[data-theme="light"] {
  --bg: #F3F2EE;
  --surface: #FAF9F7;
  --surface2: #EEECE8;
  --surface3: #E5E3DE;
  --border: rgba(0,0,0,0.07);
  --border2: rgba(0,0,0,0.11);
  --border-hover: rgba(0,0,0,0.18);
  --accent: #6d4aff;
  --accent2: #5b21b6;
  --accent-soft: rgba(109,74,255,0.08);
  --accent-glow: rgba(109,74,255,0.18);
  --primary: var(--accent);
  --green: #16a34a;
  --green-soft: rgba(22,163,74,0.10);
  --red: #dc2626;
  --text: #1a1915;
  --text2: #44413a;
  --muted: #9b9890;
  --muted2: #6e6b63;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.05);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fb);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
input,
textarea,
button {
  font-family: var(--fb);
}
#loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  flex-direction: column;
  gap: 16px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.lt {
  font-size: 14px;
  color: var(--muted2);
}
.auth {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.auth.active {
  display: flex;
}
.auth::before {
  content: "";
  position: absolute;
  width: 760px;
  height: 760px;
  background: radial-gradient(
    circle,
    rgba(109, 74, 255, 0.18) 0%,
    transparent 68%
  );
  top: -240px;
  left: -200px;
  pointer-events: none;
}
.auth::after {
  content: "";
  position: absolute;
  width: 640px;
  height: 640px;
  background: radial-gradient(
    circle,
    rgba(91, 33, 182, 0.16) 0%,
    transparent 70%
  );
  bottom: -240px;
  right: -180px;
  pointer-events: none;
}
.abox {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 2.5rem;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg), 0 24px 64px rgba(109, 74, 255, 0.14);
}
.alogo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
}
.alogo-i {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.alogo-n {
  font-family: var(--fd);
  font-size: 18px;
  font-weight: 700;
}
.atitle {
  font-family: var(--fd);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.asub {
  font-size: 14px;
  color: var(--muted2);
  margin-bottom: 2rem;
  line-height: 1.5;
}
.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.imp {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  margin-left: 8px;
  vertical-align: middle;
}
.imp-req {
  background: rgba(109, 74, 255, 0.15);
  color: var(--accent);
}
.imp-rec {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}
.imp-opt {
  background: rgba(107, 107, 128, 0.15);
  color: var(--muted);
}
.sopts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.sopt {
  padding: 8px 16px;
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  cursor: pointer;
  font-size: 13px;
  color: var(--muted2);
  transition: all 0.15s;
  user-select: none;
}
.sopt.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(109, 74, 255, 0.08);
}
.sopt:hover {
  color: var(--text);
}
.prow {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.prow input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.prow input:focus {
  border-color: var(--accent);
}
.pbtn-del {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  opacity: 0.6;
}
.pbtn-del:hover {
  opacity: 1;
}
.pbtn-add {
  background: rgba(109, 74, 255, 0.06);
  border: 1px dashed rgba(109, 74, 255, 0.3);
  color: var(--accent);
  border-radius: var(--rs);
  padding: 10px;
  width: 100%;
  cursor: pointer;
  font-size: 13px;
  margin-top: 4px;
  font-weight: 500;
}
.pbtn-add:hover {
  background: rgba(109, 74, 255, 0.1);
}
.profile-completeness {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  font-size: 13px;
  color: var(--muted2);
  display: flex;
  align-items: center;
  gap: 12px;
}
.pc-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.pc-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}
.field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.btnp {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--rs);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition:
    opacity 0.15s,
    transform 0.1s;
}
.btnp:hover {
  box-shadow: 0 4px 20px rgba(109,74,255,0.45);
  transform: translateY(-1px);
}
.btnp:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.aswitch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 13px;
  color: var(--muted2);
}
.aswitch button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
}
.mbox {
  border-radius: var(--rs);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 1rem;
  display: none;
}
.merr {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
}
.mok {
  background: var(--green-soft);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
}
#dash {
  display: none;
  min-height: 100vh;
}
.sb {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: background 0.3s, border-color 0.3s;
}
.sb-nav {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sb-nav::-webkit-scrollbar { display: none; }
.sblogo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0.5rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.sblogo-i {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 12px rgba(109,74,255,0.3);
}
.sblogo-n {
  font-family: var(--fd);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.nvsec {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 0.5rem;
  margin-bottom: 0.2rem;
  margin-top: 0.75rem;
}
.nvsec:first-of-type {
  margin-top: 0;
}
.nvi {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted2);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
}
.nvi:hover {
  background: var(--surface2);
  color: var(--text);
}
.nvi.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nvi.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nvi .ic {
  font-size: 15px;
  width: 20px;
  text-align: center;
  opacity: 0.85;
}
.nvi.active .ic { opacity: 1; }
.sbfoot {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  margin: 0 0.25rem 0.5rem;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted2);
  font-weight: 500;
  transition: all 0.2s;
  font-family: var(--fb);
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.lang-btn.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.uchip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s;
}
.uchip:hover { background: var(--surface2); }
.uav {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.uname {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sobtn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
}
.sobtn:hover {
  background: rgba(239,68,68,0.1);
  color: var(--red);
}
.main {
  margin-left: 220px;
  padding: 2rem 2.5rem;
  min-height: 100vh;
}
.pg {
  display: none;
}
.pg.active {
  display: block;
}
.pghd {
  margin-bottom: 1.75rem;
}
.pgtitle {
  font-family: var(--fd);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.7px;
  color: var(--text);
  margin-bottom: 4px;
}
.pgsub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}
.ov-welcome {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: var(--r);
  padding: 1.6rem 1.9rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.ov-welcome::after {
  content: "";
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0%, transparent 70%);
  pointer-events: none;
}
.ov-welcome-hi {
  font-family: var(--fd);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  position: relative;
  letter-spacing: -0.3px;
}
.ov-welcome-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
  position: relative;
}
.ov-welcome-sub strong {
  color: #fff;
  font-weight: 700;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.sc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.sc::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.25s;
}
.sc:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.sc:hover::after { opacity: 1; }
.sc-ic {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.slbl {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.sval {
  font-family: var(--fd);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--text), var(--muted2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ssub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.sdelta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.sdelta.up { color: #10b981; background: rgba(16,185,129,0.12); }
.sdelta.down { color: #ef4444; background: rgba(239,68,68,0.12); }
.sdelta.flat { color: var(--muted); background: rgba(255,255,255,0.05); }
.bsc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}
.bsc:hover { border-color: var(--border-hover); }
.bsl {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sdot.on {
  background: var(--green);
  box-shadow: 0 0 12px rgba(34,197,94,0.5);
  animation: pulse 2s infinite;
}
.sdot.off {
  background: var(--muted);
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
.sname {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.ssub2 {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.tgl {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
  display: inline-block;
}
.tgl input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.tgltr {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 12px;
  transition: all 0.2s;
}
.tgl input:checked ~ .tgltr {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(34,197,94,0.3);
}
.tglth {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  pointer-events: none;
}
.tgl input:checked ~ .tglth {
  transform: translateX(20px);
}
.sechd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.sectitle {
  font-family: var(--fd);
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: -0.2px;
}
.btnadd {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 1px solid transparent;
  border-radius: var(--rs);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(109,74,255,0.3);
}
.btnadd:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(109,74,255,0.4);
}
.rc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.rc:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.rb {
  flex: 1;
  min-width: 0;
}
.rtrig {
  display: inline-block;
  background: var(--accent-soft);
  border: 1px solid rgba(109,74,255,0.2);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-family: 'DM Sans', monospace;
  color: var(--accent);
  margin-bottom: 6px;
}
.rrep {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.55;
  margin-top: 6px;
}
.rdel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.rdel:hover {
  border-color: rgba(239,68,68,0.4);
  color: var(--red);
  background: rgba(239,68,68,0.08);
}
.empty {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--border2);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.aform {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: none;
}
.aform.open {
  display: block;
}
.frow {
  display: flex;
  gap: 8px;
  margin-top: 0.75rem;
}
.btnsave {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--rs);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(109,74,255,0.3);
  transition: all 0.2s;
}
.btnsave:hover {
  box-shadow: 0 4px 16px rgba(109,74,255,0.4);
  transform: translateY(-1px);
}
.btnsave:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btncancel {
  padding: 9px 18px;
  background: none;
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--muted2);
  font-size: 13px;
  cursor: pointer;
}
.li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 8px;
  display: flex;
  gap: 14px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.li:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}
.ltime {
  font-size: 11px;
  color: var(--muted);
  font-family: 'DM Sans', monospace;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 56px;
  margin-top: 2px;
}
.lbody {
  flex: 1;
}
.lsend {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 3px;
}
.ltxt {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.5;
}
.lbadge {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
}
.lbadge.replied {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.2);
}
.lbadge.missed {
  background: rgba(113,113,122,0.1);
  color: var(--muted);
  border: 1px solid rgba(113,113,122,0.15);
}
/* ── Customer list ── */
.cust-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.cust-row:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}
.cust-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}
.cust-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.cust-info { flex: 1; min-width: 0; }
.cust-name {
  font-weight: 600; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ch-icon {
  display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 5px;
  border-radius: 4px; vertical-align: middle; margin-left: 4px; letter-spacing: 0.3px;
}
.ch-msg { background: rgba(0,132,255,.15); color: #0084ff; }
.ch-ig { background: linear-gradient(45deg,rgba(240,148,51,.2),rgba(204,35,102,.2)); color: #dc2743; }
.ch-wa { background: rgba(37,211,102,.15); color: #25d366; }
.ch-tg { background: rgba(0,136,204,.15); color: #0088cc; }
.ch-wa { background: rgba(37,211,102,.15); color: #25D366; }

/* Channel filter cards */
.ch-filters {
  display: flex; gap: 10px; margin-bottom: 14px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.ch-filters::-webkit-scrollbar { display: none; }
.ch-card {
  flex: 1; min-width: 80px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 14px 10px; text-align: center; cursor: pointer;
  transition: all .15s ease;
}
.ch-card:hover { border-color: var(--primary); background: var(--surface2); }
.ch-card-active { border-color: var(--primary); background: rgba(109,74,255,.08); }
.ch-card-icon {
  width: 36px; height: 36px; border-radius: 10px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: .3px;
}
.ch-card-messenger { background: rgba(0,132,255,.15); color: #0084ff; }
.ch-card-instagram { background: linear-gradient(45deg,rgba(240,148,51,.25),rgba(204,35,102,.25)); color: #dc2743; }
.ch-card-telegram { background: rgba(0,136,204,.15); color: #0088cc; }
.ch-card-whatsapp { background: rgba(37,211,102,.15); color: #25D366; }
.ch-card-label { font-size: 11px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.ch-card-count { font-size: 18px; font-weight: 700; color: var(--text); }

/* Channel overview (Page Setup) */
.ch-overview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px;
}
@media (max-width: 600px) { .ch-overview { grid-template-columns: 1fr; } }
.ch-ov-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px;
}
.ch-ov-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; letter-spacing: .3px;
}
.ch-ov-info { flex: 1; min-width: 0; }
.ch-ov-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ch-ov-status { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-ov-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--red); box-shadow: 0 0 6px var(--red);
}
.ch-ov-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* Test Bot channel selector */
.tb-channel-bar { display: flex; gap: 6px; margin-bottom: 12px; }
.tb-ch {
  display: flex; align-items: center; gap: 5px; padding: 6px 14px;
  border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s ease; font-family: inherit;
}
.tb-ch:hover { border-color: var(--primary); background: var(--surface2); }
.tb-ch-active { border-color: var(--primary); background: rgba(109,74,255,.08); }

.cust-preview {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.cust-meta {
  text-align: right; flex-shrink: 0;
}
.cust-time {
  font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cust-count {
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
/* ── Conversation view ── */
.convo-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.convo-messages {
  display: flex; flex-direction: column; gap: 6px;
}
.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px; line-height: 1.5;
  position: relative;
}
.msg-in {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-out {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-time {
  font-size: 10px; color: var(--muted);
  margin-top: 4px;
}
.msg-out .msg-time { color: rgba(255,255,255,0.65); }
.msg-day-divider {
  text-align: center;
  font-size: 11px; color: var(--muted);
  margin: 12px 0 8px;
  position: relative;
}
.msg-day-divider::before, .msg-day-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 50px);
  height: 1px;
  background: var(--border);
}
.msg-day-divider::before { left: 0; }
.msg-day-divider::after { right: 0; }
.setcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.75rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, background 0.3s, box-shadow 0.3s;
}
.setcard:hover { border-color: var(--border-hover); }
.setcard h3 {
  font-family: var(--fd);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.setcard p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}
.cbadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  margin-left: 10px;
}
.wbox {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 12px 14px;
  font-family: monospace;
  font-size: 12px;
  color: var(--muted2);
  word-break: break-all;
  line-height: 1.6;
}
.cpbtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--muted2);
  font-size: 12px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
}
.cpbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.plancards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.plancard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s;
}
.plancard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.plancard.featured {
  border-color: rgba(109,74,255,0.4);
  background: linear-gradient(180deg, rgba(109,74,255,0.08) 0%, var(--surface) 50%);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(109,74,255,0.15);
}
.plancard.featured:hover {
  box-shadow: var(--shadow-lg), 0 0 24px rgba(109,74,255,0.15);
}
.planbadge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(109,74,255,0.4);
}
.planname {
  font-family: var(--fd);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.planprice {
  font-family: var(--fd);
  font-size: 34px;
  font-weight: 800;
  margin: 1rem 0;
  background: linear-gradient(135deg, var(--text), var(--muted2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.planprice span {
  font-size: 14px;
  font-weight: 400;
  -webkit-text-fill-color: var(--muted);
}
.planfeats {
  list-style: none;
  margin-bottom: 1.25rem;
}
.planfeats li {
  font-size: 13px;
  color: var(--muted2);
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
.planfeats li::before {
  content: "✓";
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
}
.btnplan {
  width: 100%;
  padding: 11px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btnplan-o {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btnplan-o:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.btnplan-f {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #fff;
  box-shadow: 0 2px 12px rgba(109,74,255,0.35);
}
.btnplan-f:hover {
  box-shadow: 0 4px 20px rgba(109,74,255,0.45);
  transform: translateY(-1px);
}

/* ── Orders & Bookings ───────────────────────────────────── */
.os-card {
  background: var(--surface2);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
  border: 1px solid var(--border2);
}
.os-num { font-size: 22px; font-weight: 700; }
.os-label { font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.os-new .os-num { color: #f59e0b; }
.os-confirmed .os-num { color: #3b82f6; }
.os-preparing .os-num { color: #f97316; }
.os-ready .os-num { color: #22c55e; }
.os-today .os-num { color: var(--accent); }
.os-revenue .os-num { color: #10b981; }

.of-btn {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
}
.of-btn:hover { border-color: var(--accent); color: var(--accent); }
.of-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.order-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color .15s;
}
.order-card:hover { border-color: var(--accent); }

.oc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.oc-left { display: flex; align-items: center; gap: 8px; }
.oc-type { font-size: 13px; font-weight: 600; }
.oc-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.oc-badge.os-new { background: #fef3c7; color: #92400e; }
.oc-badge.os-confirmed { background: #dbeafe; color: #1e40af; }
.oc-badge.os-preparing { background: #ffedd5; color: #9a3412; }
.oc-badge.os-ready { background: #dcfce7; color: #166534; }
.oc-badge.os-completed { background: #e0e7ff; color: #3730a3; }
.oc-badge.os-cancelled { background: #fecaca; color: #991b1b; }

.oc-right { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.oc-customer { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.oc-schedule { font-size: 12px; color: var(--accent); margin-bottom: 6px; }

.oc-items { margin: 8px 0; }
.oi-row { font-size: 13px; padding: 3px 0; display: flex; gap: 6px; align-items: baseline; }
.oi-qty { font-weight: 700; color: var(--accent); min-width: 24px; }
.oi-name { flex: 1; }
.oi-price { color: var(--muted); font-size: 12px; }

.oc-total { font-size: 14px; font-weight: 700; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border2); }
.oc-notes { font-size: 12px; color: var(--muted); margin-top: 6px; }
.oc-mnotes { font-size: 12px; color: var(--accent); margin-top: 4px; }

.oc-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.obtn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
}
.obtn:hover { transform: translateY(-1px); }
.obtn-confirm { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.obtn-confirm:hover { background: #2563eb; }
.obtn-prepare { background: #f97316; color: #fff; border-color: #f97316; }
.obtn-prepare:hover { background: #ea580c; }
.obtn-ready { background: #22c55e; color: #fff; border-color: #22c55e; }
.obtn-ready:hover { background: #16a34a; }
.obtn-complete { background: var(--accent); color: #fff; border-color: var(--accent); }
.obtn-complete:hover { background: var(--accent2); }
.obtn-cancel { color: #ef4444; border-color: #ef4444; }
.obtn-cancel:hover { background: #ef4444; color: #fff; }
.obtn-note { color: var(--muted); }
.obtn-note:hover { color: var(--accent); border-color: var(--accent); }

/* ── Mobile hamburger + overlay (hidden on desktop) ───── */
.mob-menu {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 201;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── Mobile responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .mob-menu { display: flex; }

  .sb {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    width: 260px;
  }
  .sb.open {
    transform: translateX(0);
  }
  .sb-overlay.open {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 60px 16px 24px;
  }

  .pgtitle { font-size: 18px; }
  .pgsub { font-size: 13px; }

  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px 10px; }
  .stat-card .sn { font-size: 22px; }
  .stat-card .sl { font-size: 10px; }

  .plancards { grid-template-columns: 1fr; max-width: 400px; }
  .plancard { padding: 1.5rem; }
  .planprice { font-size: 28px; }

  .ch-overview { grid-template-columns: 1fr 1fr; }
  .ch-filters { flex-wrap: wrap; gap: 6px; }

  table { font-size: 12px; }
  table th, table td { padding: 8px 10px; }

  .convo-messages { max-height: 60vh; }
  .msg-bubble { max-width: 85% !important; }

  #billing-cycle-toggle { flex-wrap: nowrap; }
}

@media (max-width: 480px) {
  .main { padding: 56px 12px 20px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .ch-overview { grid-template-columns: 1fr; }

  .pghd { margin-bottom: 1rem; }
  .pgtitle { font-size: 16px; }

  .planprice { font-size: 24px; }
}

/* ═══════════════════════ Chat Page (WhatsApp-style) ═══════════════════════ */
#page-chat { padding: 0 !important; margin: -2rem -2.5rem; }
#page-chat .pghd { display: none; }

.chat-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.chat-left {
  width: 320px;
  min-width: 280px;
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.chat-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.chat-left-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-search-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.chat-search-wrap input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.chat-search-wrap input:focus { border-color: var(--accent); }

.chat-contact-list {
  flex: 1;
  overflow-y: auto;
}
.chat-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.chat-contact:hover { background: var(--surface2); }
.chat-contact.active { background: var(--accent-soft); border-right: 3px solid var(--accent); }

.chat-contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.chat-contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-contact-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-contact-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-contact-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.chat-contact-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.chat-contact-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chat-contact-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.chat-ch-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}
.chat-attn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
}
.chat-paused-badge {
  font-size: 9px;
  font-weight: 600;
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  padding: 1px 5px;
  border-radius: 4px;
}
.chat-no-contacts {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
}

/* Thread area */
#chat-thread-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.chat-thread-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}
.chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border2);
  background: var(--surface);
}
.chat-thread-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-back-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.chat-thread-actions { display: flex; gap: 6px; }
.chat-action-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.chat-pause { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.2) !important; }
.chat-resume { background: rgba(34,197,94,0.1); color: #22c55e; border: 1px solid rgba(34,197,94,0.2) !important; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
}
.chat-date-divider {
  text-align: center;
  margin: 12px 0 8px;
  font-size: 11px;
  color: var(--muted);
}
.chat-date-divider span {
  background: var(--surface2);
  padding: 3px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.chat-msg { display: flex; margin-bottom: 3px; }
.chat-msg-in { justify-content: flex-start; }
.chat-msg-out { justify-content: flex-end; }

.chat-bubble {
  max-width: 70%;
  padding: 8px 12px;
  word-break: break-word;
}
.chat-bubble-in {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 2px 12px 12px 12px;
  color: var(--text);
}
.chat-bubble-out {
  background: #005c4b;
  border-radius: 12px 2px 12px 12px;
  color: #e9edef;
}
[data-theme="light"] .chat-bubble-out {
  background: #d9fdd3;
  color: #111b21;
}
.chat-bubble-text { font-size: 13px; line-height: 1.5; }
.chat-bubble-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 3px;
  text-align: right;
}

/* Input */
.chat-input-wrap {
  position: relative;
}
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border2);
  background: var(--surface);
}
.chat-input-area input {
  flex: 1;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.chat-input-area input:focus { border-color: var(--accent); }
.chat-input-area input:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-input-area button {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.chat-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-input-area .chat-input-icon {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
  font-weight: normal;
  color: inherit;
}
.chat-input-icon:hover { opacity: 1; background: var(--surface2); }
.chat-input-icon:disabled { opacity: 0.3; cursor: not-allowed; }
.chat-input-icon:disabled:hover { background: none; }

/* Emoji picker */
.chat-emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 12px;
  width: 320px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  overflow: hidden;
}
.chat-emoji-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.chat-emoji-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}
.chat-emoji-tab:hover { color: var(--text); }
.chat-emoji-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.chat-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.chat-emoji-item {
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.12s;
}
.chat-emoji-item:hover { background: var(--surface3); }

/* Media in bubbles */
.chat-bubble-img {
  max-width: 220px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
}

/* Poster picker in chat */
.chat-poster-picker {
  position: absolute;
  bottom: 100%;
  left: 12px;
  right: 12px;
  max-width: 420px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  overflow: hidden;
}
.chat-poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  max-height: 260px;
  overflow-y: auto;
}
.chat-poster-item {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
}
.chat-poster-item:hover { border-color: var(--accent); transform: scale(1.03); }
.chat-poster-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
}
.chat-poster-label {
  font-size: 10px;
  padding: 4px 6px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface);
}

/* ── Poster Library Page ─────────────────────────── */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.poster-card {
  border: 1px solid var(--border2);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.15s;
}
.poster-card:hover { border-color: var(--border-hover); }
.poster-thumb {
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}
.poster-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}
.poster-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.poster-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.poster-del:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.poster-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.chat-input-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 0 20px 8px;
  background: var(--surface);
}

/* Mobile responsive */
@media (max-width: 768px) {
  #page-chat { margin: -60px -16px -24px; }
  .chat-left { width: 100%; min-width: unset; border-right: none; }
  .chat-left-header { padding-top: 56px; }
  .chat-thread-header { padding-top: 56px; }
  .chat-right { display: none; position: absolute; inset: 0; z-index: 10; background: var(--bg); }
  .chat-right.chat-mobile-show { display: flex; }
  .chat-left.chat-mobile-hide { display: none; }
  .chat-back-btn { display: inline-block; }
  .chat-bubble { max-width: 85%; }
}
@media (max-width: 480px) {
  #page-chat { margin: -56px -12px -20px; }
  .chat-input-area { padding: 10px 10px; gap: 4px; }
  .chat-input-area .chat-input-icon { padding: 4px; font-size: 18px; }
  .chat-input-area input { padding: 8px 10px; font-size: 13px; min-width: 0; }
  .chat-input-area button { padding: 8px 12px; font-size: 12px; flex-shrink: 0; }
}

/* Tables page (floor plan) */
.tbl-pal { background: var(--surface); border: 1px solid var(--border2); color: var(--text); padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.tbl-pal:hover { border-color: var(--accent); color: var(--accent); }
.tbl-act { background: transparent; border: 1px solid var(--border2); color: var(--text); padding: 4px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.tbl-act:hover { border-color: var(--accent); color: var(--accent); }
