/* Life Insurance Team Portal styles
   - Default theme: light
   - Dark theme via: html[data-theme="dark"]
*/

:root{
  --bg: #f7f9fc;
  --panel: rgba(255,255,255,.92);
  --panel2: rgba(248,250,252,.96);
  --text: #0f172a;
  --muted: #475569;

  --brand: #2563eb;
  --brand2: #10b981;
  --danger: #e11d48;
  --warn: #f59e0b;

  --border: rgba(15,23,42,.12);
  --shadow: 0 14px 30px rgba(0,0,0,.10);

  --input-bg: rgba(255,255,255,.96);
  --table-head-bg: rgba(15,23,42,.06);
  --chip-bg: rgba(15,23,42,.06);

  --gradient:
    radial-gradient(1200px 600px at 10% -10%, rgba(37,99,235,.18), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(16,185,129,.14), transparent 55%),
    var(--bg);
}

html[data-theme="dark"]{
  --bg: #0b1220;
  --panel: rgba(15,23,42,.82);
  --panel2: rgba(2,6,23,.55);
  --text: #e7eefc;
  --muted: #a9b7d0;

  --brand: #60a5fa;
  --brand2: #34d399;

  --border: rgba(255,255,255,.10);
  --shadow: 0 18px 40px rgba(0,0,0,.45);

  --input-bg: rgba(10,16,28,.55);
  --table-head-bg: rgba(2,6,23,.75);
  --chip-bg: rgba(255,255,255,.06);

  --gradient:
    radial-gradient(1200px 600px at 10% -10%, rgba(96,165,250,.25), transparent 55%),
    radial-gradient(900px 500px at 110% 10%, rgba(52,211,153,.18), transparent 55%),
    var(--bg);
}

*{ box-sizing:border-box; }

html,body{
  margin:0;
  padding:0;
}

body{
  min-height:100vh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--gradient);
  color: var(--text);
}

a{ color: inherit; text-decoration:none; }

.container{
  max-width: 1120px;
  margin: 22px auto;
  padding: 0 16px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
}

.brand img{
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--panel2);
}

.title{
  display:flex;
  flex-direction:column;
  line-height:1.1;
}
.title strong{ font-size: 16px; }
.title span{ font-size: 12px; color: var(--muted); margin-top:2px; }

.navright{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content:flex-end;
}

.userchip{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 13px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 12px;
}

.panel{
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.pad{ padding: 16px; }

h1,h2,h3{ margin: 0 0 8px 0; }
h1{ font-size: 22px; }
h2{ font-size: 18px; }
h3{ font-size: 15px; }

small{ color: var(--muted); }

hr{
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.split{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.row{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
}
.row > *{ flex: 1; min-width: 160px; }

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
/*
  IMPORTANT:
  In CSS Grid, children default to min-width:auto (min-content).
  When a child contains a wide table or long text, it can force the
  grid tracks to expand and visually "break" padding/alignment.
  Setting min-width:0 allows children to shrink and keeps panels
  aligned inside their parent container.
*/
.grid2 > *{ min-width: 0; }

/* Small tables (analytics) should be able to shrink inside cards */
table.fit{ min-width: 0; }
@media (max-width: 860px){
  .grid2{ grid-template-columns: 1fr; }
}

.kpi{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel2);
  padding: 12px 14px;
  min-width: 150px;
}
.kpi .num{ font-weight: 900; font-size: 22px; }
.kpi .lbl{ color: var(--muted); font-size: 12px; margin-top: 2px; }

.kpi.clickable{ cursor: pointer; }
.kpi.clickable:hover{ filter: brightness(1.03); }

label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, textarea{
  width: 100%;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}

textarea{ min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus{
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}

.checkbox{
  display:flex;
  align-items:center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--panel2);
}
.checkbox input{ width:auto; }

.btn{
  appearance:none;
  border: 1px solid rgba(37,99,235,.22);
  background: linear-gradient(180deg, rgba(37,99,235,1), rgba(37,99,235,.90));
  color: #fff;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 12px;
  cursor:pointer;
}
.btn:hover{ filter: brightness(1.03); }
.btn:disabled{ opacity: .55; cursor:not-allowed; }

.btn.secondary{
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-weight: 800;
}
.btn.danger{
  border: 1px solid rgba(225,29,72,.25);
  background: linear-gradient(180deg, rgba(225,29,72,1), rgba(225,29,72,.88));
}
.btn.small{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.actions{ display:flex; gap: 10px; flex-wrap: wrap; }

.tabs{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tab{
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor:pointer;
  font-weight: 800;
  font-size: 12px;
}
.tab.active{
  background: rgba(37,99,235,.12);
  border-color: rgba(37,99,235,.35);
}

.tablewrap{ overflow:auto; border-radius: 14px; border: 1px solid var(--border); }
table{
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
th, td{
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th{
  text-align:left;
  font-size: 12px;
  color: var(--muted);
  background: var(--table-head-bg);
}
td small{
  display:block;
  margin-top: 3px;
  color: var(--muted);
}

.pill{
  display:inline-flex;
  align-items:center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.pill.ok{ border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.12); color: var(--text); }
.pill.bad{ border-color: rgba(225,29,72,.35); background: rgba(225,29,72,.12); color: var(--text); }
.pill.warn{ border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.12); color: var(--text); }

.footer{
  text-align:center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 16px;
  padding: 14px 0 6px;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display:none;
  background: rgba(0,0,0,.55);
  padding: 22px 16px;
  overflow:auto;
  z-index: 50;
}
.modal.show{ display:block; }
.modal .box{
  max-width: 980px;
  margin: 0 auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}
.modal .box .panel{ background: var(--panel2); box-shadow: none; }

/* Toast */
.toast{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  z-index: 60;
}
.toast .item{
  width: 300px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px 12px;
}
.toast .item .meta{
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* Utility */
.hidden{ display:none !important; }

/* =========================
   FullCalendar visual cues
   - New (scheduled) appointments: customer name bold
   - Worked appointments (completed/canceled): not bold
   - Rescheduled originals: bold + red (text + light red background)
   ========================= */

.fc .lit-evt{
  /* If a view uses custom event content, keep it clipped inside the cell */
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  line-height:1.2;
}
.fc .lit-evt-time{
  font-size: 11px;
  opacity: .92;
  margin-right: 6px;
}
.fc .lit-evt-name{
  font-weight: 500;
}
.fc .lit-evt-name.lit-bold{
  font-weight: 800;
}
.fc .lit-evt-name.lit-red{
  color: #b91c1c;
}
.fc .lit-evt-assigned{
  font-size: 11px;
  opacity: .88;
}

/* Rescheduled original appointment styling */
.fc-event.lit-fc-rescheduled,
.fc-daygrid-event.lit-fc-rescheduled,
.fc-timegrid-event.lit-fc-rescheduled{
  background-color: rgba(239, 68, 68, 0.18) !important; /* light red */
  border-color: rgba(239, 68, 68, 0.70) !important;
  color: #b91c1c !important;
}
.fc-event.lit-fc-rescheduled .fc-event-title,
.fc-event.lit-fc-rescheduled .fc-event-time{
  color: #b91c1c !important;
}
