
.btn { padding: 7px 13px; font-size: 13px; font-weight: 500; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.loading { position: relative; padding-left: 28px; }
.btn.loading::before {
  content: ''; position: absolute; left: 9px; top: 50%; width: 12px; height: 12px;
  margin-top: -6px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #333; }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { background: #255f3d; }
.btn-red { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-icon { padding: 4px 7px; }

.badge { display: inline-block; padding: 2px 7px; border-radius: 100px; font-size: 11px; font-weight: 500; }
.badge-pending    { background: #f0f0ee; color: var(--muted); }
.badge-initiated  { background: var(--yellow-bg); color: var(--yellow); }
.badge-in_progress{ background: var(--yellow-bg); color: var(--yellow); }
.badge-answered   { background: var(--green-bg); color: var(--green); }
.badge-no_answer  { background: var(--red-bg); color: var(--red); }
.badge-busy       { background: var(--red-bg); color: var(--red); }
.badge-failed     { background: var(--red-bg); color: var(--red); }

.summary-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; margin-bottom: 12px; }
.sum-item { flex: 1; text-align: center; padding: 10px 4px; }
.sum-item + .sum-item { border-left: 1px solid var(--border); }
.sum-val { font-size: 20px; font-weight: 600; }
.sum-lbl { font-size: 11px; color: var(--muted); margin-top: 1px; }

.action-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.action-msg { font-size: 12px; color: var(--muted); width: 100%; padding-top: 2px; }
input[type=date] {
  padding: 5px 8px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
input[type=date]:focus { border-color: var(--text); }
select { padding: 6px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); outline: none; }

.emp-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.emp-row-top { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e8e6e0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.emp-info { flex: 1; min-width: 0; }
.emp-name { font-weight: 600; font-size: 14px; }
.emp-sub { font-size: 11px; color: var(--muted); }
.emp-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.custom-msg-area { margin-top: 8px; display: none; }
.custom-msg-area.open { display: block; }
.custom-msg-area textarea { width: 100%; padding: 7px 9px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: #fafafa; color: var(--text); outline: none; font-family: inherit; resize: vertical; min-height: 52px; }
.custom-msg-area textarea:focus { border-color: var(--text); background: #fff; }
.msg-toggle { font-size: 12px; color: var(--blue); cursor: pointer; margin-top: 6px; display: inline-block; }

.recordings-toggle { margin-top: 8px; display: flex; align-items: center; gap: 6px; cursor: pointer; padding-top: 8px; border-top: 1px solid var(--border); }
.recordings-toggle-label { font-size: 12px; color: var(--blue); font-weight: 500; }
.rec-arrow { font-size: 10px; color: var(--muted); transition: transform 0.15s; }
.rec-arrow.open { transform: rotate(90deg); }
.recordings-list { display: none; margin-top: 8px; }
.recordings-list.open { display: block; }
.rec-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; }
.rec-item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.rec-meta { font-size: 11px; color: var(--muted); }
.rec-item audio { width: 100%; height: 32px; margin-bottom: 4px; }
.transcript-box { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; line-height: 1.6; margin-top: 6px; }
.transcript-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.transcript-processing { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.card-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

.emp-list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.emp-list-row:last-child { border-bottom: none; }
.emp-list-info { flex: 1; min-width: 0; }
.emp-list-name { font-weight: 500; font-size: 13px; }
.emp-list-phone { font-size: 12px; color: var(--muted); font-family: monospace; }
.emp-inactive { opacity: 0.45; }

.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; cursor: pointer; transition: border-color 0.15s; }
.upload-zone:hover { border-color: var(--text); }
.upload-zone p { font-size: 13px; color: var(--muted); margin-top: 6px; }
.upload-zone.drag { border-color: var(--text); background: var(--bg); }

.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.report-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.report-table tr:last-child td { border-bottom: none; }

.sched-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sched-row:last-child { border-bottom: none; }
.sched-name { font-weight: 500; font-size: 13px; min-width: 130px; flex-shrink: 0; }
.sched-slots { display: flex; gap: 6px; align-items: center; flex: 1; flex-wrap: wrap; }
.slot-pill { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 100px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: var(--bg); user-select: none; white-space: nowrap; }
.slot-pill.on { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.slot-pill.off { background: #f0f0ee; border-color: var(--border); color: var(--muted); text-decoration: line-through; }
.slot-pill.empty { background: var(--bg); border-color: var(--border); color: var(--muted); border-style: dashed; }
.slot-popover { display: none; position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; z-index: 20; box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 200px; }
.slot-popover.open { display: block; }
.slot-popover select { padding: 5px 6px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); }
.slot-popover-row { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; }
.slot-popover-actions { display: flex; gap: 6px; }

/* Priority-call popover (viewport-fixed; positioned by priority.js so it can't spill
   off-page on bottom rows) */
.prio-popover { min-width: 236px; }
.prio-head { font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.prio-sub { font-size: 11px; color: var(--muted); line-height: 1.35; margin-bottom: 9px; }
.prio-field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.prio-field input { font-size: 12px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); }

/* Out-of-credits banner (sticky, red) — one per affected service */
#credit-banners { position: sticky; top: 0; z-index: 40; }
.credit-banner { display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  background: var(--red-bg, #fdecea); border-bottom: 1px solid var(--red, #d33); color: var(--red, #b3261e); }
.credit-banner .credit-ic { font-size: 16px; line-height: 1; flex-shrink: 0; }
.credit-banner .credit-text { flex: 1; font-size: 13px; line-height: 1.35; }
.credit-banner .credit-text b { font-weight: 700; }
.credit-banner .credit-since { color: var(--muted); font-weight: 400; }
.credit-banner .btn { flex-shrink: 0; background: var(--red, #d33); color: #fff; border-color: var(--red, #d33); }

.form-group { margin-bottom: 10px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=password], textarea { width: 100%; padding: 8px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: #fafafa; color: var(--text); outline: none; font-family: inherit; }
input[type=text]:focus, input[type=password]:focus, textarea:focus { border-color: var(--text); background: #fff; }
textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 3px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; padding: 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Toast stack — newest at the bottom, max 3 shown (capped in toast()) */
#toast-stack { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: #1a1a1a; color: #fff; padding: 9px 16px; border-radius: 100px; font-size: 13px; white-space: nowrap; opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Global in-flight progress bar — pinned to the bottom edge of the sticky topbar */
#global-progress { position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--border); overflow: hidden; display: none; }
#global-progress.active { display: block; }
#global-progress-bar { position: absolute; height: 100%; background: var(--green); border-radius: 100px; width: 30%; }
#global-progress.active #global-progress-bar { animation: gp-indeterminate 1.4s ease-in-out infinite; }
@keyframes gp-indeterminate {
  0%   { left: -35%; width: 35%; }
  50%  { left: 40%;  width: 45%; }
  100% { left: 100%; width: 35%; }
}

/* Excel drop target highlight */
#excel-drop.drag { border-color: var(--text); background: var(--bg); box-shadow: 0 0 0 2px var(--blue) inset; }

@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.day-label { display:inline-flex; align-items:center; gap:4px; padding:5px 10px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; cursor:pointer; background:var(--bg); transition:background 0.1s; }
.day-label:hover { background: var(--surface); }
.day-label input[type=checkbox] { width:14px; height:14px; accent-color: var(--green); }
.day-label span { color: var(--text); font-weight:500; }
.sched-slots select { color: var(--text); }
