:root {
  --bg: #f2f5fb;
  --surface: #ffffff;
  --border: #e5e9f2;
  --text: #1b2233;
  --muted: #6b7488;
  --primary: #2f6bff;
  --sidebar: #111b2f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.dev-notice {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 30, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 30;
  padding: 20px 14px;
}

.dev-notice-card {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 42px 14px 16px;
  position: relative;
  box-shadow: 0 12px 30px rgba(11, 22, 44, 0.22);
}

.dev-notice-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.06rem;
}

.dev-notice-card p {
  margin: 0;
  color: var(--muted);
}

.dev-notice-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: transparent;
  color: #536080;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: var(--sidebar);
  color: #dce4ff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #132548;
  border: 1px solid rgba(116, 165, 255, 0.45);
  box-shadow: 0 8px 20px rgba(47, 107, 255, 0.35);
  position: relative;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.brand-logo-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #9fc1ff;
  font-size: 1rem;
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-text strong {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-text small {
  font-size: 0.7rem;
  color: #9cb3ea;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.client-box {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 3px;
}

.client-box small { color: #9cabd7; }

.menu {
  display: grid;
  gap: 8px;
}

.menu-item {
  border: 0;
  background: transparent;
  color: #dce4ff;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.menu-item:hover,
.menu-item.active {
  background: rgba(255, 255, 255, 0.12);
}

.support-link {
  margin-top: auto;
  color: #9fc1ff;
  font-weight: 600;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.content {
  padding: 26px;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 30, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-form {
  display: none;
  gap: 10px;
}

.auth-form.active {
  display: grid;
}

.auth-card h2 {
  margin: 0;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.error {
  color: #d03030;
  min-height: 20px;
  font-size: 0.92rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h1 { margin: 0; font-size: 1.5rem; }
.balance { color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; }

.tab { display: none; }
.tab.active { display: block; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.card h3,
.panel h2 {
  margin: 0 0 8px;
}

.card p,
.panel p {
  margin: 0 0 12px;
  color: var(--muted);
}

.columns {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn.ghost {
  background: #edf2ff;
  color: #385bb5;
}

.info-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; font-weight: 600; }

.table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.row-services {
  grid-template-columns: 1.3fr 2fr 0.8fr 0.8fr;
}

.row:last-child { border-bottom: 0; }
.row.head { background: #f8f9fc; font-weight: 600; }
.ok { color: #14944f; font-weight: 600; }

.support-form {
  display: grid;
  gap: 10px;
}

.support-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.two-cols {
  grid-template-columns: 1fr 1fr;
}

.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 500 !important;
}

.checkbox-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

input, textarea {
  border: 1px solid #d5dcea;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

select {
  border: 1px solid #d5dcea;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted-line {
  color: var(--muted);
  min-height: 20px;
  font-size: 0.92rem;
}

.ticket-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.ticket-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.unread-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #ff4d4f;
  color: #fff;
}

.empty {
  color: var(--muted);
  padding: 12px;
  background: #f8f9fc;
  border-radius: 10px;
}

.admin-ticket {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.admin-ticket-head {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-users-table th,
.admin-users-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
}

.dialogs-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
}

.orders-pane,
.messages-pane {
  border: 1px solid #dbe3f3;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
  padding: 12px;
}

.orders-pane {
  max-height: 560px;
  overflow: auto;
}

.messages-pane {
  display: grid;
  gap: 10px;
}

.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge-light {
  background: #eaf1ff;
  color: #2e5dc6;
  border-radius: 999px;
  padding: 3px 9px;
  font-weight: 600;
  font-size: 0.85rem;
}

.order-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: 0.15s ease;
}

.order-item.active {
  border-color: #82a8ff;
  background: #eef4ff;
  box-shadow: 0 1px 0 rgba(47, 107, 255, 0.08);
}

.order-item:hover {
  border-color: #9bb8f5;
}

.dialog-header {
  font-weight: 600;
  font-size: 1rem;
  color: #202b44;
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.typing-indicator {
  color: #5b6f9d;
  font-size: 0.85rem;
  min-height: 18px;
}

.messages-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 280px;
  max-height: 380px;
  overflow: auto;
  padding: 12px;
  background: #f8fbff;
}

.dialog-empty-state {
  border: 1px dashed #cfd9ee;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  background: #f7faff;
}

.empty-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.dialog-empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.message-bubble {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  margin-bottom: 8px;
  max-width: 82%;
  background: #fff;
}

.message-bubble.mine {
  margin-left: auto;
  background: #eaf2ff;
  border-color: #cbdcff;
}

.message-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.message-time {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.message-attachment {
  margin-top: 6px;
}

.message-attachment a {
  color: #2f6bff;
  text-decoration: none;
}

.quick-order {
  border: 1px solid #e4e9f4;
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(33, 65, 130, 0.04);
}

.quick-order h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.dropzone {
  border: 1px dashed #9ab4ef;
  background: #f5f9ff;
  color: #365aa9;
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: #2f6bff;
  background: #e9f1ff;
}

.attachment-preview {
  border: 1px solid #d8e2f4;
  background: #f9fbff;
  border-radius: 10px;
  padding: 8px;
}

.attachment-preview img {
  max-width: 180px;
  max-height: 120px;
  border-radius: 8px;
  display: block;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { gap: 12px; }
  .columns { grid-template-columns: 1fr; }
  .dialogs-grid { grid-template-columns: 1fr; }
  .form-grid.two-cols { grid-template-columns: 1fr; }
}
