@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* =========================================================
   BOWE IR — Design System v2
   ========================================================= */

:root {
  /* Colors */
  --c-ink:       #0a0e1a;
  --c-ink-80:    #1a2235;
  --c-ink-60:    #3d4a63;
  --c-ink-40:    #7a8599;
  --c-ink-20:    #b0bac9;
  --c-ink-10:    #dde3ec;
  --c-ink-05:    #f4f6fa;
  --c-bg:        #edf0f6;
  --c-white:     #ffffff;
  --c-blue:      #4361ee;
  --c-blue-dark: #3451d1;
  --c-blue-pale: #eef1fd;
  --c-green:     #0ea86b;
  --c-green-pale:#e7f9f1;
  --c-amber:     #f59e0b;
  --c-amber-pale:#fef9ec;
  --c-red:       #ef4444;
  --c-red-pale:  #fef2f2;
  --c-border:    #dde3ec;
  --c-border-focus: #4361ee;

  /* Sidebar */
  --sidebar-w:   252px;
  --sidebar-bg:  #0d1117;
  --sidebar-hover: rgba(255,255,255,0.05);
  --sidebar-active: rgba(67,97,238,0.14);
  --sidebar-text: rgba(255,255,255,0.52);
  --sidebar-text-active: #ffffff;

  /* Typography */
  --font:        'Inter', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* Radius */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;

  /* Shadow */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md:  0 2px 4px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg:  0 4px 8px rgba(0,0,0,0.04), 0 20px 56px rgba(0,0,0,0.14);

  /* Transitions */
  --t-fast:  150ms ease;
  --t-base:  220ms ease;
  --t-slow:  350ms ease;
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-ink-80);
  line-height: 1.6;
}

a { color: var(--c-blue); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-blue-dark); }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

/* ── Layout ─────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.sidebar-logo {
  padding: 26px 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-logo img {
  height: 26px;
  width: auto;
  max-width: 100%;
  align-self: flex-start;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.sidebar-logo .app-name {
  color: rgba(255,255,255,0.3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
}

.nav-section {
  margin-bottom: 22px;
}

.nav-section-label {
  color: rgba(255,255,255,0.2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
  user-select: none;
  position: relative;
}

.nav-item i {
  width: 17px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity var(--t-fast);
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.85);
}
.nav-item:hover i { opacity: 0.9; }

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 3px;
  background: #4361ee;
  border-radius: 0 3px 3px 0;
}
.nav-item.active i { opacity: 1; color: #7c9dff; }

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast);
  text-decoration: none;
}
.sidebar-user:hover { background: var(--sidebar-hover); }

.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.sidebar-user .user-info .name {
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.sidebar-user .user-info .role {
  color: rgba(255,255,255,0.3);
  font-size: 11px;
}

/* ── Main Content ─────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  padding: 0 var(--sp-8);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--c-border);
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.page-content {
  padding: var(--sp-8);
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
  gap: var(--sp-4);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--c-ink-40);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--c-white);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--c-ink);
}

.card-body {
  padding: var(--sp-6);
}

/* ── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}

.stat-card {
  background: var(--c-white);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--t-base), transform var(--t-base);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-blue), #818cf8);
  opacity: 0;
  transition: opacity var(--t-base);
}
.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.stat-card:hover::after { opacity: 1; }

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-ink-40);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--sp-3);
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-delta {
  font-size: 12px;
  color: var(--c-ink-40);
  margin-top: var(--sp-2);
}

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  background: var(--c-white);
  box-shadow: var(--shadow-md);
}

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

thead th {
  background: transparent;
  color: var(--c-ink-40);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(221,227,236,0.6);
  transition: background var(--t-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--c-ink-05); }

tbody td {
  padding: 13px 16px;
  color: var(--c-ink-80);
  vertical-align: middle;
}

.td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-ink-40);
}

/* ── Status Badges ──────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.status-open        { background: #eef1fd; color: #3451d1; }
.status-in_progress { background: #fef9ec; color: #b45309; }
.status-closed      { background: #f1f4f9; color: #64748b; }
.status-active      { background: #e7f9f1; color: #057a4e; }
.status-paused      { background: #fef9ec; color: #b45309; }
.status-completed   { background: #f1f4f9; color: #64748b; }

/* Priority badges */
.priority {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.priority-high   { background: #fef2f2; color: #dc2626; }
.priority-medium { background: #fef9ec; color: #b45309; }
.priority-low    { background: #f1f4f9; color: #64748b; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #4361ee, #5a78f0);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(67,97,238,0.28), 0 1px 2px rgba(67,97,238,0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3451d1, #4361ee);
  color: #fff;
  box-shadow: 0 4px 16px rgba(67,97,238,0.38), 0 2px 4px rgba(67,97,238,0.2);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--c-white);
  color: var(--c-ink-60);
  border-color: var(--c-border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--c-ink-05);
  border-color: var(--c-ink-10);
  color: var(--c-ink);
}

.btn-danger {
  background: var(--c-white);
  color: var(--c-red);
  border-color: var(--c-border);
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover {
  background: var(--c-red-pale);
  border-color: rgba(239,68,68,0.35);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 7px;
  width: 34px;
  height: 34px;
  justify-content: center;
}

/* ── Forms ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--sp-5);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-5);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-60);
  margin-bottom: 6px;
}

label .req { color: var(--c-red); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--c-ink);
  background: var(--c-white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}

input::placeholder,
textarea::placeholder { color: var(--c-ink-20); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a8599' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-hint {
  font-size: 12px;
  color: var(--c-ink-40);
  margin-top: 5px;
}

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

/* ── Flash Messages ──────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: var(--sp-5);
  animation: flash-in var(--t-base) ease;
  box-shadow: var(--shadow-sm);
}

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

.flash-success {
  background: var(--c-green-pale);
  color: #057a4e;
  border: 1px solid rgba(14,168,107,0.2);
}
.flash-error {
  background: var(--c-red-pale);
  color: #b91c1c;
  border: 1px solid rgba(239,68,68,0.2);
}
.flash-info {
  background: var(--c-blue-pale);
  color: var(--c-blue-dark);
  border: 1px solid rgba(67,97,238,0.2);
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 72px var(--sp-8);
  color: var(--c-ink-40);
}

.empty-state i {
  font-size: 40px;
  margin-bottom: var(--sp-4);
  opacity: 0.25;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: var(--sp-5);
}

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
}

.login-panel-left {
  flex: 1;
  background: linear-gradient(160deg, #0d1117 0%, #131b2e 55%, #0d1117 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 48px;
  min-width: 340px;
  position: relative;
  overflow: hidden;
}

/* Subtle decorative circles */
.login-panel-left::before,
.login-panel-left::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(67,97,238,0.08);
  pointer-events: none;
}
.login-panel-left::before { width: 520px; height: 520px; top: -180px; right: -160px; }
.login-panel-left::after  { width: 360px; height: 360px; bottom: -120px; left: -100px; background: rgba(129,140,248,0.06); }

.login-brand {
  max-width: 300px;
  position: relative;
  z-index: 1;
}

.login-brand img {
  height: 30px;
  filter: brightness(0) invert(1);
  opacity: 0.88;
  margin-bottom: 36px;
}

.login-brand-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.login-brand p {
  color: rgba(255,255,255,0.42);
  font-size: 14.5px;
  line-height: 1.65;
}

.login-brand-features {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-brand-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.5);
  font-size: 13.5px;
}

.login-brand-feature i {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(67,97,238,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #7c9dff;
  flex-shrink: 0;
}

.login-panel-right {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
  background: var(--c-bg);
}

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

.login-header {
  text-align: center;
  margin-bottom: var(--sp-8);
}

.login-header img {
  height: 32px;
  margin: 0 auto var(--sp-5);
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: -0.02em;
}

.login-header p {
  font-size: 13.5px;
  color: var(--c-ink-40);
  margin-top: 5px;
}

.login-card {
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg);
}

/* ── Setup Wizard ─────────────────────────────────────────── */
.setup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0d1117 0%, #131b2e 60%, #0d1117 100%);
  padding: var(--sp-6);
}

.setup-box {
  width: 100%;
  max-width: 540px;
  animation: fade-up 0.4s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.setup-logo {
  text-align: center;
  margin-bottom: var(--sp-8);
}

.setup-logo img {
  height: 36px;
  margin: 0 auto;
  filter: brightness(0) invert(1);
}

.setup-logo .tagline {
  color: rgba(255,255,255,0.35);
  font-size: 13px;
  margin-top: 8px;
  letter-spacing: 0.02em;
}

.setup-card {
  background: var(--c-white);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.setup-steps {
  display: flex;
  border-bottom: 1px solid var(--c-border);
  overflow: hidden;
}

.setup-step {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-ink-20);
  position: relative;
  transition: color var(--t-base);
}

.setup-step.done  { color: var(--c-green); }
.setup-step.active { color: var(--c-blue); font-weight: 600; }

.setup-step .step-num {
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
  opacity: 0.6;
}

.setup-body { padding: var(--sp-8); }

.setup-body h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-ink);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.setup-body .setup-desc {
  color: var(--c-ink-40);
  font-size: 13.5px;
  margin-bottom: var(--sp-6);
}

/* ── Ticket Thread (portal + admin views) ────────────────── */
.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.thread-msg {
  display: flex;
  gap: var(--sp-4);
  animation: fade-up 0.25s ease;
}

.thread-msg.is-admin {
  flex-direction: row-reverse;
}

.thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--c-ink-10);
}

.thread-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.thread-bubble {
  max-width: 72%;
  background: var(--c-white);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.thread-msg.is-admin .thread-bubble {
  background: linear-gradient(135deg, #1a2235, #0d1117);
  color: var(--c-white);
}

.thread-msg.is-admin .thread-bubble .thread-meta {
  color: rgba(255,255,255,0.45);
}

.thread-meta {
  font-size: 12px;
  color: var(--c-ink-40);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-sender {
  font-weight: 600;
  color: inherit;
}

.thread-text {
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-msg.is-admin .thread-text { color: rgba(255,255,255,0.9); }

/* ── Detail Layout ───────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-6);
  align-items: start;
}

.detail-sidebar .card + .card {
  margin-top: var(--sp-4);
}

.info-list { padding: 0; }

.info-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px var(--sp-6);
  border-bottom: 1px solid rgba(221,227,236,0.6);
  font-size: 13.5px;
  gap: var(--sp-4);
}
.info-list li:last-child { border-bottom: none; }

.info-list .il-label {
  color: var(--c-ink-40);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  width: 120px;
}

.info-list .il-value {
  color: var(--c-ink-80);
  text-align: right;
}

/* ── Breadcrumbs ─────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-ink-40);
  margin-bottom: var(--sp-6);
}

.breadcrumb a { color: var(--c-ink-40); }
.breadcrumb a:hover { color: var(--c-blue); }
.breadcrumb .sep { color: var(--c-ink-10); }
.breadcrumb .current { color: var(--c-ink); font-weight: 500; }

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.filter-bar input[type="text"],
.filter-bar select {
  width: auto;
}

.filter-bar input[type="text"] {
  min-width: 220px;
}

/* ── Avatar Upload ───────────────────────────────────────── */
.avatar-upload {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--c-border);
  background: var(--c-ink-05);
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4361ee, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  font-weight: 700;
  border: 2px solid transparent;
  flex-shrink: 0;
}

/* ── Document List ───────────────────────────────────────── */
.doc-type-offer    { color: var(--c-blue); }
.doc-type-invoice  { color: var(--c-green); }
.doc-type-travel   { color: var(--c-amber); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,14,26,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  animation: overlay-in var(--t-base) ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--c-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  animation: modal-in var(--t-base) ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--c-ink-40);
  cursor: pointer;
  border-radius: var(--r-sm);
  font-size: 16px;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--c-ink-05); color: var(--c-ink); }

.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  background: var(--c-ink-05);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1.5px solid var(--c-border);
  margin-bottom: var(--sp-6);
  gap: 0;
}

.tab {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--c-ink-40);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  margin-bottom: -1.5px;
  user-select: none;
  text-decoration: none;
}

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

.tab.active {
  color: var(--c-blue);
  border-bottom-color: var(--c-blue);
  font-weight: 600;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-5) 0;
}

.page-link {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--c-ink-60);
  border: 1px solid var(--c-border);
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  background: var(--c-white);
}
.page-link:hover { background: var(--c-blue-pale); border-color: var(--c-blue); color: var(--c-blue); }
.page-link.active { background: var(--c-blue); border-color: var(--c-blue); color: white; box-shadow: 0 2px 6px rgba(67,97,238,0.3); }
.page-link.disabled { opacity: 0.35; pointer-events: none; }

/* ── File input ──────────────────────────────────────────── */
.file-input-wrap {
  position: relative;
  display: block;
}

.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px dashed var(--c-border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--c-ink-40);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.file-input-wrap:hover .file-input-label {
  border-color: var(--c-blue);
  color: var(--c-blue);
  background: var(--c-blue-pale);
}

/* ── Utilities ───────────────────────────────────────────── */
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.gap-3 { gap: var(--sp-3); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--c-ink-40); }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  animation: overlay-in 0.15s ease;
}
.lightbox-img {
  max-width: 100%;
  max-height: 90dvh;
  max-height: 90vh;
  border-radius: var(--r-md);
  box-shadow: 0 32px 96px rgba(0,0,0,0.7);
  object-fit: contain;
  cursor: default;
  animation: modal-in 0.18s ease;
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
  backdrop-filter: blur(6px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-ink-10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-ink-20); }

/* ── Responsive ──────────────────────────────────────────── */

/* Desktop: hide mobile-only elements */
.mobile-only { display: none !important; }

/* ── Content + sidebar grid ─────────────────────────────── */
.cs-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-6);
  align-items: start;
}
@media (max-width: 900px) {
  .cs-grid { grid-template-columns: 1fr; }
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  animation: overlay-in var(--t-base) ease;
}
.sidebar-backdrop.open { display: block; }

/* ── Tablet / Mobile  ≤ 900px ──────────────────────────── */
@media (max-width: 900px) {
  .mobile-only { display: flex !important; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--t-base);
    z-index: 301;
  }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; }

  .topbar { padding: 0 var(--sp-5); gap: var(--sp-3); }
  .topbar-title {
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
  }

  .page-content { padding: var(--sp-5); }

  .detail-grid { grid-template-columns: 1fr; }
  .form-row    { grid-template-columns: 1fr; }
  .form-row-3  { grid-template-columns: 1fr; }

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

  .page-header { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }

  .filter-bar { gap: var(--sp-2); }
  .filter-bar input[type="text"],
  .filter-bar select { min-width: 0 !important; flex: 1 1 140px; }

  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab  { white-space: nowrap; flex-shrink: 0; }

  .modal-overlay { padding: var(--sp-3); align-items: flex-end; }
  .modal {
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 90dvh;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ── Small phones  ≤ 600px ─────────────────────────────── */
@media (max-width: 600px) {
  .col-hide-sm { display: none !important; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input[type="text"],
  .filter-bar select,
  .filter-bar .btn { width: 100%; justify-content: center; min-width: 0 !important; flex: none; }

  .table-wrap { font-size: 13px; }
  thead th  { padding: 9px 10px; font-size: 10px; }
  tbody td  { padding: 10px 10px; }

  .breadcrumb { flex-wrap: wrap; }

  .modal-body   { padding: var(--sp-4); }
  .modal-header { padding: var(--sp-4); }
  .modal-footer { padding: var(--sp-3) var(--sp-4); }

  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 28px; }

  /* Login split layout → single column */
  .login-panel-left { display: none; }
  .login-panel-right { width: 100%; padding: var(--sp-6) var(--sp-5); }
}

/* ── Very small phones  ≤ 400px ────────────────────────── */
@media (max-width: 400px) {
  .page-content { padding: var(--sp-3); }
}

/* =========================================================
   Shared page components (dashboard hero, stat cards, ticket feed, chips)
   ========================================================= */

/* ── Dashboard hero banner ─────────────────────────────── */
.dash-hero {
  background: linear-gradient(135deg, #0d1117 0%, #1a2235 60%, #131b2e 100%);
  border-radius: var(--r-lg);
  padding: 32px 36px;
  margin-bottom: var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.dash-hero::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(67,97,238,0.08);
  top: -160px; right: -100px;
  pointer-events: none;
}
.dash-hero::after {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(129,140,248,0.06);
  bottom: -80px; left: 200px;
  pointer-events: none;
}
.dash-hero-text { position: relative; z-index: 1; }
.dash-greeting {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 8px;
}
.dash-name {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.dash-date {
  font-size: 13.5px;
  color: rgba(255,255,255,0.4);
}
.dash-hero-actions { display: flex; gap: 10px; position: relative; z-index: 1; flex-shrink: 0; }
.dash-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
  border: none;
}
.dash-hero-btn-primary {
  background: linear-gradient(135deg, #4361ee, #5a78f0);
  color: #fff;
  box-shadow: 0 2px 8px rgba(67,97,238,0.35);
}
.dash-hero-btn-primary:hover { background: linear-gradient(135deg, #3451d1, #4361ee); color: #fff; transform: translateY(-1px); }
.dash-hero-btn-ghost {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.12);
}
.dash-hero-btn-ghost:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ── Stat card inner layout (icon variant) ─────────────── */
.stat-card-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sc-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.stat-card .stat-label { margin-bottom: var(--sp-2); }
.stat-card .stat-value { font-size: 36px; letter-spacing: -0.03em; }

/* ── Ticket feed (tf-*) ────────────────────────────────── */
.ticket-feed { padding: 0; }
.tf-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid rgba(221,227,236,0.6);
  text-decoration: none;
  transition: background var(--t-fast);
  cursor: pointer;
}
.tf-item:last-child { border-bottom: none; }
.tf-item:hover { background: var(--c-ink-05); }
.tf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tf-dot-open        { background: #4361ee; }
.tf-dot-in_progress { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.tf-dot-closed      { background: #b0bac9; }
.tf-body { flex: 1; min-width: 0; }
.tf-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tf-meta {
  font-size: 12px;
  color: var(--c-ink-40);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tf-meta-sep { color: var(--c-ink-10); }
.tf-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tf-time { font-size: 11.5px; color: var(--c-ink-40); white-space: nowrap; }

/* ── Status/filter chips ───────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--sp-5);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-60);
  background: var(--c-white);
  border: 1.5px solid var(--c-border);
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.chip:hover {
  border-color: #4361ee;
  color: #4361ee;
}
.chip.chip-active {
  background: #4361ee;
  border-color: #4361ee;
  color: #fff;
}
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--c-ink-05);
  color: var(--c-ink-40);
}
.chip.chip-active .chip-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .dash-hero { flex-direction: column; align-items: flex-start; padding: 24px 22px; }
  .dash-hero-actions { flex-wrap: wrap; }
  .tf-right .status { display: none; }
}
@media (max-width: 520px) {
  .tf-right .priority { display: none; }
  .chip { font-size: 12px; padding: 5px 11px; }
}
