/* ============================================================
   CRM — Main Stylesheet
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:         #f1f5f9;
  --color-surface:    #ffffff;
  --color-border:     #e2e8f0;
  --color-text:       #1e293b;
  --color-text-muted: #64748b;
  --color-primary:    #4f46e5;
  --color-primary-h:  #4338ca;
  --color-success:    #16a34a;
  --color-warn:       #d97706;
  --color-danger:     #dc2626;
  --color-high:       #dc2626;
  --color-medium:     #d97706;
  --color-low:        #16a34a;
  --sidebar-w:        220px;
  --radius:           6px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:        0 4px 12px rgba(0,0,0,.10);
  --font:             -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:             "SF Mono", "Fira Code", Consolas, monospace;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 12px; }
h3 { font-size: 1rem; font-weight: 600; }

/* ---- Layout ---- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.main-content {
  padding: 28px 32px;
  overflow-x: hidden;
  min-width: 0;
  max-width: 100%;
}

.bg-gray { background: var(--color-bg); }

/* ---- Sidebar ---- */
.sidebar {
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid #334155;
}
.sidebar-brand a {
  color: #f8fafc;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -.02em;
}

.sidebar-nav {
  list-style: none;
  padding: 10px 0;
  flex: 1;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #94a3b8;
  font-size: .9rem;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-radius: 0;
}
.sidebar-nav li a:hover { background: #334155; color: #f1f5f9; }
.sidebar-nav li.active a { background: var(--color-primary); color: #fff; }
.nav-icon { font-style: normal; width: 18px; text-align: center; }
.nav-divider { height: 1px; background: #334155; margin: 6px 18px; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #334155;
  font-size: .8rem;
}
.sidebar-user { margin-bottom: 8px; }
.user-name { display: block; color: #f1f5f9; font-weight: 600; }
.user-role { color: #64748b; font-size: .75rem; text-transform: capitalize; }
.btn-logout {
  color: #94a3b8;
  font-size: .8rem;
  text-decoration: none;
}
.btn-logout:hover { color: #f87171; text-decoration: none; }

/* ---- Page header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 { line-height: 1.2; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.breadcrumb { font-size: .8rem; color: var(--color-text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }

.btn-primary  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-h); border-color: var(--color-primary-h); color: #fff; }

.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #f8fafc; }

.btn-ghost { background: transparent; color: var(--color-text-muted); border-color: transparent; }
.btn-ghost:hover { background: #f1f5f9; color: var(--color-text); }

.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm   { font-size: .78rem; padding: 4px 10px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 1rem;
  transition: background .12s;
  text-decoration: none;
}
.btn-icon:hover { background: var(--color-border); color: var(--color-text); text-decoration: none; }

.btn-icon-sm { font-size: .8rem; padding: 2px 5px; color: var(--color-text-muted); }
.btn-icon-sm:hover { color: var(--color-primary); }

.btn-toggle {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-toggle-on  { background: #dcfce7; color: #15803d; border-color: #86efac; }
.btn-toggle-off { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ---- Forms ---- */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: 860px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 5px;
}
.form-control {
  display: block;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--color-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }

.form-hint { font-size: .78rem; color: var(--color-text-muted); margin-top: 4px; }
.form-static { font-size: .9rem; color: var(--color-text); padding: 6px 0; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.required { color: var(--color-danger); }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 400;
}
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---- Collection dropdown ---- */
.collection-dropdown {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 220px;
  max-width: 280px;
}
.collection-dropdown-inner {
  padding: 12px;
}
.coll-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: .85rem;
  cursor: pointer;
  color: #1e293b;
}
.coll-btn:hover { background: #f1f5f9; }

/* ---- Export row exclusion ---- */
tr.row-excluded td {
  opacity: .35;
  text-decoration: line-through;
}
tr.row-excluded td:first-child {
  text-decoration: none;
  opacity: 1;
}

/* ---- Column picker ---- */
.col-picker-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.col-picker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: default;
  user-select: none;
}
.col-picker-item.drag-over {
  border-color: #6366f1;
  background: #eef2ff;
}
.col-drag-handle {
  cursor: grab;
  color: #94a3b8;
  font-size: .9rem;
  line-height: 1;
}
.col-drag-handle:active { cursor: grabbing; }
.col-picker-item label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  cursor: pointer;
  font-size: .875rem;
  white-space: nowrap;
}

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.filter-search { flex: 1; min-width: 200px; max-width: 320px; }
.filter-select { width: auto; min-width: 140px; }

/* ---- Tables ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  font-size: .875rem;
}
.table th {
  text-align: left;
  padding: 10px 13px;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table td {
  padding: 10px 13px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.table-hover tbody tr:nth-child(even) { background: #f8fafc; }
.table-hover tbody tr:hover { background: #eef2ff; }
.table-compact td, .table-compact th { padding: 7px 13px; }
.row-actions { text-align: right; white-space: nowrap; width: 1%; }
.row-inactive td { opacity: .5; }
.row-urgent td:first-child { border-left: 3px solid var(--color-danger); }
.row-warn   td:first-child { border-left: 3px solid var(--color-warn); }

.sort-link { color: var(--color-text-muted); text-decoration: none; }
.sort-link:hover { color: var(--color-text); }
.sort-asc::after  { content: " ▲"; font-size: .7rem; }
.sort-desc::after { content: " ▼"; font-size: .7rem; }

/* ---- Dashboard ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.stat-card-warn { border-top: 3px solid var(--color-warn); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--color-text); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: .8rem; color: var(--color-text-muted); font-weight: 500; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.dash-panel--full { grid-column: span 2; }

.dash-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.panel-header h2 { margin-bottom: 0; }
.panel-link { font-size: .8rem; color: var(--color-primary); }

.contact-list { list-style: none; }
.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: .875rem;
}
.contact-list li:last-child { border-bottom: none; }

.email-list { list-style: none; }
.email-list li { padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: .875rem; }
.email-list li:last-child { border-bottom: none; }

/* ---- Contact view layout ---- */
.contact-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

.contact-sidebar { display: flex; flex-direction: column; gap: 16px; }

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.info-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.info-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.info-card-header h3 { margin-bottom: 0; }

.info-list { font-size: .875rem; }
.info-list dt { color: var(--color-text-muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 10px; }
.info-list dt:first-child { margin-top: 0; }
.info-list dd { color: var(--color-text); margin-left: 0; word-break: break-word; }

.deadline-list { list-style: none; font-size: .875rem; }
.deadline-list li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.deadline-list li:last-child { border-bottom: none; }
.deadline-list li.completed { opacity: .5; text-decoration: line-through; }
.deadline-date { color: var(--color-text-muted); font-size: .78rem; white-space: nowrap; }
.deadline-desc { flex: 1; }

.file-list { list-style: none; font-size: .875rem; }
.file-list li { padding: 5px 0; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 8px; }

/* ---- Timeline ---- */
.contact-timeline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.timeline-add { padding: 10px 16px; border-bottom: 1px solid var(--color-border); }
.timeline { padding: 0; }
.timeline-item {
  padding: 8px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item:hover { background: #fafafa; }
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 3px;
  font-size: .8rem;
}
.timeline-author { font-weight: 600; }
.timeline-date { color: var(--color-text-muted); margin-left: auto; }
.timeline-body { font-size: .875rem; word-break: break-word; }
.note-text { white-space: pre-wrap; margin: 0; }
.doc-link { margin-top: 4px; font-size: .8rem; }

/* ---- Tabs ---- */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  padding: 0 16px;
  background: #f8fafc;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-content { padding: 0; }
.tab-content.hidden { display: none; }

/* ---- Email thread list ---- */
.thread-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.thread-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: var(--color-text);
  transition: background .12s;
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: #f8fafc; text-decoration: none; }
.thread-unread { background: #eff6ff; }
.thread-unread .thread-subject { font-weight: 700; }
.thread-subject { font-size: .9rem; color: var(--color-text); }
.thread-meta { font-size: .78rem; color: var(--color-text-muted); margin-top: 2px; }
.thread-col-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.thread-date { font-size: .78rem; color: var(--color-text-muted); white-space: nowrap; }

/* ---- Email message view ---- */
.email-thread { display: flex; flex-direction: column; gap: 16px; }
.email-message {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.email-outbound { border-color: #c7d2fe; }
.email-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.email-from { display: flex; align-items: center; gap: 10px; }
.email-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.email-date { font-size: .78rem; color: var(--color-text-muted); white-space: nowrap; }
.email-to, .email-cc { font-size: .78rem; color: var(--color-text-muted); padding: 4px 18px; background: #fafafa; border-bottom: 1px solid #f1f5f9; }
.email-body { padding: 16px 18px; font-size: .875rem; }
.email-html-body { max-width: 100%; overflow-x: auto; }
.email-html-body * { max-width: 100%; }
.email-text-body { white-space: pre-wrap; font-family: var(--font); word-break: break-word; }
.email-attachments { padding: 8px 18px 14px; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid #f1f5f9; }
.att-link { font-size: .8rem; color: var(--color-primary); background: #eff6ff; border: 1px solid #c7d2fe; border-radius: 4px; padding: 3px 8px; }
.note-attachments { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.att-img-wrap { display: inline-block; border: 1px solid var(--color-border); border-radius: 4px; overflow: hidden; line-height: 0; }
.att-img { display: block; max-height: 80px; max-width: 120px; object-fit: cover; }

/* ---- Badges & tags ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-high   { background: #fee2e2; color: var(--color-high); }
.badge-medium { background: #fef3c7; color: var(--color-medium); }
.badge-low    { background: #dcfce7; color: var(--color-low); }
.badge-unread { background: var(--color-primary); color: #fff; }
.badge-warn   { background: #fef3c7; color: var(--color-warn); }
.badge-count  { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; background: #e0e7ff; color: var(--color-primary); font-size: .72rem; font-weight: 700; border-radius: 20px; padding: 0 6px; }
.count-badge  { font-size: .85rem; font-weight: 400; color: var(--color-text-muted); margin-left: 6px; }

.tag {
  display: inline-block;
  background: #f1f5f9;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: .75rem;
}
.tag-sm { font-size: .7rem; padding: 1px 5px; }
.tag-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); font-weight: 600; }
.shows-tags { font-size: .78rem; color: var(--color-text-muted); }

/* ---- Alerts / Flash ---- */
.alert {
  padding: 11px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .875rem;
  border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.alert-warn    { background: #fffbeb; color: #92400e; border-color: #fcd34d; }

.flash {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 9999;
  padding: 12px 40px 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
  max-width: 380px;
}
.flash-success { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.flash-error   { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.flash-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none; border: none;
  font-size: 1.1rem; cursor: pointer;
  color: inherit; opacity: .6;
}
.flash-close:hover { opacity: 1; }

/* ---- Auth pages ---- */
.auth-wrap  { max-width: 420px; margin: 60px auto; padding: 0 16px; }
.auth-card  { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 32px 36px; box-shadow: var(--shadow-md); }
.auth-logo  { text-align: center; margin-bottom: 24px; }
.auth-logo h1 { font-size: 1.8rem; }
.auth-logo p  { color: var(--color-text-muted); }

/* ---- Admin ---- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.admin-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow .15s, transform .15s;
  display: block;
}
.admin-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.admin-card-icon  { font-size: 1.8rem; margin-bottom: 10px; }
.admin-card-title { font-weight: 700; margin-bottom: 4px; }
.admin-card-stat  { font-size: .8rem; color: var(--color-text-muted); }
.admin-split { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }

/* ---- Company URL ---- */
.company-url { font-size: .85rem; color: var(--color-text-muted); display: block; margin-top: 2px; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
}
.page-info { font-size: .85rem; color: var(--color-text-muted); }

/* ---- Empty states ---- */
.empty-state { color: var(--color-text-muted); font-size: .875rem; padding: 12px 0; }
.empty-state-block {
  text-align: center;
  padding: 48px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
}
.empty-state-block p { margin-bottom: 14px; }

/* ---- Utility ---- */
.text-muted  { color: var(--color-text-muted) !important; }
.text-danger { color: var(--color-danger) !important; }
.sub-text    { font-size: .78rem; color: var(--color-text-muted); margin-top: 1px; }
.small       { font-size: .78rem; }
.hidden      { display: none !important; }

/* ---- Import page ---- */
.import-tip {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.7;
}
.import-tip code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .8rem;
  color: #334155;
}
.import-examples { margin-top: 32px; }
.import-examples h3 { font-size: 1rem; margin-bottom: 14px; color: var(--color-text-muted); }
.import-examples h4 { font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.example-grid pre {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: .78rem;
  overflow-x: auto;
  white-space: pre;
}
.preview-summary { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.preview-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  text-align: center;
  min-width: 110px;
}
.preview-stat-ok   { border-color: #86efac; background: #f0fdf4; }
.preview-stat-warn { border-color: #fcd34d; background: #fffbeb; }
.preview-num   { display: block; font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.preview-label { font-size: .75rem; color: var(--color-text-muted); margin-top: 2px; display: block; }
.col-map     { font-size: .7rem; color: var(--color-text-muted); font-weight: 400; }
.col-ignored { color: var(--color-text-muted); }
.table-wrap  { overflow-x: auto; }
.row-error   { background: #fff5f5; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }

/* ---- Company flags ---- */
.badge-client {
  background: #dbeafe;
  color: #1e40af;
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .02em;
  vertical-align: middle;
}
.company-category {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  margin-bottom: 4px;
}
.company-shows {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .stats-grid      { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid  { grid-template-columns: repeat(2, 1fr); }
  .dash-panel--full { grid-column: span 2; }
  .contact-layout  { grid-template-columns: 1fr; }
  .admin-grid      { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .app-layout   { grid-template-columns: 1fr; }
  .sidebar      { position: static; height: auto; }
  .main-content { padding: 16px; }
  .stats-grid   { grid-template-columns: repeat(2,1fr); }
  .form-grid-2  { grid-template-columns: 1fr; }
  .admin-split  { grid-template-columns: 1fr; }
  .admin-grid   { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .admin-grid  { grid-template-columns: 1fr; }
  .auth-card   { padding: 24px 20px; }
}
