/* Panou Call Center Bogdan - brand Gral Medical (portocaliu + bleumarin). */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --brand-orange: #fd7300;
  --brand-orange-dark: #e36800;
  --brand-navy: #00205b;
  --brand-navy-dark: #001540;
  --brand-blue: #3550bf;
  --brand-white: #ffffff;
  --text-dark: #1c2733;
  --text-muted: #5a6b7a;
  --bg-soft: #f4f6f8;
  --border-soft: #dde3e8;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: 'Montserrat', 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--text-dark);
  font-size: 15px;
}

/* --- header --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--brand-navy);
  color: var(--brand-white);
  padding: 10px 22px;
  border-bottom: 4px solid var(--brand-orange);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand img.logo {
  height: 46px;
  width: auto;
  background: var(--brand-white);
  padding: 4px 6px;
  border-radius: 6px;
}
.brand .titles h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.brand .titles .sub {
  font-size: 12px;
  opacity: 0.85;
}
.sync {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sync-info {
  font-size: 12px;
  opacity: 0.9;
  text-align: right;
}
button {
  cursor: pointer;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  background: var(--brand-navy-dark);
  color: var(--brand-white);
  transition: background 0.15s ease;
}
button:hover {
  background: var(--brand-blue);
}
#btn-sync {
  background: var(--brand-orange);
}
#btn-sync:hover {
  background: var(--brand-orange-dark);
}

/* --- tabs --- */
.tabs {
  display: flex;
  background: var(--brand-white);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 16px;
}
.tab {
  background: none;
  color: var(--text-muted);
  border-radius: 0;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  font-weight: 500;
}
.tab:hover {
  background: transparent;
  color: var(--brand-navy);
}
.tab.active {
  color: var(--brand-orange);
  border-bottom-color: var(--brand-orange);
  font-weight: 600;
}

/* --- layout --- */
main {
  padding: 18px 22px;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.filters,
.search-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filters label {
  font-size: 14px;
}
.count,
.hint {
  color: #5a6b7a;
  font-size: 13px;
}
.search-bar input,
#patient-phone {
  padding: 9px 12px;
  border: 1px solid #c5cfd8;
  border-radius: 5px;
  font-size: 14px;
  min-width: 260px;
}
select {
  padding: 6px 8px;
  border: 1px solid #c5cfd8;
  border-radius: 5px;
}

/* --- list / call cards --- */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.call {
  background: #fff;
  border: 1px solid #e2e8ee;
  border-left: 5px solid #c5cfd8;
  border-radius: 6px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 150px 110px 1fr 150px 130px;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}
.call:hover {
  background: #f0f7fc;
}
/* min-width:0 lets grid children shrink so the summary can ellipsis instead
   of pushing the outcome/status badges off-screen. */
.call > div {
  min-width: 0;
}
.call .phone {
  font-weight: 600;
  font-size: 15px;
}
.call .meta {
  font-size: 12px;
  color: #5a6b7a;
}
.call .title {
  font-size: 14px;
}
.call .summary-sm {
  font-size: 12px;
  color: #5a6b7a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- badges --- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.o-transfer {
  background: #fde2cf;
  color: #9a4b07;
}
/* Transfer status variants: green = SIP REFER succeeded (operator likely picked
   up), red = REFER failed (481 / NOTIFY noresource), yellow = unknown (no
   transfer tool, e.g. v1 prod text-only transfer). */
.o-transfer-ok {
  background: #cdeccd;
  color: #1f6b1f;
}
.o-transfer-failed {
  background: #fbd0d0;
  color: #a01616;
}
.o-transfer-unknown {
  background: #fde7c2;
  color: #8a6300;
}
.o-crash {
  background: #fbd0d0;
  color: #a01616;
}
.o-abandon {
  background: #e6e0f5;
  color: #5b3f9c;
}
.o-programare_neterminata {
  background: #fde7c2;
  color: #8a6300;
}
.o-necunoscut {
  background: #dfe6ec;
  color: #44535f;
}
.o-rezolvat {
  background: #cdeccd;
  color: #1f6b1f;
}
.st-de_sunat {
  background: #fbd0d0;
  color: #a01616;
}
.st-sunat {
  background: #cfe3fb;
  color: #14528f;
}
.st-rezolvat {
  background: #cdeccd;
  color: #1f6b1f;
}
.age-ok {
  color: #1f6b1f;
}
.age-warn {
  color: #8a6300;
}
.age-late {
  color: #a01616;
  font-weight: 600;
}
.call.left-de_sunat {
  border-left-color: var(--brand-orange);
}
.call.left-sunat {
  border-left-color: var(--brand-blue);
}
.call.left-rezolvat {
  border-left-color: #4caf50;
}
/* Transferati tab: hide status workflow column (4 columns instead of 5) and
   use a neutral border-left color, since these calls already left our queue. */
.call.is-transfer {
  grid-template-columns: 150px 110px 1fr 200px;
}
.call.left-transfer {
  border-left-color: #4caf50;
}

/* --- overlay / detail --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 40, 0.55);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 16px;
  overflow-y: auto;
}
.overlay.hidden {
  display: none;
}
.panel {
  background: #fff;
  border-radius: 8px;
  max-width: 820px;
  width: 100%;
  padding: 22px 26px;
  position: relative;
}
.close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  color: #5a6b7a;
  font-size: 26px;
  padding: 0 8px;
}
.detail-head h2 {
  margin: 0 0 4px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
  margin: 12px 0;
  font-size: 14px;
}
.detail-grid .k {
  color: #5a6b7a;
}
.box {
  background: #f4f6f8;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 12px 0;
}
.box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #44535f;
}
.wf-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}
.wf-row textarea,
.box textarea {
  width: 100%;
  min-height: 54px;
  padding: 8px;
  border: 1px solid #c5cfd8;
  border-radius: 5px;
  font-family: inherit;
  font-size: 14px;
}
.wf-row input[type='text'] {
  padding: 7px 10px;
  border: 1px solid #c5cfd8;
  border-radius: 5px;
}
#btn-save {
  background: #1f8b3f;
}
audio {
  width: 100%;
  margin-top: 6px;
}

/* --- transcript --- */
.transcript {
  margin-top: 6px;
}
.turn {
  margin: 7px 0;
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 88%;
  font-size: 14px;
}
.turn.agent {
  background: #e8f3fb;
  margin-right: auto;
}
.turn.user {
  background: #eef0f2;
  margin-left: auto;
}
.turn .who {
  font-size: 11px;
  color: #5a6b7a;
  margin-bottom: 2px;
}
.turn.tool {
  background: #fff7e0;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  max-width: 100%;
  color: #6b5300;
}
.empty {
  color: #5a6b7a;
  padding: 30px;
  text-align: center;
}

/* --- auth pages (login, register, forgot, reset) --- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--brand-navy) 0%,
    var(--brand-navy-dark) 60%,
    #2a1500 100%
  );
  padding: 20px;
}
.auth-card {
  background: var(--brand-white);
  border-radius: 12px;
  padding: 32px 36px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border-top: 5px solid var(--brand-orange);
}
.auth-logo {
  display: block;
  margin: 0 auto 18px;
  height: 64px;
  width: auto;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 700;
  color: var(--brand-navy);
  text-align: center;
}
.auth-card .auth-sub {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.auth-card label {
  display: block;
  font-size: 13px;
  color: #44535f;
  margin: 14px 0 4px;
  font-weight: 600;
}
.auth-card input[type='text'],
.auth-card input[type='email'],
.auth-card input[type='password'] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c5cfd8;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}
.auth-card .auth-btn {
  width: 100%;
  background: var(--brand-orange);
  color: var(--brand-white);
  font-size: 15px;
  font-weight: 600;
  padding: 11px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  margin-top: 22px;
  transition: background 0.15s ease;
}
.auth-card .auth-btn:hover {
  background: var(--brand-orange-dark);
}
.auth-card .auth-btn:disabled {
  background: #f7c08a;
  cursor: not-allowed;
}
.auth-card .auth-msg {
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 13px;
  display: none;
}
.auth-card .auth-msg.error {
  display: block;
  background: #fbd0d0;
  color: #a01616;
}
.auth-card .auth-msg.success {
  display: block;
  background: #cdeccd;
  color: #1f6b1f;
}
.auth-card .auth-links {
  margin-top: 18px;
  font-size: 13px;
  text-align: center;
  color: #5a6b7a;
}
.auth-card .auth-links a {
  color: var(--brand-orange);
  font-weight: 500;
  text-decoration: none;
}
.auth-card .auth-links a:hover {
  text-decoration: underline;
}

/* --- user badge in header (logged-in view) --- */
.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 13px;
}
.user-badge .who {
  text-align: right;
  line-height: 1.25;
}
.user-badge .who .name {
  font-weight: 600;
}
.user-badge .who .role {
  font-size: 11px;
  opacity: 0.85;
}
.user-badge a.admin-link {
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  padding: 5px 10px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
}
.user-badge a.admin-link:hover {
  background: rgba(0, 0, 0, 0.28);
}
.user-badge button.logout {
  background: rgba(0, 0, 0, 0.18);
  padding: 5px 10px;
  font-size: 12px;
}

/* --- admin tables --- */
.admin-section {
  background: #fff;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.admin-section h2 {
  margin: 0 0 14px;
  font-size: 17px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eef0f2;
}
.admin-table th {
  color: #5a6b7a;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}
.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table button {
  padding: 5px 10px;
  font-size: 12px;
}
.admin-table .role-admin {
  color: var(--brand-orange-dark);
  font-weight: 600;
}
.admin-table .inactive {
  opacity: 0.55;
}
.invite-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.invite-form input[type='email'] {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid #c5cfd8;
  border-radius: 5px;
}
.invite-form select {
  padding: 7px 10px;
}
.invite-form button {
  background: var(--brand-orange);
}
.invite-form button:hover {
  background: var(--brand-orange-dark);
}
