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

/* ====================== RESET & TOKENS ====================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1518;
  --bg2:      #161f23;
  --bg3:      #1d272c;
  --border:   rgba(255,255,255,0.08);
  --primary:  #d69b6d;
  --primary2: #b77b56;
  --accent:   #73b69a;
  --blue:     #5fb9de;
  --purple:   #a78bfa;
  --red:      #ef6b63;
  --yellow:   #f3bc62;
  --text:     #eef3f1;
  --muted:    #96a3a7;
  --r:        18px;
  --shadow:   0 18px 48px rgba(0,0,0,0.35);
}

[data-theme="light"] {
  --bg:       #f6f2ed;
  --bg2:      #fffdfb;
  --bg3:      #f1ebe5;
  --border:   rgba(44,54,51,0.09);
  --text:     #1f2624;
  --muted:    #6f7c78;
  --shadow:   0 18px 40px rgba(39,32,24,0.08);
}

body {
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(214,155,109,0.10), transparent 26%),
    radial-gradient(circle at top right, rgba(115,182,154,0.10), transparent 22%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  transition: background 0.3s, color 0.3s;
}

/* ====================== SCROLLBAR ====================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* ====================== LAYOUT ====================== */
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 60px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  grid-column: 1 / -1;
  background: rgba(255,253,251,0.76);
  backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 100;
  box-shadow: 0 10px 24px rgba(28,24,20,0.04);
}
[data-theme="dark"] .topbar { background: rgba(15,21,24,0.88); }

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.topbar-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.topbar-logo span {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
  letter-spacing: -0.3px;
}
.topbar-logo small {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 500;
  display: block;
  line-height: 1;
}

.topbar-center { flex: 1; }
.topbar-search {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.4rem 1rem 0.4rem 2.2rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.7rem center;
}
.topbar-search:focus { border-color: var(--primary); background-color: rgba(244,162,97,0.06); }
[data-theme="light"] .topbar-search { background-color: #f5f5f5; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }

/* SIDEBAR */
.sidebar {
  background: linear-gradient(180deg, var(--bg2), rgba(255,255,255,0.02));
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.15rem 0 1.5rem;
}

.sidebar-section {
  margin-bottom: 0.25rem;
}

.sidebar-label {
  padding: 0.35rem 1rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 1rem 0.72rem 1.1rem;
  margin: 0.18rem 0.7rem;
  cursor: pointer;
  border-radius: 14px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.18s;
  border-left: 0;
  position: relative;
}
.sidebar-item:hover { background: rgba(214,155,109,0.08); color: var(--text); }
.sidebar-item.active {
  background: linear-gradient(135deg, rgba(214,155,109,0.16), rgba(115,182,154,0.12));
  color: var(--text);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(214,155,109,0.16);
}
.sidebar-item .si-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-item .si-badge {
  margin-left: auto;
  background: rgba(244,162,97,0.2);
  color: var(--primary);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-divider { height: 1px; background: var(--border); margin: 0.5rem 1rem; }

/* MAIN CONTENT */
.main-content {
  overflow-y: auto;
  background: transparent;
}

/* ====================== PANEL BASE ====================== */
.panel { display: none; padding: 1.6rem; }
.panel.active { display: block; }

.page-header {
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.7px;
  margin-bottom: 0.35rem;
}
.page-header p { color: var(--muted); font-size: 0.88rem; max-width: 760px; }

/* ====================== PRICE CALCULATOR ====================== */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 700px) { .calc-grid { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.86));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.3rem;
  transition: border-color 0.2s, transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .card {
  background: linear-gradient(180deg, rgba(22,31,35,0.98), rgba(29,39,44,0.96));
}
.card:hover { border-color: rgba(214,155,109,0.35); transform: translateY(-1px); }
.card-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.form-group { margin-bottom: 0.85rem; }
.form-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--muted); margin-bottom: 0.3rem; }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-control:focus { border-color: var(--primary); }
[data-theme="light"] .form-control { background: #f5f5f5; }

.toggle-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.toggle-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active, .toggle-btn:hover {
  background: rgba(244,162,97,0.15);
  border-color: var(--primary);
  color: var(--primary);
}
.toggle-btn.active {
  background: rgba(244,162,97,0.2);
}

/* Result card */
.result-card {
  background: linear-gradient(135deg, rgba(244,162,97,0.12), rgba(231,111,81,0.08));
  border: 1.5px solid rgba(244,162,97,0.3);
  border-radius: var(--r);
  padding: 1.25rem;
  margin-top: 0.5rem;
}
.result-card .price-main {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -1px;
  line-height: 1;
}
.result-card .price-details {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.result-card .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}
.result-card .price-row:last-child { border-bottom: none; }
.result-card .price-row .label { color: var(--muted); }
.result-card .price-row .value { font-weight: 700; }
.result-card .breakdown-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.75rem 0 0.35rem;
  letter-spacing: 0.5px;
}

/* ====================== SITUATION CATALOG ====================== */
.situation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  gap: 1rem;
}

.sit-group-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.sit-group-card:hover {
  transform: translateY(-2px);
  border-color: rgba(244,162,97,0.3);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.sit-group-header {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.sit-group-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sit-group-meta h3 { font-size: 0.85rem; font-weight: 800; }
.sit-group-meta small { font-size: 0.68rem; color: var(--muted); }

.sit-items { padding: 0.5rem; }
.sit-item {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.78rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.sit-item:hover { background: rgba(244,162,97,0.08); }
.sit-item .sit-code {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.65rem;
  padding: 1px 5px;
  background: rgba(244,162,97,0.15);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
}
.sit-item .sit-text { color: var(--muted); line-height: 1.35; }

/* ====================== RESPONSE TEMPLATES ====================== */
.template-list { display: flex; flex-direction: column; gap: 0.75rem; }
.tpl-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.2s;
}
.tpl-card:hover { border-color: rgba(82,183,136,0.35); }
.tpl-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 0.5rem;
}
.tpl-title { font-weight: 800; font-size: 0.85rem; }
.tpl-tag {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(82,183,136,0.15);
  color: var(--accent);
  white-space: nowrap;
}
.tpl-body {
  padding: 0 1rem 1rem;
  display: none;
}
.tpl-body.open { display: block; }
.tpl-text {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  font-family: inherit;
  margin-bottom: 0.5rem;
}
.copy-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(82,183,136,0.08); }
.copy-btn.copied { border-color: var(--accent); color: var(--accent); background: rgba(82,183,136,0.15); }

/* ====================== PRICING ADMIN ====================== */
.pricing-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 980px) {
  .pricing-admin-layout { grid-template-columns: 1fr; }
}
.pricing-admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.pricing-admin-subtitle {
  font-size: 0.74rem;
  color: var(--muted);
}
.pricing-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.pricing-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.pricing-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  background: rgba(255,255,255,0.03);
}
.pricing-item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (max-width: 700px) {
  .pricing-item-grid { grid-template-columns: 1fr; }
}
.pricing-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.pricing-field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.pricing-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.pricing-inline-actions .btn {
  padding: 0.45rem 0.8rem;
  font-size: 0.74rem;
}
.pricing-note {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ====================== CHAT SIMULATOR ====================== */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  height: calc(100vh - 60px - 3rem);
  min-height: 400px;
}
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; } }

.chat-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.chat-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f4a261, #e76f51);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.chat-name { font-weight: 800; font-size: 0.88rem; }
.chat-status { font-size: 0.68rem; color: var(--accent); font-weight: 600; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.msg {
  max-width: 80%;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  animation: msgIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.customer {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  align-self: flex-start;
  border-radius: 14px 14px 14px 2px;
}
.msg.haru {
  background: linear-gradient(135deg, rgba(244,162,97,0.25), rgba(231,111,81,0.2));
  color: var(--text);
  align-self: flex-end;
  border-radius: 14px 14px 2px 14px;
  border: 1px solid rgba(244,162,97,0.2);
}
.msg .msg-label {
  font-size: 0.62rem;
  font-weight: 800;
  opacity: 0.55;
  margin-bottom: 0.2rem;
}
.chat-input-area {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}
.chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--primary); }
.send-btn {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
}
.send-btn:hover { transform: scale(1.08); }

/* Quick replies panel */
.quick-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-y: auto;
  padding: 0.85rem;
}
.quick-panel h3 { font-size: 0.72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.65rem; }
.quick-btn {
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  margin-bottom: 0.4rem;
  transition: all 0.15s;
  line-height: 1.4;
}
.quick-btn:hover { background: rgba(244,162,97,0.08); border-color: rgba(244,162,97,0.3); }
.quick-btn strong { color: var(--primary); display: block; font-size: 0.65rem; margin-bottom: 2px; }

/* ====================== QUOTE BUILDER ====================== */
.quote-builder { max-width: 680px; }
.qb-day {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 0.85rem;
  overflow: hidden;
}
.qb-day-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.qb-day-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}
.qb-day-body { padding: 1rem; }
.qb-result {
  background: linear-gradient(135deg, rgba(82,183,136,0.1), rgba(82,183,136,0.05));
  border: 1.5px solid rgba(82,183,136,0.25);
  border-radius: var(--r);
  padding: 1.25rem;
  margin-top: 1rem;
}
.qb-result .total {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -1px;
}
.qb-output {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.82rem;
  line-height: 1.75;
  white-space: pre-wrap;
  font-family: inherit;
  color: var(--text);
  margin-top: 1rem;
}

/* ====================== BUTTONS ====================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(244,162,97,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(244,162,97,0.45); }
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-accent {
  background: rgba(82,183,136,0.15);
  color: var(--accent);
  border: 1.5px solid rgba(82,183,136,0.3);
}
.btn-accent:hover { background: rgba(82,183,136,0.25); }

/* ====================== STATS OVERVIEW ====================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(244,162,97,0.3); }
.stat-val {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.3rem;
  letter-spacing: -1px;
}
.stat-lbl { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
.stat-sub { font-size: 0.72rem; color: var(--accent); margin-top: 0.2rem; font-weight: 600; }

/* ====================== TOAST ====================== */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a2a1a;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.6rem 1.25rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
  z-index: 99999;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ====================== DETAIL MODAL ====================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  width: min(480px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal h2 { font-size: 1.05rem; font-weight: 900; margin-bottom: 0.5rem; }
.modal .sub { color: var(--muted); font-size: 0.8rem; margin-bottom: 1rem; }
.modal .response-block {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.8rem;
  line-height: 1.65;
  white-space: pre-wrap;
  font-family: inherit;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.modal-close {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}

/* color classes */
.c-orange { color: var(--primary); }
.c-green  { color: var(--accent); }
.c-blue   { color: var(--blue); }
.c-purple { color: var(--purple); }
.c-red    { color: var(--red); }
.c-yellow { color: var(--yellow); }

.bg-orange { background: rgba(244,162,97,0.12); }
.bg-green  { background: rgba(82,183,136,0.12); }
.bg-blue   { background: rgba(76,201,240,0.12); }
.bg-purple { background: rgba(167,139,250,0.12); }
.bg-red    { background: rgba(239,68,68,0.12); }
.bg-yellow { background: rgba(251,191,36,0.12); }

/* misc */
.flex { display: flex; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.w-full { width: 100%; }
.gr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
}

/* ====================== MOBILE OPTIMIZATION ====================== */
@media (max-width: 920px) {
  body {
    font-size: 15px;
  }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .topbar {
    grid-column: 1;
    position: sticky;
    top: 0;
    padding: 0.8rem 0.9rem;
    min-height: 58px;
    height: auto;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .topbar-center {
    order: 3;
    flex: 1 0 100%;
  }

  .topbar-search {
    max-width: none;
    font-size: 16px;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .sidebar {
    grid-row: 2;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0 0.8rem;
    overflow-x: auto;
    overflow-y: visible;
    white-space: nowrap;
    position: sticky;
    top: 58px;
    z-index: 90;
    backdrop-filter: blur(18px);
  }

  .sidebar-label,
  .sidebar-divider,
  .sidebar > div[style*="padding:0.75rem 1rem"],
  .sidebar > div[style*="padding:0 1rem 1rem"] {
    display: none !important;
  }

  .sidebar-item {
    display: inline-flex;
    width: auto;
    margin: 0 0 0 0.55rem;
    padding: 0.78rem 0.95rem;
    border-radius: 999px;
    font-size: 0.8rem;
    vertical-align: top;
  }

  .sidebar-item:last-of-type {
    margin-right: 0.55rem;
  }

  .main-content {
    overflow: visible;
  }

  .panel {
    padding: 1rem 0.85rem 1.2rem;
  }

  .page-header {
    margin-bottom: 1rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
    line-height: 1.15;
  }

  .page-header p {
    font-size: 0.82rem;
  }

  .card,
  .result-card,
  .qb-result,
  .modal {
    border-radius: 16px;
    padding: 1rem;
  }

  .form-control,
  .chat-input {
    font-size: 16px;
  }

  .btn,
  .toggle-btn,
  .copy-btn,
  .send-btn,
  .icon-btn {
    min-height: 42px;
  }

  .toggle-group {
    gap: 0.5rem;
  }

  .toggle-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 0.72rem 0.9rem;
    border-radius: 14px;
  }

  .result-card .price-main,
  .qb-result .total {
    font-size: 1.75rem;
  }

  .result-card .price-row {
    gap: 0.75rem;
    align-items: flex-start;
  }

  .result-card .price-row .label,
  .result-card .price-row .value {
    font-size: 0.78rem;
  }

  .chat-layout {
    height: auto;
    min-height: 0;
  }

  .chat-box,
  .quick-panel {
    min-height: 320px;
  }

  .chat-messages {
    padding: 0.85rem;
  }

  .msg {
    max-width: 92%;
    font-size: 0.86rem;
  }

  .quote-builder {
    max-width: 100%;
  }

  .qb-day-header {
    padding: 0.75rem 0.85rem;
    flex-wrap: wrap;
  }

  .qb-day-body,
  .qb-output {
    padding: 0.9rem;
  }

  .pricing-admin-header-row,
  .pricing-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .pricing-inline-actions .btn,
  .pricing-admin-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .situation-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar-logo small,
  .topbar-actions > div[style*="width:1px"] {
    display: none !important;
  }

  .topbar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .sidebar {
    top: 56px;
  }

  .sidebar-item {
    font-size: 0.76rem;
    padding: 0.72rem 0.85rem;
  }

  .panel {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  .card,
  .result-card,
  .qb-result {
    padding: 0.9rem;
  }

  .result-card .price-main,
  .qb-result .total {
    font-size: 1.55rem;
  }

  .tpl-header,
  .sit-group-header,
  .chat-header,
  .qb-day-header {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }
}
