*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Figtree', system-ui, sans-serif;
  background: #202020;
  color: #f2f2f2;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: #ff8200;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff8200;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #ff8200;
}

.topbar h1 {
  margin: 0;
  font-size: 1.8rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid transparent;
  background: #333;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-accent {
  background: #ff8200;
  color: #111;
  border-color: #ff8200;
}

.btn-secondary {
  border-color: #555;
}

.btn-whatsapp {
  background: #25d366;
  color: #111;
  border-color: #25d366;
}

.btn-call {
  background: #444;
  border-color: #666;
}

.btn-done {
  background: #2d5a27;
  border-color: #3d7a35;
}

.btn-note {
  background: #3a3a3a;
  border-color: #666;
}

.btn-block {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #2a2a2a;
  border: 2px solid #444;
  padding: 16px 18px;
}

.stat-label {
  display: block;
  font-size: 0.82rem;
  color: #aaa;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #ff8200;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
}

.status-msg {
  color: #888;
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  border: 2px solid #444;
  background: #2a2a2a;
}

.calls-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

.calls-table th,
.calls-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #3a3a3a;
  vertical-align: top;
}

.calls-table th {
  background: #252525;
  color: #ff8200;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calls-table tr:hover td {
  background: rgba(255, 130, 0, 0.04);
}

.empty {
  text-align: center;
  color: #888;
  padding: 32px !important;
}

.cell-empty {
  color: #666;
}

.name-cell-text {
  color: #fff;
}

.anliegen-cell {
  max-width: 280px;
}

.anliegen-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  color: #ddd;
}

.phone-cell {
  white-space: nowrap;
  font-size: 0.92rem;
}

.notes-meta-caller {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.notes-meta-item-wide {
  grid-column: 1 / -1;
}

.notes-subject-text {
  color: #eee;
  line-height: 1.45;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 2px solid #555;
}

.badge-open,
.badge-missed {
  border-color: #ff8200;
  color: #ff8200;
}

.badge-answered {
  border-color: #4caf50;
  color: #4caf50;
}

.badge-callback_done,
.badge-done {
  border-color: #888;
  color: #ccc;
}

.inquiry-badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  background: rgba(255, 130, 0, 0.15);
  border: 1px solid #ff8200;
  color: #ffb366;
}

.notes-preview {
  font-size: 0.85rem;
  color: #bbb;
  max-width: 220px;
  white-space: pre-wrap;
}

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

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  background: #2a2a2a;
  border: 2px solid #ff8200;
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-hint {
  color: #aaa;
  margin: 0 0 20px;
  font-size: 0.92rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field span {
  font-size: 0.85rem;
  color: #ccc;
}

.field input,
.modal-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #555;
  background: #202020;
  color: #fff;
}

.field input:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: #ff8200;
}

.form-error {
  color: #ff6b6b;
  min-height: 1.2em;
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: #2a2a2a;
  border: 2px solid #ff8200;
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #444;
}

.modal-foot {
  border-bottom: none;
  border-top: 1px solid #444;
  justify-content: flex-end;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
}

.note-call-info {
  margin: 0 0 12px;
  color: #ccc;
}

@media (max-width: 720px) {
  .topbar h1 {
    font-size: 1.4rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* EventPlanPro PHP-Dashboard */
.access-denied {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.access-card {
  width: min(420px, 100%);
  background: #2a2a2a;
  border: 2px solid #ff8200;
  padding: 28px;
  text-align: center;
}

.access-card h2 { margin: 0 0 12px; }

.user-label {
  color: #aaa;
  font-size: 0.9rem;
  margin-right: 8px;
}

.connection-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 20px;
  border: 2px solid #444;
  background: #2a2a2a;
}

.connection-bar.single-conn .conn-item { flex: 1; }

.conn-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.conn-dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  background: #666;
}

.conn-dot.state-online { background: #4caf50; }
.conn-dot.state-warn { background: #ff8200; }
.conn-dot.state-error { background: #e53935; }

.conn-text strong { display: block; font-size: 0.85rem; }
.conn-detail { color: #aaa; font-size: 0.85rem; }

.conn-refresh { align-self: center; margin-right: 8px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.notes-input {
  width: 100%;
  min-width: 160px;
  padding: 8px;
  border: 1px solid #555;
  background: #202020;
  color: #fff;
  resize: vertical;
}

.name-cell {
  min-width: 130px;
}

.name-edit-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 4px 6px;
  margin: -4px -6px;
  border: 2px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.name-edit-btn:hover {
  border-color: #555;
  background: rgba(255, 130, 0, 0.06);
}

.name-add-label {
  color: #ff8200;
  font-size: 0.88rem;
  font-weight: 600;
}

.name-edit-hint {
  font-size: 0.72rem;
  color: #777;
  opacity: 0;
}

.name-edit-btn:hover .name-edit-hint {
  opacity: 1;
}

.name-inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.name-inline-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 2px solid #ff8200;
  background: #202020;
  color: #fff;
  font: inherit;
}

.btn-inline {
  padding: 6px 10px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.caller-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.caller-phone-sub {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted, #888);
}

.notes-open-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-width: 140px;
  max-width: 240px;
  padding: 10px 12px;
  border: 2px solid #555;
  background: #252525;
  color: #f2f2f2;
  text-align: left;
  cursor: pointer;
}

.notes-open-btn:hover {
  border-color: #ff8200;
  background: rgba(255, 130, 0, 0.08);
}

.notes-preview-text {
  font-size: 0.88rem;
  color: #ddd;
  line-height: 1.35;
  word-break: break-word;
}

.notes-preview-empty {
  font-size: 0.88rem;
  color: #888;
  font-style: italic;
}

.notes-open-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ff8200;
}

.notes-modal-panel {
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
}

.notes-modal-body {
  overflow: auto;
  flex: 1;
}

.notes-call-meta {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #252525;
  border: 2px solid #444;
}

.notes-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}

.notes-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notes-meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
}

.notes-section-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #ff8200;
}

.notes-assist-block {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: rgba(255, 130, 0, 0.08);
  border: 2px solid rgba(255, 130, 0, 0.45);
}

.notes-assist-content {
  white-space: pre-wrap;
  line-height: 1.5;
  color: #eee;
  font-size: 0.92rem;
}

.notes-field-full textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  border: 2px solid #555;
  background: #202020;
  color: #fff;
  line-height: 1.5;
  resize: vertical;
}

.notes-field-full textarea:focus {
  outline: none;
  border-color: #ff8200;
}

.notes-modal-foot {
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.notes-modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notes-modal-buttons {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 720px) {
  .notes-meta-grid { grid-template-columns: 1fr; }
  .notes-modal-foot { flex-direction: column; align-items: stretch; }
  .notes-modal-buttons { margin-left: 0; justify-content: flex-end; }
}

.btn-call { background: #444; border-color: #666; }
.btn-done { background: #2d5a27; border-color: #3d7a35; }

.badge-missed { border-color: #ff8200; color: #ff8200; }
.badge-answered { border-color: #4caf50; color: #4caf50; }
.badge-callback_done { border-color: #888; color: #ccc; }

.modal[hidden] { display: none !important; }
body.settings-open { overflow: hidden; }
body.notes-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  background: #2a2a2a;
  border: 2px solid #ff8200;
}

.modal-body { padding: 20px; }

.form-section { margin-bottom: 24px; }
.form-section h3 { color: #ff8200; margin: 0 0 10px; }
.form-hint, .field-hint { color: #aaa; font-size: 0.88rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.preview-box { background: #202020; color: #ccc; }
.form-msg { min-height: 1.2em; }
.form-msg.error { color: #ff6b6b; }

.webhook-log {
  margin-top: 12px;
  border: 1px solid rgba(255, 130, 0, 0.35);
  overflow: hidden;
}

.webhook-log table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.webhook-log th, .webhook-log td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.webhook-log-empty { padding: 12px; color: #aaa; font-size: 0.9rem; }
.webhook-stats { margin: 10px 0; font-size: 0.9rem; color: #ccc; }

.webhook-feed {
  margin-bottom: 20px;
  border: 2px solid #444;
  background: #2a2a2a;
  padding: 0;
}

.webhook-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #444;
}

.webhook-feed-head h2 {
  margin: 0;
  font-size: 1rem;
  color: #ff8200;
}

.webhook-feed-hint {
  color: #aaa;
  font-size: 0.85rem;
}

.webhook-feed .webhook-log {
  margin: 0;
  border: none;
}

@media (max-width: 720px) {
  .field-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
