/* ===== GOT-IT Ticketsystem Styles ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2563eb; --blue-light: #dbeafe; --blue-dark: #1d4ed8;
  --green: #10b981; --orange: #f97316; --red: #dc2626; --purple: #7c3aed;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-400: #9ca3af; --gray-500: #6b7280; --gray-700: #374151; --gray-900: #111827;
  --sidebar-w: 220px; --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-100); color: var(--gray-900); font-size: 14px; line-height: 1.5; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: #1e293b; display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px;
  font-size: 18px; font-weight: 700; color: white; border-bottom: 1px solid #334155;
}
.sidebar-brand i { color: var(--blue); font-size: 22px; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  color: #94a3b8; text-decoration: none; border-radius: 6px; margin-bottom: 2px;
  transition: all .15s;
}
.nav-item:hover, .nav-item.active { background: #334155; color: white; }
.nav-item i { width: 18px; text-align: center; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid #334155; }
.nav-logout:hover { background: #7f1d1d; color: white; }

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

/* ===== TOPBAR ===== */
.topbar {
  background: white; padding: 16px 24px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow);
}
.page-title { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ===== CONTENT ===== */
.content-wrapper { padding: 24px; flex: 1; }
.page-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ===== CARDS ===== */
.card {
  background: white; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--gray-700); }
.card h4 { font-size: 13px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-footer { padding: 12px 0 0; border-top: 1px solid var(--gray-200); margin-top: 12px; font-size: 13px; color: var(--gray-500); }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
}
.stat-icon { font-size: 24px; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.stat-open .stat-icon { background: var(--blue-light); color: var(--blue); }
.stat-progress .stat-icon { background: #ffedd5; color: var(--orange); }
.stat-urgent .stat-icon { background: #fee2e2; color: var(--red); }
.stat-customers .stat-icon { background: #d1fae5; color: var(--green); }
.stat-done .stat-icon { background: #d1fae5; color: var(--green); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: var(--gray-50); padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table-hover tr:hover td { background: var(--gray-50); }
.table-sm td, .table-sm th { padding: 7px 10px; }
.row-active-timer td { background: #f0fdf4 !important; }
.row-invoiced { opacity: .6; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: 6px;
  font-size: 14px; background: white; color: var(--gray-900); transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
.form-row .flex-2 { flex: 2; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.filter-bar { padding: 14px 20px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-form .form-control { width: auto; flex: 1; min-width: 120px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: white; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-danger-outline { background: white; color: var(--red); border: 1px solid #fecaca; }
.btn-danger-outline:hover { background: #fee2e2; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ===== TICKET LAYOUT ===== */
.ticket-header {
  background: white; border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow); margin-bottom: 20px; display: flex;
  justify-content: space-between; align-items: flex-start; gap: 16px;
}
.ticket-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.ticket-main > *:last-child { margin-bottom: 0; }
.ticket-sidebar > *:last-child { margin-bottom: 0; }
.ticket-description { white-space: pre-wrap; color: var(--gray-700); line-height: 1.7; }
.time-badge { background: var(--blue-light); color: var(--blue); padding: 6px 14px; border-radius: 20px; font-weight: 600; font-size: 16px; }

/* ===== TIME TRACKING ===== */
.time-actions { margin-bottom: 12px; }
.active-timer-box {
  background: #f0fdf4; border: 1px solid #6ee7b7; border-radius: 6px; padding: 12px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.manual-time-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; padding: 10px; background: var(--gray-50); border-radius: 6px; }
.manual-time-form .form-control { min-width: 100px; width: auto; }
.badge-running { color: var(--green); font-size: 13px; font-weight: 500; }

/* ===== COMMENTS ===== */
.comments-list { display: flex; flex-direction: column; gap: 12px; }
.comment { background: var(--gray-50); border-radius: 6px; padding: 12px; border-left: 3px solid var(--blue); }
.comment-internal { background: #fefce8; border-left-color: #ca8a04; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.comment-role { font-size: 11px; padding: 1px 6px; border-radius: 20px; background: var(--blue-light); color: var(--blue); }
.badge-internal { font-size: 11px; background: #fef9c3; color: #a16207; padding: 1px 6px; border-radius: 20px; }
.comment-body { color: var(--gray-700); white-space: pre-wrap; }

/* ===== INFO LIST ===== */
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.info-list dt { font-size: 12px; color: var(--gray-500); font-weight: 500; white-space: nowrap; padding: 3px 0; }
.info-list dd { color: var(--gray-900); padding: 3px 0; word-break: break-word; }

/* ===== BADGES ===== */
.badge { padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-employee { background: #dbeafe; color: var(--blue); }
.badge-customer { background: #d1fae5; color: #065f46; }
.badge-role { font-size: 13px; }
.pulse-dot { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 1.5s infinite; margin-left: 4px; }

/* ===== AUTH ===== */
.auth-body { background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-container { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: white; border-radius: 12px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin: 10px 0 4px; }
.auth-header p { color: var(--gray-500); }
.auth-footer { text-align: center; margin-top: 20px; color: var(--gray-400); font-size: 12px; }

/* ===== INVOICE ===== */
.invoice-preview { max-width: 800px; font-family: Georgia, serif; }
.invoice-header-row { display: flex; justify-content: space-between; margin-bottom: 20px; }

/* ===== UTILITIES ===== */
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ===== ANIMATIONS ===== */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.pulse { animation: pulse 1.5s infinite; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .ticket-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
