/* =============================================
   Hicko IT — Support Portal
   Branded to match couquelet.be
   Font: Poppins | Colours: navy + amber + blue
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  /* ── Brand from couquelet.be ── */
  --amber:        #f9c22e;
  --amber-dark:   #e0a800;
  --amber-light:  #fff8e1;
  --navy:         #0b3d5f;
  --navy-mid:     #1e4356;
  --navy-dark:    #0a1f2e;
  --blue:         #4272d7;
  --blue-dark:    #3868cd;
  --blue-light:   #ebf0fc;

  /* ── UI surfaces ── */
  --bg:           #f3f8fa;
  --surface:      #ffffff;
  --surface-2:    #f9fafd;
  --border:       #dde4ec;
  --border-2:     #c5d0db;

  /* ── Text ── */
  --text:         #1f2937;
  --text-2:       #4b5563;
  --text-3:       #9ca3af;

  /* ── Status ── */
  --s-blue:       #2563eb;
  --s-blue-bg:    #eff6ff;
  --s-blue-bd:    #bfdbfe;
  --s-green:      #15803d;
  --s-green-bg:   #f0fdf4;
  --s-green-bd:   #bbf7d0;
  --s-red:        #b91c1c;
  --s-red-bg:     #fef2f2;
  --s-red-bd:     #fecaca;
  --s-amber:      #92400e;
  --s-amber-bg:   #fffbeb;
  --s-amber-bd:   #fde68a;

  /* ── Layout ── */
  --sidebar-w:    240px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', 'Arial', 'Helvetica Neue', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-dark);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform .28s ease;
  border-right: 1px solid rgba(255,255,255,.06);
}

.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.content { padding: 24px; }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Use the actual logo image */
.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Fallback box if no image */
.logo-box {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy-dark);
  box-shadow: 0 2px 8px rgba(249,194,46,.3);
}

.logo-name { color: #f8fafc; font-weight: 600; font-size: 14px; }
.logo-sub  { color: #64748b; font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: .06em; }

.nav-section {
  padding: 16px 18px 4px;
  font-size: 9.5px;
  color: #3d5070;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #7a90b0;
  font-size: 13px;
  font-weight: 400;
  transition: background .15s, color .15s, border-color .15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(255,255,255,.05);
  color: #e2e8f0;
}

.nav-link.active {
  background: rgba(249,194,46,.1);
  color: var(--amber);
  border-left-color: var(--amber);
  font-weight: 500;
}

.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.user-pill { display: flex; align-items: center; gap: 9px; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(249,194,46,.15);
  border: 2px solid rgba(249,194,46,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-name { color: #e2e8f0; font-size: 12.5px; font-weight: 500; }
.user-role { color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }

.signout-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  color: #3d5070;
  transition: color .15s;
}
.signout-link:hover { color: #7a90b0; }

/* ══════════════════════════════════════════
   MOBILE MENU
══════════════════════════════════════════ */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text);
  flex-direction: column;
  gap: 4px;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
}
.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--navy);
}

.card-body { padding: 18px; }

/* ══════════════════════════════════════════
   KPI GRID
══════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--border);
  transition: box-shadow .2s, transform .15s;
}

.kpi:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.kpi-grid a { text-decoration: none; display: block; }
.kpi-grid a .kpi:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-top-color: var(--blue);
}
.kpi-grid a .kpi.kpi-accent:hover { border-top-color: var(--amber); }

.kpi-label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* ══════════════════════════════════════════
   TABLE
══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; min-width: 500px; }

th {
  padding: 10px 14px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-align: left;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); cursor: pointer; }

.td-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-3);
}

.meta-val {
  word-break: break-all;
  min-width: 0;
  flex: 1;
}

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-blue   { background: var(--s-blue-bg);  color: var(--s-blue);  border: 1px solid var(--s-blue-bd); }
.badge-amber  { background: var(--s-amber-bg); color: var(--s-amber); border: 1px solid var(--s-amber-bd); }
.badge-green  { background: var(--s-green-bg); color: var(--s-green); border: 1px solid var(--s-green-bd); }
.badge-red    { background: var(--s-red-bg);   color: var(--s-red);   border: 1px solid var(--s-red-bd); }
.badge-gray   { background: var(--surface-2);  color: var(--text-2);  border: 1px solid var(--border-2); }

/* ══════════════════════════════════════════
   BUTTONS — match couquelet.be CTA style
══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s ease;
  white-space: nowrap;
  font-family: inherit;
}

/* Primary — matches .cta-button from couquelet.be */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 4px 8px rgba(0,0,0,.1);
}

.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,.15);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-2);
}

.btn-outline:hover {
  background: var(--surface-2);
  color: var(--navy);
  border-color: var(--navy);
}

.btn-danger {
  background: var(--s-red-bg);
  color: var(--s-red);
  border-color: var(--s-red-bd);
}
.btn-danger:hover { background: #fee2e2; }

.btn-success {
  background: var(--s-green-bg);
  color: var(--s-green);
  border-color: var(--s-green-bd);
}
.btn-success:hover { background: #dcfce7; }

.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(66,114,215,.12);
}

.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* ══════════════════════════════════════════
   ALERTS
══════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}

.alert-success { background: var(--s-green-bg); color: var(--s-green); border-color: var(--s-green-bd); }
.alert-error   { background: var(--s-red-bg);   color: var(--s-red);   border-color: var(--s-red-bd); }
.alert-warning { background: var(--s-amber-bg); color: var(--s-amber); border-color: var(--s-amber-bd); }

/* ══════════════════════════════════════════
   MISC
══════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
}

.text-muted  { color: var(--text-3); }
.text-mono   { font-family: 'JetBrains Mono', monospace; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 16px;
  transition: color .15s;
}
.back-link:hover { color: var(--navy); }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ══════════════════════════════════════════
   MESSAGES
══════════════════════════════════════════ */
.msg {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.65;
}

.msg-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.msg-public   { background: var(--surface-2); border: 1px solid var(--border); }
.msg-internal { background: var(--s-amber-bg); border: 1px solid var(--s-amber-bd); border-left: 3px solid var(--amber); }
.msg-customer { background: var(--s-blue-bg); border: 1px solid var(--s-blue-bd); }

/* ══════════════════════════════════════════
   LOGIN PAGE — matches couquelet.be .card-4
══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

/* Blue bar at top matching navbar */
.login-page::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--navy-dark);
}

.login-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

/* Amber top stripe on login card */
.login-card-header {
  background: var(--navy-dark);
  padding: 24px 30px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-card-body { padding: 30px; }

.login-logo { display: flex; align-items: center; gap: 10px; }

/* ══════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════ */
.pbar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 5px;
  border: 1px solid var(--border);
}
.pbar-fill  { height: 100%; border-radius: 99px; transition: width .3s ease; }
.pbar-green { background: var(--s-green); }
.pbar-amber { background: var(--amber); }
.pbar-red   { background: var(--s-red); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.site-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer-text {
  font-size: 12px;
  color: var(--text-3);
}

.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.site-footer-brand .logo-dot {
  width: 16px; height: 16px;
  border-radius: 4px;
  background: var(--navy-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--amber);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
  .login-card-body { padding: 22px 20px; }
  .badge { font-size: 10px; padding: 2px 7px; }
}

/* =====================================================
   Rich Text Editor — consolidated
   ===================================================== */
.rte-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }

.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; background: var(--navy); }
.rte-toolbar button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.rte-toolbar button:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.6); }
.rte-toolbar .sep { width: 1px; background: rgba(255,255,255,.2); margin: 0 2px; align-self: stretch; }
.rte-toolbar button.rte-code { font-family: monospace; font-size: 13px; letter-spacing: 0; color: #7dd3fc; }
.rte-toolbar button.rte-code.active { background: #7dd3fc; color: #1e293b; border-color: #7dd3fc; }
.rte-toolbar button.rte-quote.active { background: #fde68a; color: #92400e; border-color: #fde68a; }
.rte-toolbar button.rte-link { color: #86efac; }

.rte-body { min-height: 120px; max-height: 400px; overflow-y: auto; padding: 12px 14px; font-size: 13px; line-height: 1.6; outline: none; color: #333; }
.rte-body:empty::before { content: attr(data-placeholder); color: #aaa; pointer-events: none; }
.rte-body[contenteditable='false'] { background: var(--surface-2, #f6f6f6); }
.rte-body a { color: #0b57d0; text-decoration: underline; }

/* Rendered rich text (messages, notes, descriptions) */
.rte-content { overflow: hidden; }
.rte-content ul, .rte-content ol { padding-left: 20px; margin: 4px 0; }
.rte-content li { margin: 2px 0; }
.rte-content p { margin: 0 0 4px; }
.rte-content b, .rte-content strong { font-weight: 600; }
.rte-content u { text-decoration: underline; }
.rte-content s { text-decoration: line-through; }
.rte-content a { color: var(--blue); text-decoration: underline; word-break: break-all; }
.rte-content a:hover { opacity: .8; }

.rte-content pre, .rte-body pre {
  background: #1e293b;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 3px solid #7dd3fc;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0;
}

.rte-content blockquote, .rte-body blockquote {
  border-left: 3px solid var(--amber, #f59e0b);
  margin: 6px 0;
  padding: 6px 12px;
  color: var(--text-2);
  background: rgba(245,158,11,.06);
  border-radius: 0 4px 4px 0;
  font-style: italic;
}

/* =====================================================
   LAYOUT UTILITY CLASSES — replace all inline grid/flex
   ===================================================== */

/* Detail page: main content + sidebar */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }

/* Inline flex patterns */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-center  { align-items: center; }
.flex-between { justify-content: space-between; }
.flex-end     { justify-content: flex-end; }
.gap-2  { gap: 4px; }
.gap-3  { gap: 8px; }
.gap-4  { gap: 12px; }
.gap-5  { gap: 16px; }
.gap-6  { gap: 20px; }

/* Meta row inside cards (label + value) */
.meta-row {
  display: flex;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.meta-label {
  color: var(--text-3);
  min-width: 110px;
  flex-shrink: 0;
}

/* SLA / info rows */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

/* Action button stack in sidebar */
.action-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-stack .btn { width: 100%; justify-content: center; }

/* Time log row */
.time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 6px;
}
.time-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Reply/note buttons row */
.reply-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
  flex-wrap: wrap;
}

/* =====================================================
   RESPONSIVE BREAKPOINTS
   ===================================================== */

@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr 260px; }
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* Sidebar goes below main on tablet */
  .detail-side { order: 2; }
  .detail-main { order: 1; }
  .dash-grid   { grid-template-columns: 1fr; gap: 14px; }
  .dash-right  { order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}

@media (max-width: 768px) {
  /* Sidebar */
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-wrap { margin-left: 0; }
  .topbar { padding: 0 12px; }
  .topbar-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 130px);
  }
  .content { padding: 12px; }

  /* KPI grid */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 22px; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-control { width: 100%; max-width: 100% !important; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Tables */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 10px; font-size: 12px; }

  /* Dashboard widget tables: show only first 3 cols */
  .dash-table th:nth-child(n+4),
  .dash-table td:nth-child(n+4) { display: none; }

  /* Ticket list: hide SLA + Priority columns */
  .tickets-table th:nth-child(5),
  .tickets-table td:nth-child(5),
  .tickets-table th:nth-child(6),
  .tickets-table td:nth-child(6) { display: none; }

  /* Conversations */
  .msg { margin: 0 0 10px; }
  .msg-meta { flex-direction: column; align-items: flex-start; gap: 4px; }

  /* Reply actions */
  .reply-actions { flex-direction: column; }
  .reply-actions .btn { width: 100%; justify-content: center; }

  /* Action stack already column */
  .time-actions { gap: 6px; }

  /* Notification panel */
  #notif-panel { right: 8px !important; left: 8px !important; width: auto !important; }

  /* RTE toolbar */
  .rte-toolbar { gap: 2px; padding: 6px 8px; }
  .rte-toolbar button { padding: 4px 7px; font-size: 11px; }

  /* Detail grids with inline styles (fallback for any missed) */
  div[style*="grid-template-columns:1fr 300px"],
  div[style*="grid-template-columns:1fr 280px"],
  div[style*="grid-template-columns:1fr 260px"],
  div[style*="grid-template-columns:1fr 340px"] {
    display: block !important;
  }
  div[style*="grid-template-columns:1fr 300px"] > *,
  div[style*="grid-template-columns:1fr 280px"] > *,
  div[style*="grid-template-columns:1fr 260px"] > *,
  div[style*="grid-template-columns:1fr 340px"] > * {
    margin-bottom: 14px;
  }

  .site-footer { flex-direction: column; align-items: flex-start; padding: 12px; }
  .truncate { max-width: 120px !important; }
  .hide-mobile { display: none !important; }
}

@media (max-width: 600px) {
  .dash-right { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 20px; }
  .content { padding: 8px; }
  .card { border-radius: 6px; }
  .badge { font-size: 10px; padding: 2px 6px; }
  .login-wrap { min-height: 100svh; padding: 16px; }
  .meta-label { min-width: 90px; }
}

/* Touch targets */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .nav-link { min-height: 42px; }
  .rte-toolbar button { min-height: 34px; }
  input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; }
}

/* Notch/home-bar safe area */
.sidebar { padding-bottom: env(safe-area-inset-bottom, 0); }
.content { padding-bottom: max(24px, env(safe-area-inset-bottom, 0)); }

/* ── Dashboard layout ─────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.dash-left  { display: flex; flex-direction: column; gap: 16px; }
.dash-right { display: flex; flex-direction: column; gap: 16px; }
.dash-muted { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.dash-empty { padding: 20px 16px; font-size: 13px; color: var(--text-3); }

/* =====================================================
   UI REFINEMENTS — Step 2 polish layer
   Pure visual layer on top of the base system.
   Safe to remove as a block if anything looks off.
   ===================================================== */

/* ── Micro-interactions & accessibility ── */
::selection { background: rgba(249,194,46,.35); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn:focus-visible { outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Thin branded scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
*::-webkit-scrollbar-track { background: transparent; }

/* ── Topbar: subtle frosted-glass ── */
.topbar {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Sidebar polish ── */
.nav-link { border-radius: 0 6px 6px 0; margin-right: 10px; }
.nav-link:hover { transform: translateX(1px); }
.nav-link svg { transition: transform .15s ease; }
.nav-link:hover svg { transform: scale(1.1); }

/* ── Cards: calmer borders, hover lift only where clickable ── */
.card { transition: box-shadow .18s ease; }
.card-header { min-height: 48px; }
.card-title { letter-spacing: .01em; }

/* ── Tables: denser, calmer, easier to scan ── */
th {
  font-size: 10.5px;
  letter-spacing: .08em;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

td { padding: 10px 14px; vertical-align: middle; }

tbody tr:hover { background: var(--blue-light); }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--blue); }

.td-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

/* ── Badges: consistent pills ── */
.badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 3px 10px;
  line-height: 1.5;
  white-space: nowrap;
}

/* ── Buttons: consistent height, tactile press ── */
.btn {
  transition: background .15s ease, border-color .15s ease,
              box-shadow .15s ease, transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(66,114,215,.35); }
.btn-primary:hover { box-shadow: 0 3px 8px rgba(66,114,215,.35); }

/* ── Alerts: icon + slide-in ── */
@keyframes alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: alert-in .22s ease;
  box-shadow: var(--shadow-sm);
}
.alert::before { font-weight: 700; flex-shrink: 0; }
.alert-success::before { content: '✓'; }
.alert-error::before   { content: '✕'; }
.alert-warning::before { content: '!'; }

/* ── Conversation bubbles ── */
.msg { transition: box-shadow .15s ease; }
.msg:hover { box-shadow: var(--shadow-sm); }
.msg-meta { font-size: 11.5px; }

/* ── Forms: clearer focus ── */
.form-control { transition: border-color .15s ease, box-shadow .15s ease; }
.form-control:hover:not(:focus) { border-color: var(--border-2); }

/* ── KPI cards ── */
.kpi-value { font-variant-numeric: tabular-nums; }

/* ── Notification panel (inline-styled in nav.php, polish via id) ── */
#notif-panel {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden;
}
#notif-bell { border-radius: 8px; transition: background .15s ease; }
#notif-bell:hover { background: var(--surface-2); }

/* ── Empty-state helper (for future use) ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
  font-size: 13px;
}
.empty-state .empty-icon { font-size: 30px; margin-bottom: 10px; }

/* ── Print: clean ticket/SR printouts ── */
@media print {
  .sidebar, .topbar, .rte-wrap, .btn, form, #notif-panel,
  .site-footer, .back-link, .menu-toggle { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; font-size: 12px; }
  .card { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
  tbody tr:hover td:first-child { box-shadow: none; }
}

/* ── Constrained form pages ─────────────────────────── */
.form-page { max-width: 700px; }
@media (max-width: 768px) {
  .form-page { max-width: 100%; }
}

/* ── Contact forms card layout ──────────────────────── */
.cf-card-body {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.cf-card-main { flex: 1; min-width: 0; }
.cf-card-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
@media (max-width: 768px) {
  .cf-card-actions { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .cf-card-actions .btn { flex: 1; min-width: 120px; }
}

/* ── Login page ─────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 400px; }

/* ── Meta rows responsive ───────────────────────────── */
@media (max-width: 480px) {
  .meta-row { flex-direction: column; gap: 2px; }
  .meta-label { min-width: auto; }
  .info-row { flex-wrap: wrap; gap: 6px; }
}
