:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Brand palette */
  --color-deep-blue: #0a5fd8;
  --color-royal-blue: #1877f2;
  --color-navy: #0e2f66;
  --color-green: #73d700;
  --color-success: #34c759;

  --color-primary: var(--color-royal-blue);
  --color-primary-2: var(--color-deep-blue);
  --color-primary-hover: var(--color-deep-blue);
  --color-primary-light: #eaf2ff;
  --gradient-primary: linear-gradient(135deg, var(--color-deep-blue), var(--color-royal-blue));

  --color-bg: #f5f8fc;
  --color-surface: #ffffff;
  --color-surface-glass: rgba(255, 255, 255, 0.72);
  --color-border: #dce6f2;
  --color-border-strong: #c3d3e8;

  --color-text: #0e2f66;
  --color-text-secondary: #4c5f7a;
  --color-text-muted: #8ba0bb;

  --color-sidebar-bg: #0e2f66;
  --color-sidebar-text: #a9bcd9;
  --color-sidebar-text-hover: #ffffff;
  --color-sidebar-active-bg: rgba(24, 119, 242, 0.28);
  --color-sidebar-active-text: #ffffff;
  --color-sidebar-active-indicator: var(--color-royal-blue);
  --color-sidebar-border: rgba(169, 188, 217, 0.16);

  --color-badge-count-bg: var(--color-green);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(14, 47, 102, 0.05);
  --shadow-sm: 0 2px 6px rgba(14, 47, 102, 0.06), 0 1px 2px rgba(14, 47, 102, 0.04);
  --shadow-md: 0 10px 28px rgba(14, 47, 102, 0.09), 0 2px 6px rgba(14, 47, 102, 0.05);
  --shadow-lg: 0 24px 48px rgba(14, 47, 102, 0.14);
  --shadow-glow: 0 0 0 3.5px rgba(24, 119, 242, 0.16), 0 6px 18px rgba(10, 95, 216, 0.28);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --color-primary: #4f9bff;
  --color-primary-2: #2e7ef2;
  --color-primary-hover: #6bacff;
  --color-primary-light: rgba(79, 155, 255, 0.14);
  --gradient-primary: linear-gradient(135deg, #0a5fd8, #4f9bff);

  --color-bg: #0a1c3d;
  --color-surface: #0f2850;
  --color-surface-glass: rgba(15, 40, 80, 0.72);
  --color-border: rgba(169, 188, 217, 0.16);
  --color-border-strong: rgba(169, 188, 217, 0.26);

  --color-text: #f2f6fc;
  --color-text-secondary: #b7c6de;
  --color-text-muted: #7e93b3;

  --color-sidebar-bg: #081c3c;
  --color-sidebar-border: rgba(169, 188, 217, 0.12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

h1, h2, h3 { font-family: var(--font-sans); letter-spacing: -0.01em; color: var(--color-text); font-weight: 700; }

p { font-weight: 500; }

.hidden { display: none !important; }

a { color: var(--color-primary); }

/* ---------------- Auth screen (split layout) ---------------- */

.auth-layout {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(115, 215, 0, 0.16), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(255, 255, 255, 0.10), transparent 45%),
    linear-gradient(160deg, var(--color-navy) 0%, var(--color-deep-blue) 55%, var(--color-royal-blue) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 64px;
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.6;
  pointer-events: none;
}

.auth-brand-inner { position: relative; z-index: 1; max-width: 440px; }

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 10px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}

.brand-logo-sm { width: 30px; height: 30px; border-radius: 8px; }

.auth-brand-title {
  margin: 40px 0 16px;
  font-size: 34px;
  line-height: 1.25;
  font-weight: 700;
  color: #fff;
}

.auth-brand-copy {
  margin: 0 0 32px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 500;
}

.auth-feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

.auth-feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.94);
}

.auth-feature-list svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 50%;
  background: rgba(115, 215, 0, 0.28);
  color: var(--color-green);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--color-surface);
}

.auth-panel-inner { width: 100%; max-width: 380px; }

.auth-form-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.auth-form-subtitle { margin: 0 0 28px; color: var(--color-text-secondary); font-size: 14px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--color-text-secondary); margin: 4px 0 0; }
.auth-switch a { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

.theme-toggle-auth {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
}
.theme-toggle-auth:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* Mobile: instead of hiding all branding, collapse it into a colored header
   with a white form "sheet" overlapping the bottom of it. */
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }

  .auth-brand {
    padding: 44px 24px 76px;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .auth-brand-inner { max-width: 420px; margin: 0 auto; }
  .brand-mark { justify-content: center; }

  .auth-brand-title { font-size: 23px; margin: 18px 0 8px; }
  .auth-brand-copy { font-size: 13px; margin-bottom: 18px; }

  .auth-feature-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .auth-feature-list li {
    background: rgba(255, 255, 255, 0.14);
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    font-size: 11.5px;
  }

  .auth-feature-list svg { width: 15px; height: 15px; }

  .auth-panel {
    position: relative;
    z-index: 1;
    margin-top: -40px;
    padding: 0 18px 40px;
  }

  .auth-panel-inner {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 380px) {
  .auth-feature-list { display: none; }
}

/* ---------------- App shell ---------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 110;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-header .brand-mark { color: #fff; font-size: 15px; }
.sidebar-close { display: none; color: var(--color-sidebar-text); font-size: 22px; line-height: 1; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.sidebar-nav a svg { flex-shrink: 0; width: 18px; height: 18px; opacity: 0.85; }

.sidebar-nav a:hover { background: rgba(169, 188, 217, 0.1); color: var(--color-sidebar-text-hover); }

.sidebar-nav a.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
}
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 0 4px 4px 0;
  background: var(--color-sidebar-active-indicator);
}
.sidebar-nav a.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-green);
  color: #0e2f66;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-avatar-sm { width: 30px; height: 30px; font-size: 12px; }

.user-meta { min-width: 0; }
.user-name { color: #fff; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { text-transform: capitalize; font-size: 11.5px; color: var(--color-sidebar-text); }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 47, 102, 0.5);
  z-index: 105;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: var(--color-surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-xs);
}

.topbar-menu-btn { display: none; }

.topbar-title { font-weight: 700; font-size: 15px; white-space: nowrap; }

.topbar-search {
  flex: 1;
  max-width: 360px;
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  padding-left: 36px;
  background: var(--color-bg);
  border-color: var(--color-border);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-bell-wrap { position: relative; }

.topbar-bell { position: relative; }

.topbar-bell .nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  margin-left: 0;
  min-width: 15px;
  height: 15px;
  font-size: 9px;
  border: 2px solid var(--color-surface);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: 88vw;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
  animation: dropdown-in 0.15s var(--ease);
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.notification-dropdown-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.notification-list {
  max-height: 320px;
  overflow-y: auto;
}

.notification-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.12s var(--ease);
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--color-primary-light); }

.notification-item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notification-item-meta { font-size: 11.5px; color: var(--color-text-muted); }

.notification-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

.notification-view-all {
  display: block;
  text-align: center;
  padding: 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  background: var(--color-bg);
}
.notification-view-all:hover { text-decoration: underline; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.icon-btn:hover { background: var(--color-primary-light); color: var(--color-primary); }

.main-content {
  padding: 32px 36px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-subtitle { margin: 4px 0 0; color: var(--color-text-secondary); font-size: 13.5px; }

/* ---------------- Cards / forms ---------------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  margin-bottom: 20px;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}

.card h2 { margin: 0 0 18px; font-size: 15px; font-weight: 700; }

.card-hoverable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
}

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

.form-row { display: flex; flex-direction: column; gap: 7px; }

.form-row label { font-size: 12.5px; font-weight: 700; color: var(--color-text-secondary); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

input::placeholder, textarea::placeholder { color: var(--color-text-muted); font-weight: 500; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3.5px rgba(24, 119, 242, 0.15);
}

textarea { resize: vertical; font-family: inherit; }

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
}

.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }

.btn-secondary { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-primary); }
.btn-secondary:hover { background: var(--color-primary-light); }

.btn-success { background: var(--color-success); color: #fff; box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3); }
.btn-success:hover { background: #2eb350; box-shadow: 0 0 0 3.5px rgba(52, 199, 89, 0.18), 0 6px 16px rgba(52, 199, 89, 0.3); }

.btn-ghost { background: transparent; color: var(--color-sidebar-text); border-color: var(--color-sidebar-border); }
.btn-ghost:hover { background: rgba(169, 188, 217, 0.12); color: #fff; }

.btn-block { width: 100%; }
.btn-lg { padding: 12px 18px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ---------------- Tables ---------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.table th, .table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table th { color: var(--color-text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--color-bg); }
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child { border-top-right-radius: var(--radius-sm); }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:hover { background: var(--color-primary-light); }
.table tbody tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; font-weight: 700; color: var(--color-text); }
.row-link:hover { color: var(--color-primary); }
.empty { color: var(--color-text-muted); text-align: center; padding: 40px 20px !important; font-size: 13.5px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.filter-bar select, .filter-bar input { flex: 1; min-width: 150px; }
.filter-bar .btn { flex-shrink: 0; }

.table-search {
  position: relative;
  margin-bottom: 14px;
}
.table-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.table-search input { width: 100%; padding-left: 38px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.pagination button:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.pagination button.active { background: var(--gradient-primary); border-color: transparent; color: #fff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------------- Badges ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.4;
}

.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: currentColor; }

/* Status palette: Open/New = blue, Assigned = orange, In Progress = purple,
   Waiting = yellow, Resolved = green, Closed = gray, Rejected = red. */
.badge-new        { background: #eaf2ff; color: #0a5fd8; }
.badge-assigned   { background: #fff4e5; color: #c2680c; }
.badge-inprogress { background: #f4eeff; color: #7c3aed; }
.badge-waiting    { background: #fef9e6; color: #a16207; }
.badge-resolved   { background: #e9fbf0; color: #1a9c46; }
.badge-closed     { background: #eef1f6; color: #5b6b82; }
.badge-rejected   { background: #fde9e9; color: #c81e1e; }
.badge-redeemed   { background: #e6f9ee; color: #0f8a4b; }

.badge-priority-low    { background: #e9fbf0; color: #1a9c46; }
.badge-priority-medium { background: #fef9e6; color: #a16207; }
.badge-priority-high   { background: #fde9e9; color: #c81e1e; }

.badge-role-admin     { background: #f4eeff; color: #7c3aed; }
.badge-role-developer { background: #e6f7fb; color: #0e7490; }
.badge-role-client    { background: #eef1f6; color: #5b6b82; }

/* ---------------- Ticket detail ---------------- */

.two-col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}

.ticket-desc { color: var(--color-text-secondary); white-space: pre-wrap; line-height: 1.6; font-size: 13.5px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 20px 0;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.meta-label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.timeline li { position: relative; border-left: 2px solid var(--color-border); padding-left: 16px; padding-bottom: 2px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); }
.timeline-status { font-size: 13px; margin-bottom: 3px; }
.timeline-date { font-size: 12px; color: var(--color-text-muted); }

.comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; max-height: 320px; overflow-y: auto; }
.comment { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 11px 13px; }
.comment-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--color-text-muted); margin-bottom: 5px; }
.comment-meta strong { color: var(--color-text); font-weight: 700; }
.comment-body { font-size: 13.5px; white-space: pre-wrap; line-height: 1.5; }
.comment-form { flex-direction: row; gap: 10px; align-items: flex-start; }
.comment-form textarea { flex: 1; }

/* ---------------- Analytics / KPI cards ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
  animation: kpi-in 0.4s var(--ease) backwards;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.stat-card:nth-child(1) { animation-delay: 0.02s; }
.stat-card:nth-child(2) { animation-delay: 0.07s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.17s; }

@keyframes kpi-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.stat-icon svg { width: 18px; height: 18px; }

.stat-value { font-size: 26px; font-weight: 700; color: var(--color-text); letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--color-text-secondary); font-weight: 600; }

.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid-2 { grid-template-columns: repeat(2, 1fr); }

.wallet-pending .stat-value { color: var(--color-success); }
.wallet-pending .stat-icon { background: #e6f9ee; color: var(--color-success); }

/* ---------------- Bar charts (Analytics) ---------------- */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-chart-row { display: grid; grid-template-columns: 120px 1fr 46px; align-items: center; gap: 12px; }
.bar-chart-label { font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-chart-track { height: 10px; border-radius: 999px; background: var(--color-bg); overflow: hidden; }
.bar-chart-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gradient-primary);
  width: 0;
  animation: bar-grow 0.7s var(--ease) forwards;
}
.bar-chart-fill.success { background: linear-gradient(135deg, #1a9c46, var(--color-green)); }
.bar-chart-value { font-size: 12.5px; font-weight: 700; color: var(--color-text); text-align: right; }

@keyframes bar-grow {
  from { width: 0; }
}

/* ---------------- Bidding ---------------- */

.bid-card { }

.bid-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.bid-card-header h3 { margin: 4px 0 6px; font-size: 15px; }

.ticket-number-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.03em;
}

.ticket-desc-short {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-secondary);
  max-width: 480px;
}

.bid-form { border-top: 1px solid var(--color-border); padding-top: 16px; }

/* Bid comparison table on the admin Ticket Detail page */
tr.bid-row-lowest { background: #e9fbf0; }
tr.bid-row-lowest td { border-bottom-color: #bcecd0; }

.bid-price-cell input { width: 100px; font-weight: 700; }

.btn-sm { padding: 7px 14px; font-size: 12.5px; }

.status-breakdown-card h2 { margin-bottom: 14px; }

.status-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 6px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
}

.status-chip-count { font-size: 13px; font-weight: 700; color: var(--color-text); padding-right: 4px; }

/* ---------------- Ratings ---------------- */

.rating-stars { display: inline-flex; gap: 2px; }
.rating-stars .star { color: var(--color-border-strong); font-size: 16px; line-height: 1; }
.rating-stars .star-filled { color: #f5a623; }
.rating-empty { color: var(--color-text-muted); font-size: 13px; font-style: italic; }
.rating-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 6px; }

/* ---------------- Loading skeleton ---------------- */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-border);
  border-radius: var(--radius-sm);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: skeleton-sweep 1.3s ease-in-out infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); }

@keyframes skeleton-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.skeleton-line { height: 12px; margin: 4px 0; }
.skeleton-row td { padding: 14px 12px; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--color-navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 1000;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #c81e1e; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-search { display: none; }
}

@media (max-width: 768px) {
  .topbar-menu-btn { display: inline-flex; }

  .sidebar {
    position: fixed;
    left: -272px;
    top: 0;
    bottom: 0;
    z-index: 110;
    transition: left 0.2s var(--ease);
  }

  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .sidebar.open ~ .sidebar-scrim { display: block; }
  .sidebar-close { display: inline-flex; }

  .main-content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .comment-form { flex-direction: column; }
  .bar-chart-row { grid-template-columns: 84px 1fr 40px; gap: 8px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .filter-bar select, .filter-bar input { min-width: 100%; }
}
