/* ==========================================================================
   Helpdesk — operations console
   Hand-written, no build step. Edit directly.
   ========================================================================== */

:root {
  /* Surfaces */
  --ink:        #16202e;
  --ink-soft:   #3a4a60;
  --muted:      #6b7a90;
  --paper:      #eef1f5;
  --surface:    #ffffff;
  --surface-2:  #f7f9fb;
  --rule:       #dae1e9;
  --rule-soft:  #e9edf2;

  /* Signal — SLA health */
  --track:      #0d9488;
  --track-bg:   #e6f5f3;
  --risk:       #d97706;
  --risk-bg:    #fdf3e3;
  --breach:     #dc2626;
  --breach-bg:  #fdeceb;

  /* Action */
  --accent:     #2f5fd0;
  --accent-dk:  #24499e;
  --accent-bg:  #eaf0fd;

  --radius:     6px;
  --radius-lg:  10px;
  --shadow:     0 1px 2px rgba(22,32,46,.06), 0 1px 3px rgba(22,32,46,.04);
  --shadow-lg:  0 4px 12px rgba(22,32,46,.08), 0 1px 3px rgba(22,32,46,.06);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --sidebar-w: 232px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

/* Numerals, identifiers, timers — anything the eye scans in a column */
.mono, .ticket-id, .metric__value, .meter__label, time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ==========================================================================
   Shell
   ========================================================================== */

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: #c3cede;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.sidebar__brand span {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #7b8ca4;
  /* Lamba company naam sidebar (232px) se bahar na nikle */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__nav { padding: 12px 10px; flex: 1; overflow-y: auto; }

.sidebar__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #64758e;
  padding: 14px 8px 6px;
}

.navlink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #c3cede;
  font-size: 13.5px;
  font-weight: 500;
}
.navlink:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.navlink[aria-current="page"] { background: rgba(255,255,255,.10); color: #fff; }

.navlink__count {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,.12);
}
.navlink__count--alert { background: var(--breach); color: #fff; }

.sidebar__foot {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .02em;
}
.avatar--lg { width: 36px; height: 36px; flex-basis: 36px; font-size: 13px; }

.sidebar__user { min-width: 0; flex: 1; }
.sidebar__user b { display: block; color: #fff; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user span { font-size: 11px; color: #7b8ca4; text-transform: capitalize; }

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

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.content { padding: 24px; flex: 1; max-width: 1400px; width: 100%; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ==========================================================================
   Cards & panels
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: 12px 16px;
  border-top: 1px solid var(--rule-soft);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stack { display: grid; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid--main { grid-template-columns: minmax(0,1fr) 300px; align-items: start; }

/* ==========================================================================
   Metrics
   ========================================================================== */

.metric {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: block;
  color: inherit;
}
a.metric:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-lg); }

.metric__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric__value { font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 4px; letter-spacing: -.02em; }
.metric--alert .metric__value { color: var(--breach); }
.metric--warn  .metric__value { color: var(--risk); }
.metric--good  .metric__value { color: var(--track); }

/* ==========================================================================
   SLA meter — the signature element
   A depleting bar with a tick at the warning threshold.
   ========================================================================== */

.sla { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }

.meter {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: var(--rule-soft);
  overflow: hidden;
}
.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  border-radius: 3px;
  background: var(--track);
  transition: width .4s ease;
}
/* Tick showing where the warning threshold sits */
.meter__warn {
  position: absolute;
  top: -1px; bottom: -1px;
  left: var(--warn, 75%);
  width: 1px;
  background: rgba(22,32,46,.28);
}

.meter--risk   .meter__fill { background: var(--risk); }
.meter--breach .meter__fill { background: var(--breach); }

.meter__label { font-size: 11px; color: var(--muted); letter-spacing: -.01em; }
.meter__label b { font-weight: 600; }
.sla--risk   .meter__label b { color: var(--risk); }
.sla--breach .meter__label b { color: var(--breach); }
.sla--track  .meter__label b { color: var(--track); }

/* ==========================================================================
   Badges & pills
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.badge--track  { background: var(--track-bg);  color: #0b6f66; border-color: #bfe4df; }
.badge--risk   { background: var(--risk-bg);   color: #9a5606; border-color: #f2ddb8; }
.badge--breach { background: var(--breach-bg); color: #a91b1b; border-color: #f5c9c6; }
.badge--accent { background: var(--accent-bg); color: var(--accent-dk); border-color: #c9d9f8; }

.ticket-id {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -.02em;
}

/* ==========================================================================
   Ticket list — the spine encodes SLA health
   ========================================================================== */

.tickets { display: flex; flex-direction: column; }

.trow {
  display: grid;
  grid-template-columns: 3px minmax(0,1fr) auto;
  gap: 0 14px;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid var(--rule-soft);
  color: inherit;
  background: var(--surface);
}
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-2); text-decoration: none; }
.trow:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.trow:last-child  { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.trow__spine { align-self: stretch; background: var(--rule); }
.trow--track  .trow__spine { background: var(--track); }
.trow--risk   .trow__spine { background: var(--risk); }
.trow--breach .trow__spine { background: var(--breach); }

.trow__body { padding: 12px 0; min-width: 0; }
.trow__title {
  font-weight: 600;
  font-size: 13.5px;
  margin: 2px 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trow__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}
.trow__side { padding: 12px 16px 12px 0; text-align: right; }

.sep { color: var(--rule); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink);
}
.label .req { color: var(--breach); font-weight: 400; }

.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7a90' d='M6 8.5 2 4.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.input--error, .select--error, .textarea--error { border-color: var(--breach); }

.error { color: var(--breach); font-size: 12px; margin-top: 5px; font-weight: 500; }

.checkline { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.checkline input { margin: 3px 0 0; flex: none; accent-color: var(--accent); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters .select, .filters .input { width: auto; min-width: 130px; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dk); }

.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: var(--surface-2); border-color: #c3ccd8; }

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

.btn--go { background: var(--track); color: #fff; }
.btn--go:hover { background: #0b7c72; }

.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; }

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.alert--success { background: var(--track-bg);  border-color: #bfe4df; color: #0b6f66; }
.alert--error   { background: var(--breach-bg); border-color: #f5c9c6; color: #a91b1b; }
.alert--warn    { background: var(--risk-bg);   border-color: #f2ddb8; color: #9a5606; }
.alert--info    { background: var(--accent-bg); border-color: #c9d9f8; color: var(--accent-dk); }
.alert b { font-weight: 650; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ==========================================================================
   Conversation thread
   ========================================================================== */

.thread { display: flex; flex-direction: column; }

.msg {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--rule-soft);
}
.msg:last-child { border-bottom: 0; }
.msg--internal { background: var(--risk-bg); }

.msg__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.msg__head b { font-size: 13px; font-weight: 650; }
.msg__head time { font-size: 11.5px; color: var(--muted); }
.msg__body { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; }

/* ==========================================================================
   History timeline
   ========================================================================== */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 4px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--rule);
}
.timeline li { position: relative; padding: 0 0 12px 20px; font-size: 12.5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: 0; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--rule);
}
.timeline li.is-key::before { border-color: var(--accent); }
.timeline time { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ==========================================================================
   Detail list
   ========================================================================== */

.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 13px; align-items: baseline; }
.dl dt { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dl dd { margin: 0; font-weight: 500; text-align: right; min-width: 0; overflow-wrap: break-word; }

/* ==========================================================================
   Attachments
   ========================================================================== */

.files { display: flex; flex-direction: column; gap: 6px; }
.file {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12.5px;
  background: var(--surface);
  color: inherit;
}
.file:hover { border-color: var(--accent); text-decoration: none; }
.file__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file__size { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ==========================================================================
   Empty states — an invitation to act, not a shrug
   ========================================================================== */

.empty { padding: 44px 24px; text-align: center; }
.empty h3 { font-size: 14px; margin-bottom: 5px; }
.empty p { color: var(--muted); font-size: 13px; max-width: 340px; margin: 0 auto 16px; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; flex-wrap: wrap; }
.pagination li span, .pagination li a {
  display: block;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-family: var(--mono);
  background: var(--surface);
  color: var(--ink);
}
.pagination li a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .active span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .disabled span { color: #b6c0cd; }

/* ==========================================================================
   Auth screens
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 900px 500px at 50% -12%, #23324a 0%, transparent 70%),
    var(--ink);
}
.auth__box { width: 100%; max-width: 380px; }
.auth__brand { text-align: center; margin-bottom: 22px; color: #fff; }
.auth__brand strong { display: block; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.auth__brand span {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #7b8ca4;
  margin-top: 3px;
}
.auth__card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 12px 32px rgba(0,0,0,.28); }
.auth__foot { text-align: center; margin-top: 16px; font-size: 12px; color: #64758e; }

/* ==========================================================================
   Utilities
   ========================================================================== */

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--tight { gap: 6px; }
.row--between { justify-content: space-between; }
.push { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.hide { display: none; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

/* ==========================================================================
   Responsive — sidebar folds to a top bar
   ========================================================================== */

@media (max-width: 980px) {
  .grid--main { grid-template-columns: minmax(0,1fr); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-basis: auto;
    height: auto;
    position: static;
  }
  .sidebar__nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; }
  .sidebar__label { display: none; }
  .navlink { white-space: nowrap; }
  .sidebar__brand { display: flex; align-items: center; justify-content: space-between; }
  .sidebar__foot { border-top: 1px solid rgba(255,255,255,.08); }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0,1fr); }
  .trow { grid-template-columns: 3px minmax(0,1fr); }
  .trow__side { grid-column: 2; padding: 0 16px 12px 0; text-align: left; }
  .dl { grid-template-columns: minmax(0,1fr); gap: 2px 0; }
  .dl dd { text-align: left; margin-bottom: 8px; }
  h1 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .btn, .filters { display: none !important; }
  body { background: #fff; }
  .card { border-color: #ccc; box-shadow: none; }
}
