/* ═══════════════════════════════════════════════════════════════════════════
   Zakito Desk — Global Styles
   Brand: Blue #501ae7 | Red #e71c42 | BrightBG #d4cee5 | DarkBG #10052d
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Light Theme) ─────────────────────────────────── */
:root {
  --brand-blue:   #501ae7;
  --brand-red:    #e71c42;
  --brand-blue-light: #6b3ff0;
  --brand-blue-dark:  #3d12b3;

  --bg-primary:   #ffffff;
  --bg-secondary: #f7f5fc;
  --bg-sidebar:   #10052d;
  --bg-card:      #ffffff;
  --bg-hover:     #f0ecfb;

  --text-primary:   #1a0a3d;
  --text-secondary: #6b6585;
  --text-muted:     #9591a8;
  --text-sidebar:   #d4cee5;
  --text-sidebar-active: #ffffff;

  --border-color:   #e2ddf0;
  --border-light:   #f0ecfb;

  --sidebar-width: 240px;
  --topbar-height: 56px;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(80,26,231,.08);
  --shadow:    0 4px 16px rgba(80,26,231,.12);
  --shadow-lg: 0 8px 32px rgba(80,26,231,.16);

  --transition: .15s ease;

  /* Badge colors */
  --badge-new:      #501ae7;
  --badge-open:     #059669;
  --badge-pending:  #d97706;
  --badge-resolved: #0284c7;
  --badge-closed:   #6b7280;

  --priority-low:    #6b7280;
  --priority-normal: #0284c7;
  --priority-high:   #d97706;
  --priority-urgent: #e71c42;
}

/* ── Dark Theme ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-primary:   #1a0f2e;
  --bg-secondary: #120828;
  --bg-sidebar:   #0a0318;
  --bg-card:      #211540;
  --bg-hover:     #2d1f50;

  --text-primary:   #e8e4f8;
  --text-secondary: #a89fc8;
  --text-muted:     #6b6090;
  --text-sidebar:   #c4bde0;
  --text-sidebar-active: #ffffff;

  --border-color:  #2d2050;
  --border-light:  #241848;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 4px 16px rgba(0,0,0,.5);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Layout ──────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo a {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--brand-blue);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}
.logo-text { font-weight: 600; font-size: 15px; color: #fff; }

/* Sidebar nav */
.sidebar-nav { padding: 8px 0; flex: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 12px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  color: var(--text-sidebar);
  font-size: 13px;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active {
  background: var(--brand-blue);
  color: #fff;
  font-weight: 500;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}
.user-info { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--brand-blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: #fff; }
.user-role { font-size: 11px; color: rgba(255,255,255,.45); }
.user-details { overflow: hidden; }

.theme-toggle-row {
  display: flex; align-items: center; gap: 4px;
  padding-top: 4px;
}

/* Język dropdown */
.lang-switcher { position: relative; }
.lang-dropdown {
  position: absolute;
  bottom: 100%; left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: none;
  min-width: 140px;
  z-index: 200;
}
.lang-switcher:hover .lang-dropdown,
.lang-dropdown:hover { display: block; }
.lang-option {
  display: block; width: 100%;
  padding: 8px 12px;
  background: none; border: none; cursor: pointer;
  color: var(--text-primary); font-size: 13px; text-align: left;
}
.lang-option:hover { background: var(--bg-hover); }
.lang-option.active { color: var(--brand-blue); font-weight: 500; }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:active { transform: translateY(1px); }

.btn-primary   { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.btn-primary:hover { background: var(--brand-blue-dark); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger    { background: var(--brand-red); color: #fff; border-color: var(--brand-red); }
.btn-block     { width: 100%; justify-content: center; }
.btn-sm        { padding: 4px 10px; font-size: 12px; }
.btn-icon      { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px 6px; border-radius: var(--radius-sm); font-size: 14px; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon-text { background: none; border: none; color: var(--brand-blue); cursor: pointer; padding: 0; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.btn-link { background: none; border: none; cursor: pointer; color: var(--brand-blue); font-size: 12px; padding: 2px 6px; border-radius: var(--radius-sm); }
.btn-link.active { font-weight: 700; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-control {
  display: block; width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(80,26,231,.12);
}
.form-control:disabled { opacity: .6; cursor: not-allowed; background: var(--bg-secondary); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group-sm { max-width: 120px; }

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 720px;
}
.form-card-compact { padding: 16px; }

.form-actions { display: flex; gap: 8px; margin-top: 20px; }

/* Color picker */
.color-input-row { display: flex; align-items: center; gap: 8px; }
.color-picker { width: 36px; height: 34px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); cursor: pointer; padding: 2px; }
.color-text { flex: 1; }

/* Checkbox grid */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.checkbox-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px;
  background: var(--bg-secondary);
  transition: all var(--transition);
}
.checkbox-item:hover { border-color: var(--brand-blue); }
.checkbox-item input[type="checkbox"] { accent-color: var(--brand-blue); }

/* ── Alerts / Flash ──────────────────────────────────────────────────────── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
[data-theme="dark"] .alert-success { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .alert-error   { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
.alert-close { background: none; border: none; cursor: pointer; font-size: 14px; opacity: .6; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-new      { background: #ede9fe; color: var(--badge-new); }
.badge-open     { background: #d1fae5; color: var(--badge-open); }
.badge-pending  { background: #fef3c7; color: var(--badge-pending); }
.badge-resolved { background: #dbeafe; color: var(--badge-resolved); }
.badge-closed   { background: #f3f4f6; color: var(--badge-closed); }
.badge-note     { background: #fef3c7; color: #92400e; }
.badge-private  { background: #fee2e2; color: #991b1b; font-size: 10px; }
.badge-default  { background: var(--bg-secondary); color: var(--text-muted); }
.badge-urgent   { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .badge-new      { background: #2d1f6e; }
[data-theme="dark"] .badge-open     { background: #064e3b; }
[data-theme="dark"] .badge-pending  { background: #78350f; }
[data-theme="dark"] .badge-resolved { background: #1e3a5f; }
[data-theme="dark"] .badge-closed   { background: #374151; }

/* Priority badges */
.priority-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
}
.priority-low    { color: var(--priority-low); }
.priority-normal { color: var(--priority-normal); }
.priority-high   { color: var(--priority-high); }
.priority-urgent { color: var(--priority-urgent); }
.priority-urgent::before { content: "🔴 "; }
.priority-high::before   { content: "🟠 "; }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 20px; font-weight: 600; flex: 1; }
.page-header .header-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.tickets-table, .admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tickets-table th, .admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.tickets-table td, .admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.ticket-row { cursor: pointer; transition: background var(--transition); }
.ticket-row:hover { background: var(--bg-hover); }
.ticket-new { border-left: 3px solid var(--brand-blue); }

.ticket-subject a { color: var(--text-primary); font-weight: 500; }
.ticket-subject a:hover { color: var(--brand-blue); text-decoration: none; }
.sender-name { display: block; font-weight: 500; }
.sender-email { font-size: 11px; }
.ticket-date { font-size: 11px; white-space: nowrap; }
.ticket-id { font-family: monospace; color: var(--text-muted); font-size: 12px; }

.admin-table-inner { margin-top: 8px; }
.actions-cell { white-space: nowrap; }
.actions-cell > * + * { margin-left: 4px; }

/* Group badge inline */
.group-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
  border: 1px solid;
}
.assignee-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-secondary); border-radius: 99px;
  padding: 2px 8px; font-size: 11px; font-weight: 500;
}

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.filter-bar form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.filter-search { min-width: 180px; flex: 1; }
.filter-select { width: auto; min-width: 120px; }

/* ── Ticket View ─────────────────────────────────────────────────────────── */
.ticket-topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.ticket-title { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.viewers-bar {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}
.viewer-chip {
  background: var(--brand-blue); color: #fff;
  border-radius: 99px; padding: 2px 8px; font-size: 11px;
}

/* 3-column layout */
.ticket-layout {
  display: grid;
  grid-template-columns: 1fr 240px 220px;
  gap: 16px;
  align-items: start;
}

.ticket-col { min-width: 0; }

/* Messages */
.messages-thread {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.message {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}
.message:last-child { border-bottom: none; }
.message.note { background: #fefce8; }
[data-theme="dark"] .message.note { background: #2d2010; }
.message.outgoing { background: var(--bg-secondary); }

.message-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.message-avatar {
  width: 32px; height: 32px;
  background: var(--brand-blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.message.outgoing .message-avatar { background: #059669; }
.message.note .message-avatar { background: #d97706; }
.message-meta { flex: 1; min-width: 0; }
.message-from { font-weight: 500; font-size: 13px; display: block; }
.message-email { font-size: 11px; }
.message-date { font-size: 11px; white-space: nowrap; margin-left: auto; }
.message-body { font-size: 13px; line-height: 1.7; }
.message-body img { max-width: 100%; height: auto; }

.message-attachments { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--text-primary);
  text-decoration: none;
}
.attachment-chip:hover { border-color: var(--brand-blue); }

/* Reply box */
.reply-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.reply-tabs {
  display: flex; border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.reply-tab {
  padding: 10px 20px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.reply-tab.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }
.reply-tab:hover { color: var(--text-primary); }

.reply-form { padding: 16px; }
.reply-footer { margin-top: 12px; display: flex; gap: 8px; }
.template-select-row { display: flex; gap: 8px; margin-bottom: 10px; }
.editor-textarea { font-family: inherit; }

/* Sidebar fields */
.fields-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
}
.fields-card h4 { font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; }
.fields-card h5 { font-size: 11px; font-weight: 600; color: var(--text-secondary); }

.field-row { margin-bottom: 10px; }
.field-row > label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 3px; }

/* Tags editor */
.tags-editor { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-checkbox { cursor: pointer; }
.tag-checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.tag-pill {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; border: 1px solid; cursor: pointer;
  transition: opacity var(--transition);
}
.tag-checkbox input:not(:checked) ~ .tag-pill { opacity: .4; }
.tag-checkbox input:checked ~ .tag-pill { opacity: 1; font-weight: 600; }

/* Sender info */
.sender-detail {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.sender-avatar-lg {
  width: 40px; height: 40px;
  background: var(--brand-blue); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.sender-name-lg { font-weight: 600; font-size: 14px; }
.sender-email-lg { font-size: 12px; color: var(--brand-blue); }

/* Orders */
.order-card {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
}
.order-id { font-weight: 600; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  min-height: 100vh;
}
.login-container { width: 100%; max-width: 400px; padding: 16px; }
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon-lg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--brand-blue); border-radius: var(--radius);
  color: #fff; font-size: 28px; font-weight: 700;
  margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.login-footer { margin-top: 20px; text-align: center; }
.lang-switcher-inline { display: flex; justify-content: center; gap: 4px; }

/* ── Admin cards ──────────────────────────────────────────────────────────── */
.admin-nav-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.admin-nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center; text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}
.admin-nav-card:hover {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.card-icon { font-size: 32px; margin-bottom: 8px; }
.card-label { font-size: 13px; font-weight: 500; }

/* ── Template group card ─────────────────────────────────────────────────── */
.template-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.template-group-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.template-group-header h3 { font-size: 15px; font-weight: 600; }
.tg-access { flex: 1; font-size: 12px; color: var(--text-muted); }
.tg-actions { display: flex; gap: 6px; }

/* ── Tags admin ──────────────────────────────────────────────────────────── */
.tags-admin-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.tags-list { display: flex; flex-direction: column; gap: 8px; }
.tag-admin-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.tag-pill-lg { padding: 4px 12px; border-radius: 99px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.tag-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tag-edit-row { display: flex; align-items: center; gap: 6px; flex: 1; }
.tag-actions { margin-left: auto; display: flex; gap: 4px; }

/* ── Custom fields layout ────────────────────────────────────────────────── */
.cf-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.cf-list { display: flex; flex-direction: column; gap: 6px; }
.cf-item {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); overflow: hidden;
}
.cf-item-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer;
}
.cf-item-header:hover { background: var(--bg-hover); }
.cf-label { font-weight: 500; font-size: 13px; }
.cf-name { font-family: monospace; font-size: 11px; flex: 1; }
.cf-order { font-size: 11px; }
.cf-item-edit { padding: 12px; border-top: 1px solid var(--border-light); }

/* Settings section (email accounts) */
.settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.settings-section h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

/* Role dots/badges */
.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
}
.role-employee   { background: #f0fdf4; color: #166534; }
.role-manager    { background: #eff6ff; color: #1d4ed8; }
.role-admin      { background: #faf5ff; color: #6d28d9; }
.role-superadmin { background: #fff7ed; color: #c2410c; }
[data-theme="dark"] .role-employee   { background: #14532d; color: #86efac; }
[data-theme="dark"] .role-manager    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .role-admin      { background: #2e1065; color: #d8b4fe; }
[data-theme="dark"] .role-superadmin { background: #431407; color: #fdba74; }

.group-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.group-dot-lg { width: 16px; height: 16px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 6px; }
.role-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Member chips */
.member-chip {
  display: inline-block; background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 99px; padding: 1px 8px; font-size: 11px; margin: 1px;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Utility */
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--brand-red); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.pl-2 { padding-left: 8px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text-primary); color: var(--bg-card);
  padding: 10px 20px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
  z-index: 9999;
}
.toast.success { background: #059669; color: #fff; }
.toast.error   { background: var(--brand-red); color: #fff; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 500; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-dialog {
  position: relative; z-index: 1;
  background: var(--bg-card); border-radius: var(--radius-lg);
  max-width: 440px; width: 90%;
  margin: 100px auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body   { padding: 16px 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Scrollbar styling ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ticket-layout { grid-template-columns: 1fr 220px; }
  .ticket-col-sender { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-240px); transition: transform .25s ease; }
  .main-content { margin-left: 0; padding: 16px; }
  .ticket-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .tags-admin-layout, .cf-layout { grid-template-columns: 1fr; }
  .filter-bar form { flex-direction: column; }
}
