* { box-sizing: border-box; }
[hidden] { display: none !important; } /* our display:flex rules must not defeat the hidden attribute */
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f2f4f7; color: #1a2433;
}
.muted { color: #68758a; font-size: .9rem; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: #fff; padding: 2rem 2.5rem; border-radius: 12px; width: 340px;
  box-shadow: 0 8px 30px rgba(16, 34, 60, .12);
}
.login-card h1 { margin: 0 0 .25rem; font-size: 1.3rem; }
.login-card label { display: block; margin: .9rem 0; font-size: .85rem; font-weight: 600; }
.login-card input {
  width: 100%; margin-top: .3rem; padding: .6rem .7rem; font-size: 1rem;
  border: 1px solid #c8d1de; border-radius: 8px;
}
.error-banner {
  background: #fdecec; color: #b3261e; border: 1px solid #f5c6c3;
  padding: .55rem .8rem; border-radius: 8px; font-size: .85rem; margin-top: .8rem;
}
.warn-banner {
  background: #fff6e5; color: #8a5b00; border-bottom: 1px solid #f0d9a8;
  padding: .6rem 1.2rem; font-size: .9rem;
}

/* layout */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: #10223c; color: #fff; padding: .7rem 1.2rem;
}
.topbar .muted { color: #9fb0c8; margin-right: .8rem; }
.pill {
  font-size: .72rem; padding: .15rem .55rem; border-radius: 99px;
  margin-left: .6rem; vertical-align: middle; font-weight: 600;
}
.pill-on  { background: #123f24; color: #4ade80; }
.pill-off { background: #3f1212; color: #f87171; }
.layout {
  display: grid; grid-template-columns: 320px 1fr; gap: 1.2rem;
  padding: 1.2rem; max-width: 1050px; margin: 0 auto;
}
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } }
.card {
  background: #fff; border-radius: 12px; padding: 1.1rem 1.2rem;
  box-shadow: 0 2px 10px rgba(16, 34, 60, .07);
}
.card h2 { margin: 0 0 .8rem; font-size: 1rem; }

/* presence */
.presence-row { margin-bottom: .6rem; }
.switch-label { display: flex; align-items: center; gap: .5rem; font-weight: 600; cursor: pointer; }
.switch-label input { width: 1.15rem; height: 1.15rem; accent-color: #16803c; }
.cell-row { display: flex; gap: .5rem; }
.cell-row input {
  flex: 1; padding: .45rem .6rem; font-size: .9rem;
  border: 1px solid #c8d1de; border-radius: 8px;
}
.sep { border: none; border-top: 1px solid #edf1f6; margin: .9rem 0; }

/* dialer */
.dialer input {
  width: 100%; font-size: 1.25rem; padding: .55rem .7rem; text-align: center;
  border: 1px solid #c8d1de; border-radius: 8px;
}
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0;
}
.keypad button {
  font-size: 1.15rem; padding: .7rem 0; border: 1px solid #d7dee9;
  background: #f8fafc; border-radius: 8px; cursor: pointer;
}
.keypad button:active { background: #e2e8f0; }

/* buttons */
.btn {
  border: 1px solid #c8d1de; background: #fff; color: #1a2433;
  padding: .55rem 1rem; border-radius: 8px; font-size: .95rem; cursor: pointer;
  text-decoration: none;
}
.btn-block { flex: 1; }
.btn-primary { background: #10223c; border-color: #10223c; color: #fff; }
.btn-answer  { background: #16803c; border-color: #16803c; color: #fff; }
.btn-hangup  { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-ghost   { background: transparent; border-color: #4a5f80; color: #d6e0ef; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; }

/* incoming call */
.incoming-banner {
  position: sticky; top: 0; z-index: 10;
  background: #16803c; color: #fff; padding: .8rem 1.2rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 50% { background: #1da34d; } }

/* activity tabs + feed */
.activity-card { min-height: 420px; }
.tabbar {
  display: flex; gap: .1rem; border-bottom: 2px solid #edf1f6;
  margin: -.2rem 0 .7rem; overflow-x: auto;
}
.tab {
  border: none; background: none; font: inherit; font-size: .88rem;
  padding: .5rem .8rem; cursor: pointer; color: #68758a; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600;
}
.tab.on { color: #10223c; border-bottom-color: #10223c; }
.search-box {
  width: 100%; border: 1px solid #dde4ee; border-radius: 8px;
  padding: .45rem .7rem; font-size: .85rem; margin-bottom: .6rem;
}
.feed { display: flex; flex-direction: column; }
.feed-date {
  font-size: .72rem; font-weight: 700; color: #68758a; text-transform: uppercase;
  letter-spacing: .04em; padding: .6rem 0 .25rem; border-bottom: 1px solid #edf1f6;
}
.feed-row {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .3rem; border-bottom: 1px solid #f3f6fa; cursor: pointer;
  font-size: .88rem;
}
.feed-row:hover { background: #f6f9fc; }
.feed-row.missed { background: #fff7f6; }
.feed-row.missed .fr-num { color: #b3261e; }
.feed-row.open { background: #eef4fb; }
.fr-ico { width: 1.2rem; text-align: center; }
.fr-num { font-weight: 600; min-width: 8.5rem; }
.fr-meta { color: #68758a; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-when { color: #68758a; font-size: .8rem; white-space: nowrap; }
.fr-marks { white-space: nowrap; }
.btn-more { width: 100%; margin-top: .7rem; }

/* inline drawer */
.drawer {
  background: #f8fafc; border: 1px solid #e6ecf4; border-radius: 8px;
  padding: .7rem .8rem; margin: .3rem 0 .6rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.drawer textarea, .drawer input {
  border: 1px solid #c8d1de; border-radius: 8px; padding: .45rem .6rem;
  font: inherit; font-size: .85rem;
}
.drawer textarea { width: 100%; resize: vertical; }
.drawer .custom-tag { flex: 1; }
.drawer-players { display: flex; gap: .4rem; flex-wrap: wrap; }

/* right column stack */
.right-col { display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }

/* badges */
.badge {
  display: inline-block; min-width: 1.3rem; text-align: center;
  background: #b3261e; color: #fff; font-size: .72rem; font-weight: 700;
  padding: .12rem .4rem; border-radius: 99px; margin-left: .4rem; cursor: pointer;
  vertical-align: middle;
}
.btn-small { padding: .3rem .6rem; font-size: .8rem; }

/* voicemail list */
.vm-list { display: flex; flex-direction: column; gap: .5rem; }
.vm-item {
  border: 1px solid #edf1f6; border-radius: 8px; padding: .55rem .7rem;
  display: flex; flex-direction: column; gap: .35rem;
}
.vm-item.unhandled { border-left: 4px solid #b3261e; }
.vm-item .row { margin-top: 0; flex-wrap: wrap; }
.vm-transcript {
  font-size: .85rem; color: #43506b; background: #f8fafc;
  border-radius: 6px; padding: .5rem .6rem; margin: .2rem 0 0; white-space: pre-wrap;
}

/* call detail panel */
.call-detail {
  margin-top: .8rem; border-top: 2px solid #edf1f6; padding-top: .8rem;
  display: flex; flex-direction: column; gap: .55rem;
}
.detail-head { justify-content: space-between; flex-wrap: wrap; }
.call-detail textarea {
  width: 100%; border: 1px solid #c8d1de; border-radius: 8px;
  padding: .55rem .7rem; font: inherit; font-size: .9rem; resize: vertical;
}
.call-detail input {
  flex: 1; border: 1px solid #c8d1de; border-radius: 8px; padding: .4rem .6rem;
}
.tag-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  border: 1px solid #c8d1de; background: #f8fafc; border-radius: 99px;
  padding: .22rem .7rem; font-size: .8rem; cursor: pointer; user-select: none;
}
.chip.on { background: #10223c; border-color: #10223c; color: #fff; }
.transcript { font-size: .85rem; color: #43506b; white-space: pre-wrap; }

/* dashboard */
.ok-banner {
  background: #e8f6ec; color: #14532d; border: 1px solid #bfe3c8;
  padding: .55rem .8rem; border-radius: 8px; font-size: .85rem; margin-top: .8rem;
}
.dash-range { margin-bottom: .4rem; }
.rng.on { background: #10223c; border-color: #10223c; color: #fff; }
.dash-h {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: #68758a; margin: 1.1rem 0 .5rem; border-bottom: 1px solid #edf1f6;
  padding-bottom: .3rem;
}
.team-board { display: flex; flex-wrap: wrap; gap: .5rem; }
.team-card {
  border: 1px solid #e6ecf4; border-radius: 8px; padding: .45rem .7rem;
  display: flex; align-items: center; gap: .45rem; font-size: .85rem;
}
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.dot-online { background: #16803c; }
.dot-oncall { background: #b45309; }
.dot-offline { background: #9aa7b8; }
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem;
}
.kpi {
  border: 1px solid #e6ecf4; border-radius: 10px; padding: .6rem .75rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.kpi .v { font-size: 1.45rem; font-weight: 700; color: #10223c; line-height: 1.1; }
.kpi .l { font-size: .74rem; color: #68758a; }
.kpi .s { font-size: .72rem; color: #8794a8; }
.hour-chart {
  display: flex; align-items: flex-end; gap: 3px; height: 90px;
  padding: .3rem 0 1.1rem; position: relative;
}
.hbar {
  flex: 1; background: #35507a; border-radius: 4px 4px 0 0; min-height: 2px;
  position: relative;
}
.hbar.zero { background: #e8edf4; }
.hbar .hlabel {
  position: absolute; bottom: -1.05rem; left: 50%; transform: translateX(-50%);
  font-size: .62rem; color: #8794a8; white-space: nowrap;
}
.route-list { display: flex; flex-direction: column; gap: .35rem; }
.route-row { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.route-row .rname { min-width: 9rem; color: #43506b; }
.route-row .rbar { height: 10px; background: #35507a; border-radius: 4px; }
.route-row .rcount { color: #68758a; font-size: .8rem; }

/* SMS threads */
.thread-row {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .3rem;
  border-bottom: 1px solid #f3f6fa; cursor: pointer; font-size: .88rem;
}
.thread-row:hover { background: #f6f9fc; }
.thread-row .t-name { font-weight: 600; min-width: 9rem; }
.thread-row .t-preview {
  color: #68758a; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.sms-back { margin-bottom: .5rem; }
.bubbles { display: flex; flex-direction: column; gap: .4rem; padding: .3rem 0 .7rem; }
.bubble {
  max-width: 75%; padding: .45rem .7rem; border-radius: 12px; font-size: .88rem;
  white-space: pre-wrap; word-break: break-word;
}
.bubble.in  { background: #eef1f6; color: #1a2433; align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { background: #10223c; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble .bt { display: block; font-size: .68rem; opacity: .65; margin-top: .2rem; }
.sms-compose { display: flex; gap: .5rem; }
.sms-compose input {
  flex: 1; border: 1px solid #c8d1de; border-radius: 8px; padding: .55rem .7rem;
  font: inherit; font-size: .9rem;
}
.sms-error { color: #b3261e; font-size: .8rem; margin-top: .35rem; }

/* audio settings */
.audio-settings { margin-top: .8rem; font-size: .85rem; }
.audio-settings summary { cursor: pointer; color: #68758a; }
.audio-settings label { display: block; margin-top: .5rem; font-weight: 600; }
.audio-settings select {
  width: 100%; margin-top: .25rem; padding: .4rem; border: 1px solid #c8d1de;
  border-radius: 8px; background: #fff;
}
