:root {
  --navy: #0b1220;
  --navy-light: #16213a;
  --teal: #14b8a6;
  --teal-dark: #0d9488;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

*, *::before, *::after {
  box-sizing: border-box;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app { display: flex; min-height: 100vh; max-width: 1500px; margin: 0 auto; }

.sidebar {
  width: 220px;
  background: var(--navy);
  color: #cbd5e1;
  flex-shrink: 0;
  padding: 20px 0;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
}
.sidebar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: var(--navy-light);
  color: #fff;
  border-left-color: var(--teal);
}


.main { flex: 1; padding: 28px 32px; }

.topbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 22px; margin: 0; }
.topbar .user { font-size: 14px; color: var(--text-muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 22px; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card {
  background: var(--card-bg); border-radius: 12px; padding: 14px 10px;
  border: 1px solid var(--border); border-left: 5px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-align: center;
  transition: box-shadow 0.15s, transform 0.1s, background 0.15s;
}
.card-link .card:hover { box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1); transform: translateY(-2px); }
.card .card-icon { font-size: 18px; margin-bottom: 2px; }
.card.accent-total { border-left-color: var(--navy); }
.card.accent-total .card-icon { color: var(--navy); }
.card.accent-open { border-left-color: #f59e0b; }
.card.accent-open .card-icon { color: #f59e0b; }
.card.accent-progress { border-left-color: #3b82f6; }
.card.accent-progress .card-icon { color: #3b82f6; }
.card.accent-resolved { border-left-color: #22c55e; }
.card.accent-resolved .card-icon { color: #22c55e; }
.card.accent-closed { border-left-color: #94a3b8; }
.card.accent-closed .card-icon { color: #94a3b8; }
.card.accent-unread { border-left-color: #ef4444; }
.card.accent-unread .card-icon { color: #ef4444; }
.card.card-active.accent-total { background: #eef2f7; box-shadow: 0 0 0 2px rgba(11,18,32,0.25); }
.card.card-active.accent-open { background: #fff7ed; box-shadow: 0 0 0 2px rgba(245,158,11,0.35); }
.card.card-active.accent-progress { background: #eff6ff; box-shadow: 0 0 0 2px rgba(59,130,246,0.35); }
.card.card-active.accent-resolved { background: #f0fdf4; box-shadow: 0 0 0 2px rgba(34,197,94,0.35); }
.card.card-active.accent-closed { background: #f8fafc; box-shadow: 0 0 0 2px rgba(148,163,184,0.35); }
.card.card-active.accent-unread { background: #fef2f2; box-shadow: 0 0 0 2px rgba(239,68,68,0.35); }
.card .label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }
.card .value { font-size: 21px; font-weight: 700; }

.filters { display:flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 12px; overflow: hidden; min-width: 760px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; margin-bottom: 0; }
th, td { padding: 7px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--navy); color: #cbd5e1; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
tr.ticket-row { cursor: pointer; }
tr.ticket-row:hover td { background: #f8fafc; }
.ticket-number-link { color: var(--teal-dark); font-weight: 700; }
.row-chevron { color: #cbd5e1; font-size: 17px; }
.client-name { font-weight: 700; color: var(--text); }
.subject-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
}

.badge { display:inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-open { background:#fef3c7; color:#92400e; }
.badge-progress { background:#dbeafe; color:#1e40af; }
.badge-resolved { background:#dcfce7; color:#166534; }
.badge-closed { background:#e2e8f0; color:#475569; }

/* Priority badges — distinct palette from status, so the two are never confused at a glance */
.priority-tag { display:inline-flex; align-items:center; padding: 2px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.priority-tag::before { content: ''; display:inline-block; width:6px; height:6px; border-radius:50%; background: currentColor; margin-right: 5px; }
.priority-low { background:#f1f5f9; color:#475569; }
.priority-medium { background:#e0f2fe; color:#075985; }
.priority-high { background:#ffedd5; color:#9a3412; }
.priority-urgent { background:#000; color:#fff; }

/* Module tag — small neutral label, distinct from status/priority so it doesn't compete visually */
.module-tag { display:inline-block; padding: 2px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; background:#f5f3ff; color:#5b21b6; }

.btn { display:inline-block; padding: 8px 16px; border-radius: 8px; border: none; background: var(--teal); color:#fff; font-size:14px; cursor:pointer; text-decoration:none; }
.btn:hover { background: var(--teal-dark); }
.btn-secondary { background: #fff; color: var(--text); border:1px solid var(--border); }

.login-wrap { min-height: 100vh; display:flex; align-items:center; justify-content:center; background: var(--navy); padding: 20px; }
.login-box {
  background:#fff;
  padding: 36px 40px;
  border-radius: 14px;
  width: 90%;
  max-width: 350px;   /* the only thing worth keeping from the second block */
  margin: 0 auto;
}
.login-box h1 { font-size:20px; margin-bottom: 4px; }
.login-box p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-box label { font-size:13px; font-weight:600; display:block; margin-bottom:6px; margin-top:14px; }
.login-box input { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:14px; }
.error { background:#fef2f2; color:#b91c1c; padding:10px 12px; border-radius:8px; font-size:13px; margin-top:14px; }

/* --- Ticket detail page --- */
.ticket-summary { background:#fff; border:1px solid var(--border); border-radius:14px; padding:18px; margin-bottom:20px; }
.ticket-summary h2 { margin:0 0 6px; font-size:22px; }
.ticket-summary-meta { color:var(--text-muted); font-size:13px; }

.ticket-layout { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:20px; }
.ticket-panel, .ticket-sidebar-card { background:#fff; border:1px solid var(--border); border-radius:14px; overflow:hidden; }
.ticket-sidebar-card { padding:18px; }
.ticket-sidebar-card h3 { margin:0 0 12px; font-size:15px; }
.panel-header { padding:14px 18px; border-bottom:1px solid var(--border); font-weight:700; background:#fafbfc; }

.thread { display:flex; flex-direction:column; gap:8px; padding:16px; max-height:600px; overflow-y:auto; background:#f8fafc; }
.msg { background:#fff; border:1px solid var(--border); border-radius:14px; padding:8px 12px; max-width:78%; font-size:13px; line-height:1.4; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.msg.admin { align-self:flex-end; background:#f0fdfa; border-color:#99f6e4; }

.reply-box { border-top: 1px solid var(--border); padding: 16px; background: #fff; display: flex; gap: 10px; align-items: flex-end; width: 100%; box-sizing: border-box; }
.reply-box textarea { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; resize: vertical; min-height: 70px; font-family: inherit; }

.attachment-link { display:block; padding:10px 12px; margin-bottom:8px; background:#f8fafc; border:1px solid var(--border); border-radius:8px; text-decoration:none; color:var(--text); }
.attachment-link:hover { background:#f1f5f9; }

.info-row { display:flex; justify-content:space-between; gap:12px; margin-bottom:10px; font-size:13px; }
.info-row span { color:var(--text-muted); }

/* --- Profile / assign-style inline forms (used on Team page) --- */
.inline-field-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--teal); color: #fff; font-weight: 700;
  display:flex; align-items:center; justify-content:center; font-size: 16px;
  flex-shrink: 0;
}

/* --- Expandable client rows (ASPxGridView-style detail row) --- */
.expand-cell { width: 34px; text-align: center; }
.expand-icon {
  display: inline-block;
  color: #94a3b8;
  font-size: 11px;
  transition: transform 0.15s ease, color 0.15s ease;
}
tr.client-row { cursor: pointer; }
tr.client-row:hover td { background: #f8fafc; }
tr.client-row.open td { background: #f8fafc; }
tr.client-row.open .expand-icon { transform: rotate(90deg); color: var(--teal-dark); }
tr.client-row:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

.detail-row td {
  background: #f8fafc;
  padding: 0;
  white-space: normal;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  padding: 16px 20px;
}
.detail-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail-item-key { grid-column: 1 / -1; }
.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #000000;
  font-weight: 600;
}
.detail-value { font-size: 13.5px; color: var(--text); white-space: normal; word-break: break-word; }
.detail-key {
  display: block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: normal;
  word-break: break-all;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}

/* --- Add Client modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  /* Very light, distinct-from-white background so the form sits visually apart from its (white) input fields */
  background: #eef2f7;
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(11, 18, 32, 0.28);
  text-align: left;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: #eef2f7;
}
.modal-header h2 {
  margin: 0;
  font-size: 17px;
  text-align: left;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: rgba(11,18,32,0.06); }
.modal-close:focus-visible { outline: 2px solid var(--teal); }

.modal-body { padding: 22px; }

.form-group { margin-bottom: 14px; text-align: left; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
  text-align: left;
  color: var(--text);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff; /* inputs stay white, standing out against the modal's light grey body */
  font-size: 14px;
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* --- Tablet: ticket detail collapses to one column --- */
@media (max-width: 1024px) {
  .ticket-layout { grid-template-columns: 1fr; }
}

/* --- Mobile responsive (phones and narrow tablets) --- */
@media (max-width: 768px) {
  .app { flex-direction: column; }

  .sidebar {
    width: 100%;
    padding: 0;
  }
  .sidebar .brand {
    padding: 14px 16px;
    border-bottom: none;
    margin-bottom: 0;
  }
  .sidebar nav {
    display: flex;
    overflow-x: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .sidebar nav a {
    padding: 10px 14px;
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  .sidebar nav a:hover, .sidebar nav a.active {
    border-left: none;
    border-bottom-color: var(--teal);
  }

  .main { padding: 18px 16px; }
  .topbar h1 { font-size: 18px; }

  .cards { grid-template-columns: repeat(2, 1fr); }

  .reply-box button { align-self: flex-end; }

  .msg { max-width: 100%; }

  .modal-box { max-width: 100%; }
  .detail-grid { grid-template-columns: 1fr 1fr; padding: 14px 16px; }
}

@media (max-width: 480px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.menu-group{
    margin-top:4px;
}

.submenu-toggle{
    display:flex !important;
    justify-content:space-between;
    align-items:center;
}

.submenu{
    display:none;
    margin-left:14px;
}

.submenu.open{
    display:block;
}

.submenu a{
    font-size:13px;
    padding:8px 20px;
    color:#94a3b8;
}

.submenu a:hover{
    color:#fff;
}






.btn-send-admin {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--teal); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.btn-send-admin:hover { background: var(--teal-dark); }