/* ===== HCV HELPDESK — Design System ===== */
/* Fonts: Montserrat (headings) + Inter (body) + JetBrains Mono (IDs) */

/* ===== TOKENS ===== */
:root {
  --sidebar-w: 252px;
  --topbar-h: 54px;

  /* Brand colors */
  --c-blue-dark:   #0b64a1;   /* primární modrá */
  --c-blue-mid:    #0089d0;   /* střední modrá — hlavní akcent */
  --c-blue-light:  #70cbf3;   /* světlá modrá */
  --c-blue-pale:   rgba(0,137,208,0.1);

  --c-yellow:      #ffd369;   /* highlight text */
  --c-dark-bg:     #080C17;   /* tmavé pozadí */

  /* Sidebar (dark brand) */
  --c-sidebar:        #080C17;
  --c-sidebar-border: #131929;
  --c-sidebar-muted:  #4a5568;
  --c-sidebar-text:   #8899b0;
  --c-sidebar-hover:  #0f1828;
  --c-sidebar-active-bg: rgba(0,137,208,0.15);
  --c-sidebar-active: #70cbf3;

  /* Content area */
  --c-bg:      #f5f6f8;
  --c-surface: #ffffff;
  --c-border:  #e2e5ea;
  --c-border-subtle: #eef0f3;

  --c-text:       #0f1828;
  --c-text-muted: #5a6678;
  --c-text-light: #9aaabb;

  /* Semantic colors (kept for badges) */
  --c-amber:        #0089d0;
  --c-amber-hover:  #0b64a1;
  --c-amber-light:  rgba(0,137,208,0.1);

  --c-sky:       #0089d0;
  --c-sky-light: rgba(0,137,208,0.1);

  --c-green:       #059669;
  --c-green-light: #d1fae5;

  --c-red:       #dc2626;
  --c-red-light: #fee2e2;

  --c-purple:       #7c3aed;
  --c-purple-light: #ede9fe;

  --c-teal:       #0d9488;
  --c-teal-light: #ccfbf1;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(8,12,23,0.06);
  --shadow-sm: 0 1px 3px rgba(8,12,23,0.08), 0 1px 2px rgba(8,12,23,0.04);
  --shadow-md: 0 4px 12px rgba(8,12,23,0.12), 0 2px 4px rgba(8,12,23,0.06);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

[x-cloak] { display: none !important; }

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-sidebar);
  border-right: 1px solid var(--c-sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--c-sidebar-border);
  flex-shrink: 0;
  display: block;
  text-decoration: none;
}

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

.sidebar-logo-img {
  height: 26px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.sidebar-brand-sub {
  font-size: 10.5px;
  color: var(--c-sidebar-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section { margin-bottom: 2px; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 10px 10px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--c-sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--c-sidebar-hover);
  color: #f4f4f5;
}

.sidebar-link.active {
  background: var(--c-sidebar-active-bg);
  color: var(--c-amber);
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.12s;
}

.sidebar-link:hover svg,
.sidebar-link.active svg {
  opacity: 1;
}

/* CTA in sidebar */
.sidebar-cta {
  padding: 10px 10px 4px;
}

.sidebar-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--c-amber);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: background 0.12s;
}

.sidebar-cta a:hover {
  background: var(--c-amber-hover);
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--c-sidebar-border);
  padding: 10px;
  flex-shrink: 0;
}

.sidebar-user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-sidebar-text);
  transition: background 0.12s;
  text-align: left;
  position: relative;
}

.sidebar-user-btn:hover { background: var(--c-sidebar-hover); }

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-blue-mid), var(--c-blue-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: #000;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f4f4f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--c-sidebar-muted);
}

.sidebar-user-chevron {
  width: 14px;
  height: 14px;
  color: var(--c-sidebar-muted);
  flex-shrink: 0;
}

.sidebar-dropdown {
  position: absolute;
  bottom: 100%;
  left: 10px;
  right: 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 4px;
  z-index: 300;
}

.sidebar-dropdown a,
.sidebar-dropdown button {
  display: block;
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--c-text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.sidebar-dropdown a:hover,
.sidebar-dropdown button:hover { background: var(--c-bg); }

.sidebar-dropdown button { color: var(--c-red); }

/* ===== MOBILE OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Top bar */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-hamburger {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--c-text-muted);
  flex-shrink: 0;
}

.topbar-hamburger:hover { background: var(--c-bg); }
.topbar-hamburger svg { width: 18px; height: 18px; }

.topbar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-muted);
  flex: 1;
}

/* Page content */
.page-content {
  flex: 1;
  padding: 22px 24px;
}

/* Flash messages */
.flash-wrap {
  padding: 10px 24px 0;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  margin-bottom: 8px;
}

.flash-success { background: var(--c-green-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: var(--c-red-light);   color: #7f1d1d; border: 1px solid #fca5a5; }
.flash-info    { background: var(--c-sky-light);   color: #0c4a6e; border: 1px solid #bae6fd; }
.flash-warning { background: #fff3e0; color: #78350f; border: 1px solid #fcd34d; }

.flash-close {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  color: inherit;
}

.flash-close:hover { opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .topbar-hamburger { display: flex; }
  .page-content { padding: 14px 14px; }
  .flash-wrap { padding: 8px 14px 0; }
}

/* ===== COMPONENTS ===== */

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

/* Card */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
}

.card-body { padding: 18px; }
.card-body-sm { padding: 14px 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
  white-space: nowrap;
  line-height: 1.4;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary  { background: var(--c-amber); color: #fff; }
.btn-primary:hover  { background: var(--c-amber-hover); }
.btn-primary:disabled, .btn-primary[disabled] { background: var(--c-border); color: var(--c-text-light); cursor: not-allowed; }

.btn-secondary { background: var(--c-bg); color: var(--c-text-muted); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: var(--c-border-subtle); color: var(--c-text); border-color: #d4cfc8; }

.btn-sky { background: var(--c-sky); color: #fff; }
.btn-sky:hover { background: #0369a1; }

.btn-success { background: var(--c-green); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--c-red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost { background: transparent; color: var(--c-text-muted); border: 1px solid var(--c-border); }
.btn-ghost:hover { background: var(--c-bg); color: var(--c-text); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-full { width: 100%; }

/* Form elements */
.form-stack { display: flex; flex-direction: column; gap: 12px; }

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

.form-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-control {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

.form-control:focus {
  border-color: var(--c-amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

.form-control::placeholder { color: var(--c-text-light); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 30px;
}

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

.form-error { font-size: 12px; color: var(--c-red); margin-top: 2px; }

/* Also override bare HTML inputs for Django form rendering */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--c-amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 30px;
  cursor: pointer;
}

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

/* Filter bar */
.filter-bar {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-field { min-width: 110px; }
.filter-field label { display: block; font-size: 11px; font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.filter-field select,
.filter-field input { padding: 6px 10px; font-size: 13px; }
.filter-field select { padding-right: 28px; }

/* View toggle */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.view-toggle-btn {
  padding: 6px 9px;
  background: var(--c-surface);
  border: none;
  cursor: pointer;
  color: var(--c-text-muted);
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--c-border); }

.view-toggle-btn.active { background: var(--c-amber); color: #fff; }
.view-toggle-btn svg { width: 15px; height: 15px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

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

/* Status */
.badge-new         { background: #f4f4f5; color: #52525b; }
.badge-new .badge-dot { background: #71717a; }

.badge-offer_prep  { background: var(--c-purple-light); color: var(--c-purple); }
.badge-offer_prep .badge-dot { background: var(--c-purple); }

.badge-in_progress { background: var(--c-sky-light); color: var(--c-sky); }
.badge-in_progress .badge-dot { background: var(--c-sky); }

.badge-resolved    { background: var(--c-green-light); color: var(--c-green); }
.badge-resolved .badge-dot { background: var(--c-green); }

.badge-rejected    { background: var(--c-red-light); color: var(--c-red); }
.badge-rejected .badge-dot { background: var(--c-red); }

/* Priority */
.badge-high   { background: var(--c-red-light);    color: var(--c-red); }
.badge-high .badge-dot { background: var(--c-red); }

.badge-medium { background: #fff3e0; color: #c45d00; }
.badge-medium .badge-dot { background: #f59e0b; }

.badge-low    { background: var(--c-green-light);  color: var(--c-green); }
.badge-low .badge-dot { background: var(--c-green); }

/* Type */
.badge-problem     { background: #ffedd5; color: #c2410c; }
.badge-problem .badge-dot { background: #ea580c; }

.badge-development { background: var(--c-purple-light); color: var(--c-purple); }
.badge-development .badge-dot { background: var(--c-purple); }

.badge-improvement { background: var(--c-teal-light);   color: var(--c-teal); }
.badge-improvement .badge-dot { background: var(--c-teal); }

/* ===== TICKET TABLE ===== */
.ticket-table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ticket-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.ticket-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.ticket-table thead th.sortable a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.ticket-table thead th.sortable a:hover { color: var(--c-text); }
.ticket-table thead th.sorted-asc a,
.ticket-table thead th.sorted-desc a { color: var(--c-amber); }
.sort-arrow { font-size: 10px; line-height: 1; }

.ticket-table tbody tr {
  border-bottom: 1px solid var(--c-border-subtle);
  transition: background 0.08s;
  cursor: pointer;
}

.ticket-table tbody tr:last-child { border-bottom: none; }
.ticket-table tbody tr:hover { background: #faf9f6; }

.ticket-table td {
  padding: 11px 14px;
  vertical-align: middle;
}

.ticket-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--c-text-light);
  white-space: nowrap;
}

.ticket-title-cell {
  font-weight: 600;
  color: var(--c-text);
  max-width: 260px;
}

.ticket-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.ticket-muted { color: var(--c-text-muted); }
.ticket-date  { color: var(--c-text-light); white-space: nowrap; font-size: 12.5px; }
.ticket-hours { text-align: right; font-weight: 600; color: var(--c-text-muted); }

/* ===== TICKET CARDS (mobile) ===== */
.ticket-cards { display: flex; flex-direction: column; gap: 8px; }

.ticket-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 13px 15px;
  display: block;
  cursor: pointer;
  transition: box-shadow 0.12s, border-color 0.12s;
}

.ticket-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d4cfc8;
}

.ticket-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.ticket-card-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--c-text-light);
}

.ticket-card-date { font-size: 11.5px; color: var(--c-text-light); white-space: nowrap; }

.ticket-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--c-text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.ticket-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.ticket-card-company {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-left: auto;
}

/* View visibility helpers */
.show-table .ticket-cards { display: none; }
.show-table .ticket-table-wrap { display: block; }
.show-cards .ticket-table-wrap { display: none; }
.show-cards .ticket-cards { display: flex; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}

.pagination-btn {
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: all 0.12s;
}

.pagination-btn:hover { background: var(--c-bg); color: var(--c-text); }
.pagination-info { font-size: 13px; color: var(--c-text-muted); padding: 0 8px; }

/* ===== DETAIL PAGE ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--c-sky); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--c-text-light); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}

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

.section-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.panel-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--c-text-light);
  margin-bottom: 12px;
}

/* Metadata */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--c-border-subtle);
  font-size: 13.5px;
  gap: 12px;
}

.meta-row:last-child { border-bottom: none; }
.meta-label { color: var(--c-text-muted); flex-shrink: 0; }
.meta-value { font-weight: 600; text-align: right; }
.meta-select {
  width: 100%; font-size: 13px; padding: 3px 6px;
  border: 1px solid var(--c-border); border-radius: var(--r);
  background: var(--c-bg); color: var(--c-text); font-weight: 600;
}

/* Note boxes */
.note-box {
  padding: 13px 15px;
  border-radius: var(--r);
  font-size: 13.5px;
}

.note-box-title { font-weight: 700; font-size: 12.5px; margin-bottom: 5px; }

.note-box-success { background: var(--c-green-light); border: 1px solid #a7f3d0; }
.note-box-success .note-box-title { color: #065f46; }
.note-box-success .note-box-text  { color: #047857; }

.note-box-danger { background: var(--c-red-light); border: 1px solid #fca5a5; }
.note-box-danger .note-box-title { color: #7f1d1d; }
.note-box-danger .note-box-text  { color: #991b1b; }

/* Action details */
details.action-panel { border-top: 1px solid var(--c-border-subtle); }
details.action-panel:first-child { border-top: none; }

details.action-panel summary {
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-sky);
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}

details.action-panel.danger summary { color: var(--c-red); }
details.action-panel.purple summary { color: var(--c-purple); }
details.action-panel.success summary { color: var(--c-green); }

details.action-panel summary::before {
  content: '›';
  font-size: 17px;
  line-height: 1;
  transition: transform 0.18s;
  display: inline-block;
}

details.action-panel[open] summary::before { transform: rotate(90deg); }
details.action-panel[open] summary { margin-bottom: 2px; }

.action-panel-body { padding-bottom: 12px; }
.action-panel-body .form-stack { gap: 8px; }

/* ===== COMMENTS ===== */
.comment-list { display: flex; flex-direction: column; }

.comment {
  display: flex;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid var(--c-border-subtle);
}

.comment:last-child { border-bottom: none; }

.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #4f46e5;
  flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
}

.comment-body { flex: 1; min-width: 0; }

.comment-meta {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.comment-author { font-weight: 700; color: var(--c-text); font-size: 13px; }

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

.comment-empty { font-size: 13.5px; color: var(--c-text-light); padding: 12px 0; }

/* ===== TIMELOG ===== */
.timelog-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.timelog-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-muted);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--c-border);
}

.timelog-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border-subtle);
  vertical-align: middle;
}

.timelog-table tr:last-child td { border-bottom: none; }

/* ===== ATTACHMENTS ===== */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  transition: background 0.12s;
}

.attachment-item:hover {
  background: var(--c-bg);
}

.attachment-icon {
  flex-shrink: 0;
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
}

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--c-text);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-name:hover {
  color: var(--c-sky);
  text-decoration: underline;
}

.attachment-meta {
  font-size: 11.5px;
  color: var(--c-text-light);
  margin-top: 1px;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.attachment-upload-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--c-border);
  margin-top: 4px;
  flex-wrap: wrap;
}

.attachment-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 12px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--c-text);
  transition: border-color 0.12s, background 0.12s;
  white-space: nowrap;
}

.attachment-upload-label:hover {
  border-color: var(--c-sky);
  background: var(--c-surface);
}

/* ===== HISTORY ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--c-border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  background: var(--c-bg);
  color: var(--c-text-muted);
}

.history-icon svg { width: 13px; height: 13px; }

.history-icon--status    { background: #e0f2fe; color: var(--c-sky); }
.history-icon--created   { background: #dcfce7; color: var(--c-green); }
.history-icon--resolver,
.history-icon--sales     { background: #ede9fe; color: var(--c-purple); }
.history-icon--attachment_added   { background: #fef9c3; color: #a16207; }
.history-icon--attachment_deleted { background: #fee2e2; color: var(--c-red); }

.history-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.history-desc {
  font-size: 13px;
  color: var(--c-text);
  line-height: 1.4;
}

.history-meta {
  font-size: 11.5px;
  color: var(--c-text-light);
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-total::after      { background: var(--c-text-muted); }
.stat-progress::after   { background: var(--c-sky); }
.stat-new::after        { background: #a1a1aa; }
.stat-resolved::after   { background: var(--c-green); }
.stat-rejected::after   { background: var(--c-red); }
.stat-hours::after      { background: var(--c-amber); }

.stat-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--c-text);
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}

.stat-label { font-size: 12px; color: var(--c-text-muted); font-weight: 500; }

.stats-table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow-x: auto;
  margin-bottom: 22px;
}

.stats-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.stats-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.stats-table th.num { text-align: center; }

.stats-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--c-border-subtle);
  vertical-align: middle;
}

.stats-table td.num { text-align: center; }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table tr:hover td { background: #faf9f6; }

/* ===== MONTH NAV ===== */
.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-nav-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  min-width: 130px;
  text-align: center;
  color: var(--c-text);
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 420px 1fr;
}

.login-brand {
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 52px 48px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(245,158,11,0.06);
}

.login-brand::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(245,158,11,0.04);
}


.login-brand-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.1;
}

.login-brand-desc {
  color: var(--c-sidebar-text);
  font-size: 14px;
  line-height: 1.7;
  max-width: 280px;
}

.login-brand-dots {
  display: flex;
  gap: 6px;
  margin-top: 36px;
}

.login-brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3f3f46;
}

.login-brand-dot.active { background: var(--c-amber); }

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 48px;
  background: var(--c-surface);
}

.login-form-inner { width: 100%; max-width: 360px; }

.login-form-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.login-form-sub {
  color: var(--c-text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

@media (max-width: 700px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 36px 28px; min-height: auto; }
  .login-brand-name { font-size: 24px; letter-spacing: -0.3px; }
  .login-brand::before, .login-brand::after { display: none; }
  .login-form-panel { padding: 32px 24px; }
}

/* ===== ADMIN TABLES ===== */
.admin-table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow-x: auto;
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.admin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}

.admin-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--c-border-subtle);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #faf9f6; }

/* ===== FORM PAGE ===== */
.form-page-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 24px;
  max-width: 640px;
}

/* Ticket detail description */
.ticket-description {
  font-size: 14px;
  color: var(--c-text);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* Role chip (profile page) */
.role-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-text-muted);
}

/* ===== UTILITY ===== */
.text-mono { font-family: 'JetBrains Mono', monospace; }
.divider { border: none; border-top: 1px solid var(--c-border-subtle); margin: 12px 0; }
.space-y > * + * { margin-top: 14px; }
