/* IT Helpdesk — mobile-first */
:root {
  --bg: #f2f4f8; --card: #fff; --text: #172033; --muted: #667085; --line: #e4e7ec;
  --brand: #0b4f8a; --brand-d: #083b68; --brand-2: #e8f1fa;
  --ok: #15803d; --ok-bg: #e7f6ec; --warn: #b45309; --warn-bg: #fff4e0; --bad: #b91c1c; --bad-bg: #fdecec;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); }
h1 { font-size: 20px; line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.okc { color: var(--ok); } .badc { color: var(--bad); }
.inline { display: inline; }
@media (max-width: 767px) { .hide-m { display: none !important; } }

/* ---------- header ---------- */
.top { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand small { font-weight: 400; opacity: .8; font-size: 12px; display: block; line-height: 1.1; }
.top nav { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: grid; place-items: center; font-weight: 700; text-decoration: none; }

/* ---------- bottom nav (mobile) ---------- */
main.wrap { padding-top: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: stretch; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a.on { color: var(--brand); }
.bottom-nav a.fab span.ic { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center;
  margin-top: -22px; box-shadow: 0 4px 12px rgba(11, 79, 138, .35); }
.bottom-nav a.fab span.ic svg { width: 26px; height: 26px; }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.narrow { max-width: 440px; margin: 24px auto; }
.cols { display: flex; flex-direction: column; }
.side-col { order: -1; }   /* di HP: tindakan tampil sebelum detail */
.grid2, .grid3 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.grid2 .full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
footer { padding: 8px 16px 24px; display: none; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
label small, .hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
input, select, textarea { width: 100%; padding: 12px; border: 1px solid #cfd5df; border-radius: 10px; font: inherit; font-size: 16px;
  margin-top: 6px; background: #fff; color: var(--text); min-height: 46px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
input[type=file] { padding: 10px; background: #f8fafc; border-style: dashed; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 16px;
  border: 1px solid #c9d1dd; border-radius: 10px; background: #fff; color: var(--text); cursor: pointer; font: inherit; font-weight: 600;
  text-decoration: none; width: 100%; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-d); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.sm { min-height: 36px; padding: 6px 12px; width: auto; font-size: 14px; }
.link { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; color: inherit; }
.sticky-submit { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%);
  padding: 16px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }

/* pilihan besar (radio cards) */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 16px; }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font-weight: 600; cursor: pointer; }
.choice span em { font-style: normal; font-size: 24px; line-height: 1; }
.choice span small { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.35; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-2); box-shadow: 0 0 0 1px var(--brand) inset; }
.choice input:focus-visible + span { outline: 2px solid var(--brand); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 4px; }
.segmented .choice span { align-items: center; text-align: center; padding: 10px 6px; font-size: 14px; }
.fieldset-title { font-weight: 600; font-size: 14px; }

/* ---------- flash ---------- */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--brand-2); font-size: 14px; }
.flash.error { background: var(--bad-bg); color: var(--bad); } .flash.ok { background: var(--ok-bg); color: var(--ok); }

/* ---------- hero (beranda user) ---------- */
.hero { background: linear-gradient(135deg, var(--brand), #1c6fb5); color: #fff; border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px; }
.hero h1 { color: #fff; margin-bottom: 4px; }
.hero p { margin: 0 0 14px; opacity: .9; font-size: 14px; }
.hero .btn { background: #fff; color: var(--brand); border-color: #fff; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); border-left: 4px solid var(--brand); padding: 10px 12px; text-decoration: none; color: var(--text); }
.stat b { display: block; font-size: 22px; line-height: 1.2; } .stat span { color: var(--muted); font-size: 12px; }
.stat.warn { border-left-color: var(--warn); } .stat.bad { border-left-color: var(--bad); }

/* ---------- chips / filters ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
details.filter-box { margin-bottom: 12px; }
details.filter-box summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 4px 0; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.filters input, .filters select { margin-top: 0; }
.filters .full, .filters .btn { grid-column: 1 / -1; }

/* ---------- ticket cards (list) ---------- */
.tlist { display: flex; flex-direction: column; gap: 10px; }
.tcard { display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; text-decoration: none; color: var(--text); border-left: 4px solid transparent; }
.tcard.late { border-left-color: var(--bad); }
.tcard .t-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.tcard .t-title { font-weight: 600; font-size: 15px; margin: 6px 0 8px; }
.tcard .t-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); align-items: center; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty b { display: block; font-size: 32px; margin-bottom: 6px; }

/* ---------- tables (IT / desktop) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.compact td, table.compact th { padding: 6px; }
table td input, table td select { min-height: 38px; padding: 6px 8px; margin: 0; font-size: 14px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.late td { background: #fff6f6; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e5e7eb; white-space: nowrap; }
.s-New { background: #dbeafe; color: #1e40af; } .s-Under-Review, .s-Assigned { background: #e0e7ff; color: #3730a3; }
.s-Waiting-Approval, .s-Pending-User, .s-Pending-Vendor, .s-Submitted { background: #fef3c7; color: #92400e; }
.s-In-Progress { background: #cffafe; color: #155e75; } .s-Escalated, .s-Reopened, .s-Returned { background: #ffedd5; color: #9a3412; }
.s-Resolved, .s-Reviewed { background: #d1fae5; color: #065f46; } .s-Closed, .s-Approved { background: #bbf7d0; color: #14532d; }
.s-Rejected { background: #fecaca; color: #991b1b; } .s-Draft { background: #e5e7eb; }
.prio { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff; background: #6b7280; }
.prio.P1 { background: #b91c1c; } .prio.P2 { background: #ea580c; } .prio.P3 { background: #2563eb; } .prio.P4 { background: #6b7280; }

/* ---------- ticket detail ---------- */
.ticket-head .code { font-size: 13px; color: var(--muted); font-weight: 600; }
.ticket-head h1 { margin: 2px 0 8px; }
.ticket-head .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status-note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--brand-2); font-size: 14px; }
.status-note.warn { background: var(--warn-bg); color: #7a3e06; } .status-note.bad { background: var(--bad-bg); color: var(--bad); }
.status-note.ok { background: var(--ok-bg); color: var(--ok); }
.steps { display: flex; margin: 16px 0 4px; padding: 0; list-style: none; }
.steps li { flex: 1; text-align: center; font-size: 11px; color: var(--muted); position: relative; padding-top: 22px; }
.steps li::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: #d0d5dd; z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 3px; background: #d0d5dd; }
.steps li:first-child::after { display: none; }
.steps li.done, .steps li.cur { color: var(--text); font-weight: 600; }
.steps li.done::before, .steps li.done::after, .steps li.cur::after { background: var(--brand); }
.steps li.cur::before { background: #fff; border: 4px solid var(--brand); width: 18px; height: 18px; top: 2px; }
.steps.rejected li.cur::before { border-color: var(--bad); } .steps.rejected li.cur { color: var(--bad); }
dl.info { display: grid; grid-template-columns: 1fr; gap: 2px 12px; margin: 0 0 12px; font-size: 14px; }
dl.info dt { color: var(--muted); font-size: 12px; margin-top: 8px; } dl.info dd { margin: 0; }
.desc, .msg { white-space: pre-wrap; background: #f8fafc; border-radius: 10px; padding: 12px; font-size: 14px; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; border-left: 2px solid var(--line); padding: 0 0 16px 16px; margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline li.internal::before { background: var(--warn); }
.timeline .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.file { margin-top: 6px; font-size: 14px; overflow-wrap: anywhere; }
.actions details { border-top: 1px solid var(--line); padding: 4px 0; }
.actions details:first-of-type { border-top: 0; }
.actions summary { cursor: pointer; font-weight: 600; padding: 10px 0; list-style: none; display: flex; justify-content: space-between; }
.actions summary::-webkit-details-marker { display: none; }
.actions summary::after { content: "›"; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
.actions details[open] summary::after { transform: rotate(-90deg); }
.actions details form { padding-bottom: 8px; }
.actions > form { margin-bottom: 10px; }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; margin: 6px 0 12px; }
.stars input { position: absolute; opacity: 0; }
.stars label { font-size: 34px; line-height: 1; color: #d0d5dd; cursor: pointer; margin: 0; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f59e0b; }

/* ---------- tablet / desktop ---------- */
@media (min-width: 768px) {
  .hide-d { display: none !important; }
  main.wrap { padding-top: 20px; padding-bottom: 24px; }
  .top nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 14px; }
  .top nav a, .top nav .link { color: #fff; text-decoration: none; opacity: .92; }
  .top nav a:hover { opacity: 1; text-decoration: underline; }
  .top nav .muted { color: #cfe0f1; }
  .bottom-nav, .avatar { display: none; }
  footer { display: block; }
  .btn { width: auto; }
  .row > .btn { flex: none; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .choices { grid-template-columns: repeat(4, 1fr); }
  .filters { display: flex; flex-wrap: wrap; align-items: center; }
  .filters input, .filters select { width: auto; }
  details.filter-box > summary { display: none; }
  dl.info { grid-template-columns: 170px 1fr; } dl.info dt { margin-top: 0; font-size: 14px; }
  .sticky-submit { position: static; background: none; margin: 0; padding: 8px 0 0; }
  .sticky-submit .btn { width: auto; min-width: 200px; }
  .steps li { font-size: 12px; }
}
@media (min-width: 1000px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
  .side-col { order: 0; position: sticky; top: 72px; }
}
@media print {
  .top, .bottom-nav, .noprint, footer { display: none !important; }
  body { background: #fff; } main.wrap { padding: 0; } .card { box-shadow: none; border: 0; }
}

/* ---------- status untuk user & kartu PIC ---------- */
.tcard .t-status { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: -2px 0 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #9ca3af; }
.dot.s-New { background: #3b82f6; } .dot.s-Under-Review, .dot.s-Assigned { background: #6366f1; }
.dot.s-Waiting-Approval, .dot.s-Pending-User, .dot.s-Pending-Vendor { background: #f59e0b; }
.dot.s-In-Progress { background: #06b6d4; } .dot.s-Escalated, .dot.s-Reopened { background: #f97316; }
.dot.s-Resolved, .dot.s-Closed { background: #16a34a; } .dot.s-Rejected { background: #dc2626; }
.pic-card { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.pic-card .pic-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.pic-card b { display: block; font-size: 16px; }
.pic-card small { display: block; color: var(--muted); font-size: 12px; }
