:root {
  --bg-deep: #071015;
  --bg-card: rgba(16, 29, 36, 0.82);
  --bg-card-hover: rgba(22, 41, 51, 0.92);
  --border-soft: rgba(148, 163, 184, 0.14);
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.22);
  --gold: #eab308;
  --gold-soft: rgba(234, 179, 8, 0.16);
  --rose: #f43f5e;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at top right, #0f292e 0%, var(--bg-deep) 55%);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 92px;
  line-height: 1.5;
}

.app-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 16px 24px;
}

/* Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--emerald), #0f766e);
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: 0 8px 24px var(--emerald-glow);
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border-soft);
}

.status-pill.online {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.status-pill.online .dot {
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(14px);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #fde047;
  font-weight: 600;
}

/* Form & Inputs */
textarea, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  background: rgba(9, 18, 23, 0.85);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--emerald);
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.field {
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  box-shadow: 0 6px 18px var(--emerald-glow);
}

.btn-danger {
  background: linear-gradient(135deg, var(--rose), #be123c);
  color: #fff;
}

.btn-ghost {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn-full {
  width: 100%;
}

/* Preset Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.chip {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.26);
  color: #a7f3d0;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  cursor: pointer;
}

.chip:hover {
  background: rgba(16, 185, 129, 0.22);
}

/* Mode Grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mode-btn {
  background: rgba(9, 18, 23, 0.72);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 13px 12px;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--emerald);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35);
}

.mode-btn .emoji {
  font-size: 1.35rem;
  display: block;
  margin-bottom: 5px;
}

.mode-btn .name {
  font-size: 0.86rem;
  font-weight: 700;
  display: block;
}

.mode-btn .desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Intercom Waveform */
.wave-box {
  background: #050b0e;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  position: relative;
}

#waveformCanvas {
  width: 100%;
  height: 92px;
  display: block;
}

.wave-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.ptt-circle {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  margin-top: 10px;
  user-select: none;
}

.ptt-circle.talking {
  background: linear-gradient(135deg, var(--rose), #e11d48);
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.45);
}

/* Progress Bar (3 GB Split) */
.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  transition: width 0.4s ease;
}

/* Recording List */
.rec-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(9, 18, 23, 0.75);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  margin-bottom: 10px;
}

.rec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.rec-name {
  font-size: 0.84rem;
  font-weight: 700;
  word-break: break-all;
}

.rec-meta {
  font-size: 0.73rem;
  color: var(--text-muted);
}

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

.rec-actions .btn {
  padding: 7px 11px;
  font-size: 0.76rem;
}

/* Toggle Row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.toggle-row:last-child {
  border-bottom: none;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #334155;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.25s;
}

.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
}

.switch input:checked + .slider {
  background: var(--emerald);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* Tab Sections */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(7, 16, 21, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-around;
  padding: 8px 6px 12px;
  z-index: 50;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 10px;
}

.nav-item .nav-ico {
  font-size: 1.2rem;
}

.nav-item.active {
  color: var(--emerald);
}

/* Toast Notification */
#toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #0f292e;
  border: 1px solid var(--emerald);
  color: #ecfdf5;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease;
  z-index: 100;
  max-width: 92vw;
  text-align: center;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.muted-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 6px;
}
