:root {
  --tpm-sidebar: #0f172a;
  --tpm-sidebar-text: #cbd5e1;
  --tpm-accent: #2563eb;
  --tpm-bg: #f4f6fa;
}
body { background: var(--tpm-bg); font-size: .925rem; }
.prewrap { white-space: pre-wrap; word-break: break-word; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--tpm-sidebar); color: var(--tpm-sidebar-text); flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 10px; }
.sidebar .brand { display: block; color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; padding: 6px 12px 18px; }
.sidebar .brand i { color: #60a5fa; }
.sidebar .nav-link { color: var(--tpm-sidebar-text); border-radius: 8px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--tpm-accent); color: #fff; }
.sidebar .nav-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #64748b; padding: 18px 12px 6px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 1010; }
.topbar .search { max-width: 420px; background: var(--tpm-bg); border-color: transparent; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: -260px; z-index: 1030; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

.card { border: 1px solid #e5e7eb; border-radius: 12px; }
.card-header { background: #fff; border-bottom: 1px solid #eef0f3; padding: 12px 16px; }
.card-header:first-child { border-radius: 12px 12px 0 0; }

/* Dashboard */
.stat .card-body { padding: 18px; }
.stat-icon { font-size: 1.4rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: #0f172a; }
.stat-label { color: #64748b; font-size: .85rem; }
.stat:hover { border-color: var(--tpm-accent); }
.activity .list-group-item { border-color: #f1f3f6; }

/* Ticket tables */
table.tickets tbody tr { cursor: pointer; }
table.tickets td, table.tickets th { padding: 10px 14px; }
table.tickets thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; background: #fafbfc; }
.empty { text-align: center; padding: 40px 16px; color: #94a3b8; }
.empty i { font-size: 2rem; display: block; margin-bottom: 6px; }

/* Category picker */
.cat-card { transition: border-color .15s, box-shadow .15s; }
.cat-card:hover { border-color: var(--tpm-accent); box-shadow: 0 4px 14px rgba(37,99,235,.12); }
.cat-icon { width: 44px; height: 44px; border-radius: 10px; background: #eff6ff; color: var(--tpm-accent); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.cat-card.issue .cat-icon { background: #fef2f2; color: #dc2626; }

/* Forms */
.lookup-results { max-height: 320px; overflow-y: auto; }
.lookup-results .dropdown-item { white-space: normal; }
.field-invalid .form-control, .field-invalid .form-select { border-color: #dc3545; }
.field-invalid .form-label { color: #dc3545; }
.field-invalid .btn-outline-primary { border-color: #dc3545; }
.route { padding-left: 1.2rem; }
.route li { margin-bottom: 10px; }

/* Ticket page */
dl.details dt { font-weight: 500; color: #64748b; }
dl.details dd { margin-bottom: .7rem; }
.stepper { list-style: none; padding: 0; margin: 0; }
.stepper li { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.stepper li:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: #e5e7eb; }
.stepper .dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .85rem; }
.stepper li.done .dot { background: #16a34a; border-color: #16a34a; color: #fff; }
.stepper li.done::before { background: #16a34a !important; }
.stepper li.pending .dot { border-color: var(--tpm-accent); color: var(--tpm-accent); box-shadow: 0 0 0 4px #dbeafe; }
.stepper li.waiting-info .dot { border-color: #f59e0b; color: #f59e0b; }
.stepper li.rejected .dot { background: #dc2626; border-color: #dc2626; color: #fff; }
.stepper li.cancelled .dot { background: #94a3b8; border-color: #94a3b8; color: #fff; }
.stepper li.waiting { color: #94a3b8; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline .ev { border-left: 3px solid #e5e7eb; padding: 8px 0 10px 14px; margin-left: 4px; }
.timeline .ev-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.timeline .ev-body { background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin-top: 6px; }
.timeline .ev.success { border-color: #16a34a; }
.timeline .ev.danger { border-color: #dc2626; }
.timeline .ev.warning { border-color: #f59e0b; }
.timeline .ev.note { border-color: #eab308; }
.timeline .ev.note .ev-body { background: #fefce8; }
.timeline .ev-assigned, .timeline .ev-priority { opacity: .75; font-size: .85rem; }
.reply.is-note textarea { background: #fefce8; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 4px 10px; margin: 6px 6px 0 0; text-decoration: none; font-size: .85rem; background: #fff; }
.att-chip:hover { border-color: var(--tpm-accent); }

/* Notifications */
.notif-menu { width: 360px; max-height: 460px; overflow-y: auto; }
.notif-menu .notif { white-space: normal; border-bottom: 1px solid #f1f3f6; padding: 10px 16px; }
.notif-menu .notif.unread { background: #eff6ff; }

/* Auth */
body.auth { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 8vh 16px; }
.auth-card { width: 100%; max-width: 420px; }
.brand-lg { font-weight: 700; font-size: 1.5rem; color: var(--tpm-accent); }

/* Admin */
.sortable-row .handle { cursor: grab; color: #94a3b8; }
.mapping td { vertical-align: middle; }
.code-badge { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }

/* Companies */
.company-badge { font-weight: 600; letter-spacing: .02em; color: #fff; vertical-align: middle; }
.portal-logo { max-height: 28px; max-width: 160px; vertical-align: middle; }
