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

:root {
  --bg:       #0f1117;
  --bg2:      #1a1d27;
  --bg3:      #22263a;
  --border:   #2e3247;
  --text:     #e2e6f0;
  --text2:    #8b92a9;
  --primary:  #6366f1;
  --primary-h:#7c7fff;
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --radius:   8px;
  --shadow:   0 2px 12px rgba(0,0,0,0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

/* ── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text) !important;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-size: 0.9rem;
}

.nav-links a { color: var(--text2); }
.nav-links a:hover { color: var(--text); }
.nav-user { color: var(--text2); font-size: 0.85rem; }

.btn-nav {
  background: var(--primary);
  color: white !important;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
}
.btn-nav:hover { background: var(--primary-h); }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
}

.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text2);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card-centered { max-width: 560px; margin-left: auto; margin-right: auto; }
.card-narrow   { max-width: 400px; }

.card-table { padding: 0; overflow: hidden; }

.card-info {
  background: transparent;
  border-color: var(--border);
}
.card-info p { margin-bottom: 0.4rem; font-size: 0.9rem; color: var(--text2); }
.card-info p strong { color: var(--text); }

.card h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.8rem;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1rem; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}
.form-row .form-group { flex: 1; }

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text2);
}

input, select, textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 100px; }

.form-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--border); color: var(--text); }

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

.btn-secondary { background: var(--bg3); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.align-end { align-self: flex-end; height: 38px; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.3px;
}

.badge-outline {
  background: transparent !important;
  border: 1px solid;
}

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-header h1 { font-size: 1.5rem; margin-top: 0.25rem; }
.ticket-badges { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; padding-top: 0.25rem; }

.breadcrumb { font-size: 0.8rem; color: var(--text2); display: block; margin-bottom: 0.25rem; }
.breadcrumb:hover { color: var(--text); }

.tracking-id { font-size: 0.85rem; color: var(--text2); margin-top: 0.25rem; }
.tracking-id code { font-family: monospace; color: var(--primary); }

.ticket-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 1rem;
}

h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
h1.subtitle + p, .subtitle { color: var(--text2); margin-bottom: 1.5rem; }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: 0.6rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.9rem;
  color: var(--text2);
  border: 1px solid transparent;
  border-bottom: none;
  position: relative;
  bottom: -1px;
}

.tab:hover { color: var(--text); }

.tab-active {
  background: var(--bg2);
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}

.tab-count {
  display: inline-block;
  background: var(--bg3);
  border-radius: 99px;
  padding: 0 0.45rem;
  font-size: 0.72rem;
  margin-left: 0.3rem;
  color: var(--text2);
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.ticket-link { font-weight: 500; color: var(--text); }
.ticket-link:hover { color: var(--primary); }

.date-cell { color: var(--text2); font-size: 0.82rem; }

.empty { text-align: center; color: var(--text2); padding: 2rem !important; }

/* ── Replies ───────────────────────────────────────────────────────────────── */
.reply {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.reply:last-child { margin-bottom: 0; }

.reply-customer { background: var(--bg3); border: 1px solid var(--border); }
.reply-staff    { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.25); }

.reply-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.reply-date { color: var(--text2); margin-left: auto; font-size: 0.8rem; }

.staff-label {
  background: var(--primary);
  color: white;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}

.reply-body { font-size: 0.95rem; line-height: 1.7; color: var(--text); }

/* ── Staff layout ──────────────────────────────────────────────────────────── */
.staff-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  align-items: start;
}

.staff-main { min-width: 0; }
.staff-sidebar { position: sticky; top: 70px; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text2);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .staff-layout { grid-template-columns: 1fr; }
  .staff-sidebar { position: static; }
  .container { padding: 1rem; }
  .navbar { padding: 0 1rem; }
  .table th:nth-child(2),
  .table td:nth-child(2),
  .table th:nth-child(4),
  .table td:nth-child(4) { display: none; }
}
