/* ============================================
   تنمية القاضي — Design System v18
   Professional mobile-first UI
   ============================================ */
:root {
  --bg: #f4efe6;
  --bg-soft: #faf7f1;
  --card: #ffffff;
  --text: #14241f;
  --text-2: #3d4a45;
  --muted: #6b756f;
  --brand: #0f3d34;
  --brand-2: #1a5c4d;
  --brand-soft: #e8f3ef;
  --gold: #b8892e;
  --gold-soft: #f7efd9;
  --line: #e4d9c8;
  --line-soft: #efe7da;
  --mine: #d9f0e4;
  --other: #ffffff;
  --danger: #b33a2a;
  --danger-soft: #fce8e4;
  --warning: #c48a1a;
  --warning-soft: #fff4d6;
  --success: #1a7a5c;
  --shadow: 0 8px 28px rgba(20, 36, 31, 0.08);
  --shadow-lg: 0 16px 48px rgba(20, 36, 31, 0.12);
  --r: 16px;
  --r-sm: 12px;
  --r-lg: 22px;
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(165deg, #faf7f1 0%, #f0e9dc 50%, #e8dfd0 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }

.app-shell {
  height: 100dvh;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-shell:has(.staff-dashboard),
.app-shell:has(.staff-chat-page),
.app-shell:has(.manager-wide-page) {
  max-width: 1500px;
  padding: 16px;
}

.alert {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 100;
  background: var(--gold-soft);
  border: 1px solid #e0c878;
  border-radius: var(--r);
  padding: 12px 16px;
  text-align: center;
  font-weight: 700;
  color: #5c4210;
  box-shadow: var(--shadow);
}

/* ========== Buttons & Forms ========== */
.btn {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  background: var(--card);
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  transition: 0.15s ease;
}
.btn.primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 61, 52, 0.25);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.full { width: 100%; display: block; }
.btn.danger {
  background: #fff5f2;
  border-color: #f0c4b8;
  color: var(--danger);
}
.ghost {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 13px;
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s;
}
.ghost:hover { background: #fff; }

label { font-weight: 800; font-size: 13px; color: var(--text-2); }
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 61, 52, 0.1);
}

/* ========== Brand ========== */
.brand-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 24px;
  box-shadow: var(--shadow);
}
.brand-head h1 { margin: 0; font-size: 22px; color: var(--brand); font-weight: 900; }
.brand-head p, .topline p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ========== Customer Login ========== */
.login-screen, .single-screen, .customer-auth {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.auth-hero {
  text-align: center;
  padding: 8px 4px 4px;
}
.auth-hero > p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.auth-card, .login-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.seg-title {
  font-weight: 900;
  color: var(--brand);
  font-size: 17px;
  margin-bottom: 2px;
}
.hint-line {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  padding: 10px 12px;
  border-radius: var(--r-sm);
}

/* ========== Customer Home ========== */
.home-screen, .cars-screen, .customer-order-home {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  justify-content: flex-start;
}
.topline, .cars-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topline h2, .cars-topline h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--brand);
}
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.order-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex-shrink: 0;
}
.order-guide > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.order-guide span {
  display: block;
  font-size: 11px;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 4px;
}
.order-guide b {
  display: block;
  font-size: 13px;
  color: var(--brand);
}

.tabs-card, .cars-card, .order-cars-card {
  flex: 1;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.section-title-row h3 {
  margin: 0;
  color: var(--brand);
  font-size: 17px;
}
.section-title-row p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.vehicle-list, .v6-vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  min-height: 0;
  padding-bottom: 4px;
}
.vehicle-card-v6 {
  position: relative;
  background: linear-gradient(180deg, #fff 0%, #faf8f4 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 14px 14px;
  box-shadow: 0 6px 18px rgba(20, 36, 31, 0.05);
  display: grid;
  gap: 12px;
  transition: 0.15s;
}
.vehicle-card-v6:hover {
  border-color: rgba(15, 61, 52, 0.25);
  box-shadow: var(--shadow);
}
.edit-text, .edit-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--brand);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
}
.car-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 48px;
  min-height: 48px;
}
.car-icon, .car-glyph {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  position: relative;
}
.car-glyph::after {
  content: "سيارة";
  font-size: 10px;
  font-weight: 900;
  color: var(--brand);
}
.car-title-row b {
  display: block;
  font-size: 16px;
  color: var(--text);
  line-height: 1.35;
}
.car-title-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.start-chat-btn {
  display: block;
  width: 100%;
  border-radius: var(--r-sm);
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
  text-align: center;
  font-weight: 900;
  padding: 13px 14px;
  box-shadow: 0 6px 16px rgba(15, 61, 52, 0.22);
  transition: 0.15s;
}
.start-chat-btn:hover { filter: brightness(1.05); }

.empty-state, .order-empty {
  background: var(--bg-soft);
  border: 1.5px dashed var(--gold);
  border-radius: var(--r);
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}
.empty-state b { display: block; color: var(--brand); margin-bottom: 6px; font-size: 15px; }

.add-car, .add-car-v6 {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  flex-shrink: 0;
  overflow: hidden;
}
.add-car summary, .add-car-v6 summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 900;
  color: var(--brand);
  list-style: none;
}
.add-car summary::-webkit-details-marker { display: none; }
.car-form, .compact-car-form, .v6-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}
.car-form input, .car-form .btn,
.compact-car-form input, .compact-car-form button,
.v6-add-form #manualModel, .v6-add-form input[name=vin], .v6-add-form button {
  grid-column: 1 / -1;
}

/* ========== Chat ========== */
.chat-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chat-header, .staff-chat-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
}
.chat-header h2 {
  margin: 0;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header p {
  margin: 3px 0 0;
  font-size: 11px;
  color: rgba(255,255,255,0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back, .back-clear, .icon-btn, .bell-btn {
  height: 36px;
  min-width: 36px;
  border: 0;
  border-radius: 11px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
  padding: 0 10px;
}
.back-clear { min-width: 68px; }

.chat-action-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: auto;
  padding: 8px 10px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.chat-action-strip form { margin: 0; display: flex; }
.action-chip {
  border: 1px solid rgba(15, 61, 52, 0.14);
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.action-chip.danger-chip {
  background: #fff0eb;
  color: var(--danger);
  border-color: #f0c4b8;
}
.rating-action-big, .visible-rate-btn {
  background: #e9f5ef !important;
  color: var(--brand) !important;
}
.delivery-top-btn, .visible-delivery-btn {
  background: var(--gold-soft) !important;
  color: #5c4210 !important;
}

.chat-main-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background: linear-gradient(180deg, #efe7da 0%, #f7f1e8 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 16px;
  background: var(--other);
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
  word-break: break-word;
}
.msg.mine {
  align-self: flex-end;
  background: var(--mine);
  border-bottom-left-radius: 4px;
}
.msg.other {
  align-self: flex-start;
  border-bottom-right-radius: 4px;
}
.msg p { margin: 5px 0; line-height: 1.55; font-size: 14px; }
.sender { font-weight: 900; color: var(--brand); font-size: 12px; }
.msg small {
  display: block;
  font-size: 10px;
  text-align: left;
  color: var(--muted);
  margin-top: 2px;
}
.msg-link {
  color: #1a6bc4;
  text-decoration: underline;
  font-weight: 700;
  word-break: break-all;
}
.chat-img {
  display: block;
  max-width: 220px;
  max-height: 250px;
  border-radius: 12px;
  margin: 6px 0;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.05);
}
audio {
  width: 220px;
  max-width: 100%;
  height: 38px;
  margin-top: 6px;
}
.attachment {
  display: block;
  background: #fff;
  border: 1px dashed var(--brand);
  padding: 8px;
  border-radius: 10px;
  margin: 5px 0;
  color: var(--brand);
  font-size: 12px;
}
.order-start-card {
  background: var(--card);
  border: 1.5px dashed var(--gold);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0;
}
.order-start-card b {
  display: block;
  color: var(--brand);
  font-size: 15px;
  margin-bottom: 6px;
}

.picked-file {
  flex-shrink: 0;
  margin: 0 10px 6px;
  background: var(--gold-soft);
  border: 1px solid #e0c878;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: #5c4210;
  font-weight: 800;
}

.sendbar, .sendbar-v5 {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px 68px;
  gap: 7px;
  padding: 10px;
  background: var(--card);
  border-top: 1px solid var(--line);
  align-items: center;
}
.sendbar input[name=body], .sendbar-v5 input[name=body] {
  height: 42px;
  min-width: 0;
  padding: 10px 12px;
}
.file-pill, .send-btn {
  height: 42px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: 900;
  border: 1px solid var(--line);
}
.file-pill {
  background: var(--bg-soft);
  color: var(--brand);
}
.file-pill.recording, .voice.recording {
  background: #ffe2dc !important;
  color: var(--danger) !important;
  border-color: #e8a999 !important;
  animation: pulseRec 1s infinite;
}
@keyframes pulseRec {
  50% { transform: scale(0.94); opacity: 0.8; }
}
.send-btn {
  border: 0;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 61, 52, 0.2);
}
.plus-wrap { position: relative; }
.plus-menu {
  position: absolute;
  right: 0;
  bottom: 50px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  width: 180px;
  display: grid;
  gap: 6px;
  z-index: 30;
}
.plus-menu[hidden] { display: none; }
.plus-menu label, .plus-menu button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 11px;
  text-align: right;
  cursor: pointer;
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
}

/* ========== Modals ========== */
.modal-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(10, 22, 18, 0.42);
  display: grid;
  place-items: end center;
  padding: 14px;
  backdrop-filter: blur(2px);
}
.modal-sheet[hidden] { display: none; }
.sheet-card, .mobile-sheet-card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px 24px 18px 18px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: grid;
  gap: 11px;
  position: relative;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  color: var(--brand);
  font-weight: 900;
}
.sheet-head button, .sheet-card .x {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--brand);
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
}
.muted-small { font-size: 12px; color: var(--muted); line-height: 1.6; }
.location-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
}
.location-row button {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
  cursor: pointer;
  font-size: 12px;
}
.delivery-package {
  background: var(--gold-soft) !important;
  border: 1px dashed #c79a38;
  border-radius: 12px;
  padding: 10px !important;
}
.copy-package {
  border: 1px solid var(--line);
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 10px;
  padding: 7px 10px;
  font-weight: 900;
  cursor: pointer;
  margin-top: 4px;
  font-size: 12px;
}

/* ========== Staff Dashboard ========== */
.dashboard-page, .staff-dashboard {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.staff-topline h2 { font-size: 22px; }
.stats-row, .staff-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  flex-shrink: 0;
}
.stats-row div, .staff-stats div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stats-row span, .staff-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.stats-row b, .staff-stats b {
  font-size: 24px;
  color: var(--brand);
  margin-top: 2px;
  display: block;
}
.delay-alert, .manager-delay-alert {
  background: var(--warning-soft);
  border: 1px solid #e4b752;
  color: #6b4310;
  border-radius: var(--r);
  padding: 12px 16px;
  font-weight: 900;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.manager-delay-alert {
  background: #ffe6dd;
  border-color: #df8b75;
  color: #7d2e20;
}

.staff-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  overflow: hidden;
}
.staff-col {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.staff-col h3 {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.staff-col h3 small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.staff-col.urgent { border-top: 4px solid var(--danger); }
.staff-col.waiting { border-top: 4px solid var(--gold); }
.staff-col.done { border-top: 4px solid var(--brand-2); }
.staff-chat-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.staff-chat-card {
  display: grid;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 12px;
  transition: 0.15s;
}
.staff-chat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: #fff;
}
.staff-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.staff-card-head b { font-size: 14px; }
.staff-card-head span {
  font-size: 11px;
  color: var(--brand);
  font-weight: 900;
}
.staff-car-line {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.staff-chat-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  max-height: 40px;
  overflow: hidden;
}
.staff-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.staff-card-foot small { font-size: 11px; color: var(--muted); }
.staff-card-foot em {
  font-style: normal;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

/* Staff chat workspace */
.staff-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  background: var(--bg);
  padding: 12px;
}
.staff-side-panel {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.customer-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow);
}
.customer-box h3 {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 15px;
}
.customer-box p {
  margin: 6px 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}
.quick-action, .quick-reply {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  text-align: right;
  color: var(--brand);
  font-weight: 800;
  cursor: pointer;
  margin: 0 0 6px;
  font-size: 13px;
  transition: 0.12s;
}
.quick-action:hover, .quick-reply:hover {
  background: var(--brand-soft);
}
.compact-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.compact-result input,
.compact-result button:last-child { grid-column: 1 / -1; }
.compact-result .quick-action { font-size: 12px; padding: 8px; margin: 0; }
.current-result {
  background: var(--bg-soft);
  border-radius: 11px;
  padding: 8px !important;
  color: var(--brand) !important;
  font-weight: 800;
  font-size: 12px !important;
}
.delivery-request-btn, .fixed-delivery-action button {
  width: 100%;
  border: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(145deg, var(--gold), #c49a3a);
  color: #fff;
  font-weight: 900;
  padding: 12px;
  cursor: pointer;
  margin-top: 4px;
}
.tiny-copy {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--brand);
  font-weight: 800;
  margin-inline-start: 6px;
  cursor: pointer;
  font-size: 11px;
}
.staff-sendbar {
  grid-template-columns: 46px minmax(0, 1fr) 46px 80px;
  padding: 11px;
}
.staff-sendbar input[name=body],
.staff-sendbar .file-pill,
.staff-sendbar .send-btn { height: 44px; }

/* ========== Manager ========== */
.manager-page, .manager-wide-page {
  height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 20px;
}
.manager-topline {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.manager-kpis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
}
.manager-kpis div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px 10px;
  text-align: center;
}
.manager-kpis span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.manager-kpis b {
  display: block;
  font-size: 24px;
  color: var(--brand);
  margin-top: 4px;
}
.manager-kpis .danger-kpi {
  border-color: #e0a090;
  background: #fff5f2;
}
.manager-kpis .danger-kpi b { color: var(--danger); }

.manager-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.manager-tab {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
}
.manager-tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.manager-tab-panel { display: none; }
.manager-tab-panel.active { display: block; }

.manager-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.manager-card h3 {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 16px;
}
.manager-grid, .manager-grid-v9 {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}
.manager-form { display: grid; gap: 8px; }
.manager-table, .professional-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 13px;
}
.manager-table th, .professional-table th {
  text-align: right;
  color: var(--brand);
  font-size: 12px;
  padding: 8px;
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  z-index: 1;
}
.manager-table td, .professional-table td {
  background: var(--bg-soft);
  padding: 11px 10px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.manager-table td:first-child, .professional-table td:first-child {
  border-radius: 0 10px 10px 0;
  border-right: 1px solid var(--line-soft);
}
.manager-table td:last-child, .professional-table td:last-child {
  border-radius: 10px 0 0 10px;
  border-left: 1px solid var(--line-soft);
}
.late-row td {
  background: #fff2ec !important;
  border-color: #e4a18f !important;
}
.employee-edit-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.employee-edit-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 0.8fr 0.7fr 70px;
  gap: 8px;
  align-items: center;
}
.employee-edit-row input,
.employee-edit-row select {
  padding: 9px 10px;
  border-radius: 10px;
}
.employee-edit-row button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
  cursor: pointer;
}
.quick-admin-add {
  display: grid;
  grid-template-columns: 200px 1fr 120px;
  gap: 8px;
  margin-bottom: 12px;
}
.quick-admin-add textarea { min-height: 44px; }
.quick-admin-list { display: grid; gap: 8px; }
.quick-admin-row {
  display: grid;
  grid-template-columns: 180px 1fr 70px 70px;
  gap: 8px;
}
.quick-admin-row button, .danger-mini {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
  cursor: pointer;
  padding: 8px;
}
.danger-mini {
  background: #fff0eb !important;
  color: var(--danger) !important;
}
.bank-admin-row textarea { min-height: 120px; }

.install-floating {
  margin-top: 8px;
  border: 1px solid rgba(15, 61, 52, 0.18);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--brand);
  padding: 11px 14px;
  font-weight: 900;
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* ========== Welcome (kept but unused as default) ========== */
.welcome-screen, .app-intro, .part-request-intro {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  overflow: auto;
}
.intro-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.intro-badge {
  background: var(--gold-soft);
  color: #6b4310;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 900;
}
.intro-hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-weight: 900;
  font-size: 13px;
}
.intro-hero h2 {
  margin: 8px 0;
  font-size: 24px;
  line-height: 1.4;
  color: var(--brand);
}
.intro-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}
.intro-cta { margin-top: 4px; }
.intro-preview {
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  border-radius: var(--r-lg);
  padding: 16px;
  color: #fff;
  display: grid;
  gap: 8px;
}
.preview-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.9;
}
.request-card-mini {
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.preview-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.preview-bubble.customer {
  align-self: flex-end;
  background: #dff5e8;
  color: var(--text);
  margin-inline-start: auto;
}
.preview-bubble.staff {
  background: rgba(255,255,255,0.95);
  color: var(--text);
}
.preview-tools {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.preview-tools span {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
}
.intro-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.intro-steps > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.intro-steps b {
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  line-height: 28px;
  font-size: 13px;
}
.intro-steps span { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .staff-columns { grid-template-columns: 1fr; }
  .staff-workspace { grid-template-columns: 1fr; }
  .staff-side-panel { max-height: 32dvh; }
  .staff-stats, .stats-row { grid-template-columns: repeat(2, 1fr); }
  .manager-kpis { grid-template-columns: repeat(4, 1fr); }
  .manager-grid, .manager-grid-v9 { grid-template-columns: 1fr; }
  .employee-edit-row { grid-template-columns: 1fr 1fr; }
  .employee-edit-row button { grid-column: 1 / -1; }
  .quick-admin-add, .quick-admin-row { grid-template-columns: 1fr; }
  .app-shell:has(.staff-dashboard),
  .app-shell:has(.staff-chat-page),
  .app-shell:has(.manager-wide-page) { padding: 10px; }
}

@media (max-width: 700px) {
  .manager-kpis { grid-template-columns: repeat(2, 1fr); }
  .professional-table, .manager-table {
    display: block;
    overflow: auto;
    white-space: nowrap;
  }
}

@media (max-width: 430px) {
  .app-shell { padding: 8px; max-width: 100%; }
  .order-guide { gap: 6px; }
  .order-guide b { font-size: 12px; }
  .car-form, .compact-car-form, .v6-add-form { grid-template-columns: 1fr; }
  .sendbar-v5 { grid-template-columns: 38px minmax(0,1fr) 38px 58px; gap: 5px; }
  .file-pill, .send-btn, .sendbar-v5 input[name=body] { height: 40px; }
  .msg { max-width: 90%; }
  .location-row { grid-template-columns: 1fr; }
  .ghost { padding: 7px 10px; font-size: 12px; }
  .vehicle-card-v6 { padding: 14px 12px 12px; }
  .car-title-row { padding-left: 44px; gap: 10px; }
}

@media (max-height: 700px) {
  .order-guide { display: none; }
  .cars-topline h2 { font-size: 18px; }
  input, select, .btn { padding: 11px 12px; }
}

/* Safe area */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
