:root {
  --bg: #f7f7f7;
  --bg2: #ffffff;
  --bg3: #fff3e8;
  --card: #ffffff;
  --card-hover: #fff8f0;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #f05a10;
  --accent2: #d14a0a;
  --green: #2ecc71;
  --yellow: #f1c40f;
  --orange: #f05a10;
  --red: #e74c3c;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  min-height: 100dvh;
  padding: 0 12px 16px;
  box-sizing: border-box;
}

/* ===== LOGIN ===== */
.login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
}

.login-logo {
  width: 96px;
  height: 96px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.login-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -12px;
}

.login-form {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border 0.2s;
}

.login-form input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, opacity 0.2s;
  color: #fff;
  background: var(--accent);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg3);
  color: var(--accent);
}

.btn-danger {
  background: var(--red);
}

.btn-block {
  width: 100%;
}

.error-msg {
  color: var(--red);
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.2em;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Extra top space so browser UI / notch doesn't cover back, title, logout */
  padding: calc(28px + env(safe-area-inset-top, 0px)) 0 14px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--bg2);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn {
  background: transparent;
  border: 1px solid #ddd;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ===== MAIN MENU ===== */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
  flex: 1;
  align-content: center;
}

@media (max-width: 480px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px;
  background: var(--card);
  border: 1px solid #eee;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  min-height: 140px;
}

.menu-btn:hover {
  background: var(--card-hover);
}

.menu-btn:active {
  transform: scale(0.98);
}

.menu-btn .icon {
  width: 48px;
  height: 48px;
}

.menu-btn .icon svg {
  width: 100%;
  height: 100%;
}

/* ===== ORDERS LIST ===== */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 24px;
  -webkit-overflow-scrolling: touch;
}

.order-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--card);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  border-left: 6px solid var(--green);
  transition: background 0.2s, transform 0.15s;
}

.order-card:active {
  transform: scale(0.99);
}

.order-card.color-green { border-left-color: var(--green); }
.order-card.color-yellow { border-left-color: var(--yellow); }
.order-card.color-orange { border-left-color: var(--orange); }
.order-card.color-red { border-left-color: var(--red); }

.order-card .furn-img {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  background: var(--bg3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.order-card .furn-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.order-card .furn-img svg {
  width: 48px;
  height: 48px;
}

.furn-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 72px;
  min-height: 72px;
  background: linear-gradient(135deg, #fff3e8 0%, #ffe0c2 100%);
  border-radius: 12px;
}

.order-card .info {
  flex: 1;
  min-width: 0;
}

.order-card .surname {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-card .type-name {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.order-card .days-badge {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.days-badge.green { background: rgba(46,204,113,0.2); color: var(--green); }
.days-badge.yellow { background: rgba(241,196,15,0.2); color: var(--yellow); }
.days-badge.orange { background: rgba(230,126,34,0.2); color: var(--orange); }
.days-badge.red { background: rgba(231,76,60,0.2); color: var(--red); }

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

/* ===== DETAIL ===== */
.detail-section {
  margin-top: 8px;
}

.detail-header {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.detail-header .client {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-header .type {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.95rem;
  border-bottom: 1px solid #eee;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row .label {
  color: var(--text-muted);
}

.detail-row .value {
  font-weight: 500;
  text-align: right;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 400px) {
  .status-grid {
    grid-template-columns: 1fr;
  }
}

.status-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.status-card .s-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.status-card .s-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.status-card .s-value.yes { color: var(--green); }
.status-card .s-value.no { color: var(--red); }

.comment-box {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}

.comment-box .s-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ===== PLANS ===== */
.plans-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.plan-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.plan-card .plan-date {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-card .plan-date .today-tag {
  font-size: 0.7rem;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.plan-card textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  background: var(--bg2);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
}

.plan-card textarea:focus {
  border-color: var(--accent);
}

.plan-save-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s;
}

.plan-save-hint.show {
  opacity: 1;
  color: var(--green);
}

/* ===== FORMS ===== */
.form-section {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.select-order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  padding-bottom: 24px;
  -webkit-overflow-scrolling: touch;
}

.select-order-item {
  padding: 12px 14px;
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border 0.2s;
}

.select-order-item:hover,
.select-order-item.selected {
  border-color: var(--accent);
}

.select-order-item .name {
  font-weight: 600;
}

.select-order-item .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.two-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
}

.two-buttons .menu-btn {
  min-height: 120px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.form-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #eee;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #2ecc71;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  z-index: 100;
  transition: transform 0.3s;
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--red);
}

/* Install banner */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg3);
  padding: 12px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.install-banner.show {
  display: flex;
}

.install-banner p {
  flex: 1;
  font-size: 0.9rem;
}

.install-banner button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* ===== CHAT / CORRESPONDENCE ===== */
.chat-section {
  margin-top: 16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.chat-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
}

.chat-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-msg {
  background: var(--bg2);
  border-radius: 10px;
  padding: 10px 12px;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chat-meta strong {
  color: var(--accent);
}

.chat-text {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.chat-form input:focus {
  border-color: var(--accent);
}

.chat-form .btn {
  padding: 12px 16px;
  white-space: nowrap;
}

/* ===== USERS ===== */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.user-login {
  font-weight: 600;
  font-size: 1.05rem;
}

.you-tag {
  font-size: 0.75rem;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  margin-left: 6px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* ===== DIRECTOR PANEL ===== */
.director-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 32px;
  width: 100%;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #eee;
}

.stat-card-wide {
  grid-column: 1 / -1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.stat-value.accent {
  color: var(--accent);
  font-size: 1.4rem;
}

.period-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.period-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.period-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.chart-block {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #eee;
}

.chart-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 14px;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 8px;
  align-items: center;
}

.chart-bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.chart-bar-track {
  height: 18px;
  background: #f0f0f0;
  border-radius: 9px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 9px;
  min-width: 4px;
  transition: width 0.3s ease;
}

.chart-bar-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
  min-width: 70px;
}

.chart-line-wrap {
  width: 100%;
}

.chart-line-svg {
  width: 100%;
  height: 180px;
  display: block;
}

.chart-svg-label {
  font-size: 11px;
  fill: #6b6b6b;
}

.chart-line-legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

@media (max-width: 400px) {
  .chart-bar-row {
    grid-template-columns: 56px 1fr auto;
  }
  .stat-value {
    font-size: 1.05rem;
  }
}

/* ===== COLUMN CHARTS (director) ===== */
.col-chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.col-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 0 4px;
}

.col-bar {
  flex: 0 0 32px;
  width: 32px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: default;
}

.col-bar-val {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
  white-space: nowrap;
  min-height: 12px;
}

.col-bar-stem {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 20px;
}

.col-bar-fill {
  width: 70%;
  max-width: 22px;
  border-radius: 4px 4px 2px 2px;
  min-height: 0;
  transition: height 0.25s ease;
}

.col-bar-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
  line-height: 1.1;
  max-width: 36px;
  overflow: hidden;
  white-space: nowrap;
}

.chart-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

.chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -8px 0 12px;
}

.multi-line-svg {
  display: block;
  overflow: visible;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  justify-content: center;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-svg-label {
  font-size: 10px;
  fill: #6b6b6b;
}

.chart-with-side {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
}

.chart-side {
  flex: 0 0 92px;
  width: 92px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  border-right: 1px solid #eee;
  padding: 6px 6px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-side-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chart-side-item {
  display: flex;
  gap: 5px;
  align-items: flex-start;
}

.chart-side-text {
  min-width: 0;
}

.chart-side-name {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.chart-side-nums {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.3;
  font-weight: 600;
}

.chart-with-side .col-chart-scroll {
  flex: 1;
  min-width: 0;
}

@media (max-width: 380px) {
  .chart-side {
    flex: 0 0 80px;
    width: 80px;
  }
}

.col-bar-active .col-bar-fill {
  outline: 2px solid #1a1a1a;
  outline-offset: 1px;
}

.col-bar {
  cursor: pointer;
}

.chart-hit {
  cursor: pointer;
  pointer-events: all;
}

.chart-side-big {
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  color: var(--text) !important;
}

.chart-side-nums.muted {
  opacity: 0.6;
  font-weight: 500 !important;
}

.chart-side-val {
  font-weight: 800 !important;
  color: var(--text) !important;
  font-size: 0.78rem !important;
}

.chat-photo-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  border: 1px solid #eee;
}

.chat-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 6px;
  background: var(--bg3);
  border-radius: 10px;
}

.chat-preview img {
  max-height: 80px;
  max-width: 120px;
  border-radius: 8px;
  object-fit: cover;
}

.chat-preview-clear {
  border: none;
  background: #333;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.chat-img-link {
  display: block;
  margin-top: 6px;
}

.chat-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #eee;
}

.orders-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 12px;
  width: 100%;
}

.orders-search {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  border: 1px solid #e0e0e0;
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-chip.color-red.active { background: #e53935; border-color: #e53935; }
.filter-chip.color-orange.active { background: #fb8c00; border-color: #fb8c00; }
.filter-chip.color-yellow.active { background: #f9a825; border-color: #f9a825; color: #222; }
.filter-chip.color-green.active { background: #43a047; border-color: #43a047; }

@media print {
  .header, .chat-section, .form-actions, .menu-grid, .logout-btn, .back-btn { display: none !important; }
}

html.dark {
  --bg: #121212;
  --bg3: #1e1e1e;
  --card: #1c1c1c;
  --text: #f0f0f0;
  --text-muted: #aaa;
  --accent: #f05a10;
  color-scheme: dark;
}
html.dark body { background: var(--bg); color: var(--text); }
html.dark .order-card, html.dark .stat-card, html.dark .chart-block, html.dark .detail-section, html.dark .form-section, html.dark .status-card {
  background: var(--card); border-color: #333;
}
html.dark input, html.dark textarea, html.dark select {
  background: #2a2a2a; color: #f0f0f0; border-color: #444;
}

.dash-banner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.dash-item {
  background: var(--card);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
  border: 1px solid #eee;
}
.dash-item.danger { border-color: #e53935; }
html.dark .dash-item { border-color: #333; }

.status-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}
.status-step {
  border: 1px solid #ddd;
  background: var(--card);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.status-step.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.order-card.pinned { box-shadow: 0 0 0 2px var(--accent); }
.bulk-check { margin-right: 8px; width: 18px; height: 18px; }

.checklist-box {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
  border: 1px solid #eee;
}
.check-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 0.9rem;
}
.btn-sm { padding: 8px 12px; font-size: 0.85rem; }
.reply-bar, .chat-reply-quote {
  font-size: 0.8rem;
  background: var(--bg3);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.chat-actions { margin-top: 4px; }
.link-btn {
  background: none; border: none; color: var(--accent);
  font-size: 0.75rem; cursor: pointer; padding: 0;
}
.chat-audio { width: 100%; margin-top: 6px; }
.pinned-msg { border-left: 3px solid var(--accent); padding-left: 8px; }

.check-add-row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.check-add-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  font-size: 0.95rem;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-item .check-text { flex: 1; }
.empty-hint {
  font-size: 0.85rem;
  color: #888;
  padding: 8px 0;
}