* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }

body { background: #f0f2f5; display: flex; flex-direction: column; align-items: center; padding: 16px; }

/* Status bar */
#status-bar {
  width: 360px; background: #1a1a2e; color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 8px 8px 0 0; font-size: 13px;
}
#status-label { font-weight: bold; }
#status-label.connected    { color: #4caf50; }
#status-label.disconnected { color: #f44336; }
#status-label.calling      { color: #ff9800; }
#agent-status { background: transparent; color: #fff; border: 1px solid #fff4; border-radius: 4px; padding: 2px 6px; font-size: 12px; cursor: pointer; }
#extension-label { font-size: 11px; color: #aaa; }

/* Incoming */
#incoming-panel {
  width: 360px; background: #e8f5e9; border: 2px solid #4caf50;
  padding: 12px; display: flex; justify-content: space-between; align-items: center;
  animation: pulse 1s infinite;
}
#incoming-info { display: flex; flex-direction: column; }
#incoming-number { font-size: 18px; font-weight: bold; }
#incoming-actions { display: flex; gap: 8px; }
.btn-answer { background: #4caf50; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; }
.btn-reject { background: #f44336; color: #fff; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }

/* Softphone */
#softphone {
  width: 360px; background: #fff; border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12); overflow: hidden;
}

/* Tabs */
#tabs { display: flex; border-bottom: 2px solid #eee; }
.tab { flex: 1; padding: 10px; background: none; border: none; cursor: pointer; font-size: 14px; color: #666; transition: all .2s; }
.tab.active { color: #3f51b5; border-bottom: 2px solid #3f51b5; margin-bottom: -2px; font-weight: bold; }
.tab-content { padding: 16px; }

/* Fields */
#fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
#number-input, #callerid-input {
  width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 18px; outline: none; transition: border .2s;
}
#number-input:focus, #callerid-input:focus { border-color: #3f51b5; }

/* Keypad */
#keypad {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px;
}
#keypad button {
  padding: 14px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fafafa;
  font-size: 18px; cursor: pointer; transition: background .15s;
}
#keypad button:hover { background: #e8eaf6; }
#keypad button sub { font-size: 9px; display: block; color: #999; }

/* Call actions */
#call-actions { display: flex; gap: 8px; }
#btn-call {
  flex: 1; padding: 14px; background: #4caf50; color: #fff; border: none;
  border-radius: 8px; font-size: 16px; cursor: pointer; transition: background .2s;
}
#btn-call:hover { background: #388e3c; }
#btn-call:disabled { background: #aaa; cursor: not-allowed; }
#btn-backspace { padding: 14px 18px; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; font-size: 16px; cursor: pointer; }

/* Active call panel */
#active-call-panel { margin-top: 16px; border-top: 1px solid #eee; padding-top: 16px; }
#call-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#call-number-display { font-size: 20px; font-weight: bold; color: #1a1a2e; }
#timer { font-size: 20px; font-weight: bold; color: #3f51b5; font-variant-numeric: tabular-nums; }

/* DTMF keypad (small) */
#dtmf-keypad { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin-bottom: 8px; }
#dtmf-keypad button { padding: 8px; border: 1px solid #ddd; border-radius: 6px; background: #f5f5f5; font-size: 14px; cursor: pointer; }

/* Call controls */
#call-controls { display: flex; gap: 8px; margin-bottom: 12px; }
#call-controls button { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; cursor: pointer; font-size: 13px; }
#btn-hangup { background: #f44336 !important; color: #fff !important; border-color: #f44336 !important; }
#btn-hangup:hover { background: #c62828 !important; }
#btn-mute.active { background: #ff9800; color: #fff; border-color: #ff9800; }

/* Notes */
#call-notes { width: 100%; height: 72px; border: 1px solid #ddd; border-radius: 8px; padding: 8px; font-size: 13px; resize: none; outline: none; }
#call-notes:focus { border-color: #3f51b5; }

/* Post-call panel */
#post-call-panel { margin-top: 16px; text-align: center; padding: 16px; background: #f3f4f6; border-radius: 8px; }
#post-call-panel p { margin-bottom: 12px; color: #333; }
#btn-download-audio { background: #3f51b5; color: #fff; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; margin-right: 8px; }
#post-call-panel button:last-child { background: #eee; border: none; padding: 10px 16px; border-radius: 6px; cursor: pointer; }

/* History & Contacts */
#history-search, #contact-search { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 12px; font-size: 14px; outline: none; }
.history-item, .contact-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer;
}
.history-item:hover, .contact-item:hover { background: #f8f9fa; border-radius: 6px; padding: 10px 6px; }
.call-type { font-size: 11px; padding: 2px 6px; border-radius: 10px; }
.call-type.saliente  { background: #e3f2fd; color: #1565c0; }
.call-type.entrante  { background: #e8f5e9; color: #2e7d32; }
.call-type.perdida   { background: #ffebee; color: #c62828; }
.call-type.interna   { background: #f3e5f5; color: #6a1b9a; }
.redial-btn { font-size: 18px; color: #4caf50; background: none; border: none; cursor: pointer; }

.hidden { display: none !important; }
