/* ============================================================
   HELPDESK MEGADATA — ISP Complaint Management System
   app.css v1.0
   ============================================================ */

:root {
  --bg:        #F4F5F7;
  --bg2:       #EBEDF0;
  --surface:   #FFFFFF;
  --border:    #DDE1E7;
  --border2:   #C8CDD6;
  --text:      #1A1D23;
  --text2:     #4A5568;
  --text3:     #8896A5;
  --blue:      #1B5FA8;
  --blue-l:    #E8F0FB;
  --blue-d:    #0D3D72;
  --green:     #1E7E4A;
  --green-l:   #E6F4ED;
  --red:       #C0392B;
  --red-l:     #FDECEA;
  --amber:     #B45309;
  --amber-l:   #FEF3C7;
  --purple:    #6B3FA0;
  --purple-l:  #F0EBF8;
  --radius:    6px;
  --radius-lg: 10px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── UTILITIES ──────────────────────────────────────────── */
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
.fade-in { animation: fadeIn .2s ease; }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn i { font-size: 15px; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-d); }
.btn-full { width: 100%; justify-content: center; padding: 10px; }
.btn-green  { background: var(--green-l);  color: var(--green);  border-color: #A7D7B8; }
.btn-red    { background: var(--red-l);    color: var(--red);    border-color: #F5A9A0; }
.btn-amber  { background: var(--amber-l);  color: var(--amber);  border-color: #FCD975; }
.btn-purple { background: var(--purple-l); color: var(--purple); border-color: #C9B0E8; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-sm i { font-size: 13px; }

/* ── FORM ───────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  font-size: 11px; font-weight: 500; color: var(--text2);
  margin-bottom: 5px; display: block;
  text-transform: uppercase; letter-spacing: .4px;
}
.form-input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 13px;
  color: var(--text); background: var(--surface);
  outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: var(--blue); }
textarea.form-input { resize: vertical; }
select.form-input { cursor: pointer; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.readonly-input { background: var(--bg) !important; color: var(--text3) !important; cursor: default; }

/* ── BADGES ─────────────────────────────────────────────── */
.nav-badge { margin-left: auto; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px; }
.nb-red    { background: var(--red-l);    color: var(--red); }
.nb-blue   { background: var(--blue-l);   color: var(--blue); }
.nb-amber  { background: var(--amber-l);  color: var(--amber); }
.nb-green  { background: var(--green-l);  color: var(--green); }

.status-pill { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.s-open             { background: var(--blue-l);   color: var(--blue); }
.s-inprogress       { background: var(--amber-l);  color: var(--amber); }
.s-escalated        { background: var(--red-l);    color: var(--red); }
.s-solved           { background: var(--green-l);  color: var(--green); }
.s-handover         { background: var(--purple-l); color: var(--purple); }
.s-waiting_dispatch { background: #FFF3CD; color: #856404; }
.s-dispatched       { background: #D1ECF1; color: #0C5460; }
.s-visit_done       { background: var(--green-l);  color: var(--green); }

/* ── LOGIN ──────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px);
}
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 380px; box-shadow: var(--shadow-lg); }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-logo-icon { width: 40px; height: 40px; background: var(--blue); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; }
.login-logo-text { font-size: 16px; font-weight: 600; }
.login-logo-sub  { font-size: 11px; color: var(--text3); }
.login-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-sub   { font-size: 12px; color: var(--text3); margin-bottom: 24px; }

/* ── LAYOUT ─────────────────────────────────────────────── */
#app { display: none; height: 100vh; }
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.sb-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sb-logo { display: flex; align-items: center; gap: 9px; }
.sb-logo-icon { width: 32px; height: 32px; background: var(--blue); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0; }
.sb-logo-name { font-size: 13px; font-weight: 600; }
.sb-logo-sub  { font-size: 10px; color: var(--text3); }
.sb-nav { padding: 8px; flex: 1; overflow-y: auto; }
.sb-section { font-size: 10px; color: var(--text3); padding: 8px 8px 4px; text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--radius); cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text2); transition: all .12s; margin-bottom: 1px; }
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--blue-l); color: var(--blue); }
.nav-item i { font-size: 16px; flex-shrink: 0; }
.sb-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 9px; }
.user-av { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-l); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.user-name  { font-size: 12px; font-weight: 600; }
.user-role  { font-size: 10px; color: var(--text3); }
.user-shift { margin-left: auto; font-size: 10px; padding: 2px 6px; border-radius: 10px; background: var(--green-l); color: var(--green); font-weight: 500; }

/* ── MAIN ───────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 52px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-sep   { color: var(--border2); }
.topbar-sub   { font-size: 12px; color: var(--text3); }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* ── STATS ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.stat-label i { font-size: 14px; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; font-family: 'DM Mono', monospace; }
.stat-sub   { font-size: 11px; color: var(--text3); margin-top: 4px; }
.stat-blue  { color: var(--blue); }
.stat-green { color: var(--green); }
.stat-red   { color: var(--red); }
.stat-amber { color: var(--amber); }

/* ── SLA ────────────────────────────────────────────────── */
.sla-card   { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.sla-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sla-title  { font-size: 12px; font-weight: 600; }
.sla-pct    { font-size: 13px; font-weight: 600; color: var(--green); font-family: 'DM Mono', monospace; }
.sla-bar    { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.sla-fill   { height: 100%; background: var(--green); border-radius: 3px; transition: width .5s; }
.sla-meta   { display: flex; gap: 16px; }
.sla-dot    { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 4px; }

/* ── TICKETS ────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; }
.section-title  { font-size: 13px; font-weight: 600; }
.filter-row { display: flex; gap: 5px; }
.filter-btn { padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: none; font-size: 11px; font-weight: 500; cursor: pointer; color: var(--text3); font-family: inherit; transition: all .12s; }
.filter-btn:hover  { background: var(--bg); color: var(--text); }
.filter-btn.active { background: var(--surface); color: var(--text); border-color: var(--border2); box-shadow: var(--shadow); }
.ticket-list { display: flex; flex-direction: column; gap: 6px; }
.ticket-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; cursor: pointer; transition: all .12s; display: flex; gap: 12px; align-items: flex-start; }
.ticket-card:hover  { border-color: var(--border2); box-shadow: var(--shadow); }
.ticket-card.active { border-color: var(--blue); border-width: 1.5px; }
.ticket-prio   { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; }
.prio-high     { background: var(--red); }
.prio-medium   { background: var(--amber); }
.prio-low      { background: var(--green); }
.ticket-body   { flex: 1; min-width: 0; }
.ticket-top    { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.ticket-no     { font-size: 10px; color: var(--text3); font-family: 'DM Mono', monospace; font-weight: 500; flex-shrink: 0; }
.ticket-title  { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ticket-meta   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ticket-meta-item   { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 3px; }
.ticket-meta-item i { font-size: 13px; }

/* ── RIGHT PANEL ────────────────────────────────────────── */
.right-panel { width: 300px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.panel-tabs  { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab   { flex: 1; padding: 10px 8px; text-align: center; font-size: 11px; font-weight: 500; cursor: pointer; color: var(--text3); border-bottom: 2px solid transparent; transition: all .12s; }
.panel-tab:hover  { color: var(--text); }
.panel-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel-body  { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.panel-empty { text-align: center; padding: 40px 20px; color: var(--text3); }
.panel-empty i    { font-size: 32px; display: block; margin-bottom: 8px; }
.panel-empty span { font-size: 12px; }
.detail-block { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; font-weight: 500; }
.detail-value { font-size: 12px; }
.detail-muted { font-size: 11px; color: var(--text3); }
.divider      { height: 1px; background: var(--border); }
.flow-list    { display: flex; flex-direction: column; }
.flow-item    { display: flex; gap: 10px; }
.flow-left    { display: flex; flex-direction: column; align-items: center; }
.flow-dot     { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 2px; }
.flow-line    { width: 1px; background: var(--border); flex: 1; min-height: 20px; margin: 2px 0; }
.flow-content { padding-bottom: 14px; }
.flow-role    { font-size: 11px; font-weight: 600; }
.flow-action  { font-size: 11px; color: var(--text3); }
.flow-time    { font-size: 10px; color: var(--text3); font-family: 'DM Mono', monospace; }
.dot-done     { background: var(--green); }
.dot-active   { background: var(--blue); }
.dot-pending  { background: var(--border2); }
.action-panel { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.action-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; font-weight: 500; }
.action-row   { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── MODAL ──────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(26,29,35,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal   { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 520px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal-title i { font-size: 18px; color: var(--blue); }
.modal-body   { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── INFO BOX ───────────────────────────────────────────── */
.info-box  { padding: 10px 12px; border-radius: var(--radius); font-size: 12px; display: flex; align-items: flex-start; gap: 8px; }
.info-box i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.info-blue  { background: var(--blue-l);  color: var(--blue); }
.info-amber { background: var(--amber-l); color: var(--amber); }
.info-green { background: var(--green-l); color: var(--green); }

/* ── CUSTOMER SEARCH ────────────────────────────────────── */
.cs-wrap { position: relative; }
.cs-drop { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); z-index: 50; max-height: 200px; overflow-y: auto; margin-top: 2px; box-shadow: var(--shadow-lg); }
.cs-item  { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s; }
.cs-item:hover  { background: var(--bg); }
.cs-item:last-child { border-bottom: none; }
.cs-item-name { font-size: 12px; font-weight: 600; }
.cs-item-sub  { font-size: 11px; color: var(--text3); }
.cs-selected  { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; display: flex; align-items: center; gap: 10px; }
.cs-av  { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-l); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.cs-tag { font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600; margin-left: auto; }
.tag-active   { background: var(--green-l); color: var(--green); }
.tag-inactive { background: var(--red-l);   color: var(--red); }

/* ── DISPATCH ───────────────────────────────────────────── */
.dispatch-card   { background: var(--surface); border: 1.5px solid var(--amber); border-radius: var(--radius-lg); padding: 14px 16px; }
.dispatch-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dispatch-title  { font-size: 12px; font-weight: 600; color: var(--amber); }
.dispatch-count  { font-size: 18px; font-weight: 700; color: var(--amber); font-family: 'DM Mono', monospace; }
.dispatch-list   { display: flex; flex-direction: column; gap: 8px; }
.dispatch-item   { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.dispatch-info   { flex: 1; min-width: 0; }
.dispatch-tkt    { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text3); }
.dispatch-cust   { font-size: 12px; font-weight: 600; }
.dispatch-addr   { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── TOAST ──────────────────────────────────────────────── */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; border-radius: var(--radius); padding: 10px 16px; display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 500; z-index: 999; transform: translateY(60px); opacity: 0; transition: all .25s; max-width: 280px; box-shadow: var(--shadow-lg); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast i { font-size: 16px; flex-shrink: 0; }
.toast.toast-ok  i { color: #6EE7A0; }
.toast.toast-err i { color: #FCA5A5; }
