:root {
  --bg: #111215;
  --surface: #1a1c22;
  --surface-hover: #22252c;
  --border: #2c2f38;
  --text: #f0f2f5;
  --text-muted: #9ba1ad;
  --accent-red: #ea4335;
  --accent-red-hover: #d93025;
  --accent-red-glow: rgba(234, 67, 53, 0.4);
  --accent-green: #34a853;
  --accent-blue: #4285f4;
  --accent-yellow: #fbbc04;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 1.4rem;
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.user-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* Mitigation banner */
.wake-banner {
  background: rgba(251, 188, 4, 0.12);
  border: 1px solid var(--accent-yellow);
  color: #ffe082;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  display: none;
  align-items: center;
  gap: 10px;
}

/* Template selector */
.template-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.template-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.template-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ba1ad' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 14px) center;
}

/* Main Record Area */
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  text-align: center;
}

.timer-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
  color: var(--text);
}

.level-meter-container {
  width: 180px;
  height: 8px;
  background: #121316;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.level-meter-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green) 60%, var(--accent-yellow) 85%, var(--accent-red) 100%);
  transition: width 0.08s ease-out;
}

/* THE ONE BIG RECORD BUTTON */
.btn-big-record {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--accent-red);
  box-shadow: 0 8px 24px var(--accent-red-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-big-record:active {
  transform: scale(0.95);
}

.btn-big-record .btn-inner-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.2s ease;
}

.btn-big-record.recording {
  background: #b3261e;
  animation: pulse-ring 2s infinite;
}

.btn-big-record.recording .btn-inner-icon {
  border-radius: 8px;
  width: 36px;
  height: 36px;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.8); }
  70% { box-shadow: 0 0 0 24px rgba(234, 67, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0); }
}

.btn-status-label {
  margin-top: 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Secondary Actions (Import) */
.secondary-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.btn-import {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-import:hover {
  background: var(--surface);
  color: var(--text);
  border-color: #555;
}

/* Recordings List Section */
.recordings-section {
  flex: 1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.recording-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recording-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.recording-card:hover {
  background: var(--surface-hover);
  border-color: #3e4350;
}

.rec-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.rec-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  flex: 1;
  margin-right: 8px;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-queued { background: rgba(66, 133, 244, 0.15); color: #8ab4f8; }
.badge-transcribing, .badge-summarizing { background: rgba(251, 188, 4, 0.15); color: #fdd663; }
.badge-completed { background: rgba(52, 168, 83, 0.15); color: #81c995; }
.badge-failed { background: rgba(234, 67, 53, 0.15); color: #f28b82; }
.badge-uploading { background: rgba(154, 160, 166, 0.15); color: #dadce0; }

.rec-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

/* Modal for Detail View */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.modal-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  width: 100%;
  padding: 4px;
  border-radius: 6px;
}

.modal-title-input:focus {
  border-color: var(--border);
  background: #121316;
  outline: none;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
}

.detail-section {
  margin-bottom: 18px;
}

.detail-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e3e5ea;
  white-space: pre-line;
}

.action-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.action-table th, .action-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.action-table th {
  color: var(--text-muted);
}

.transcript-box {
  background: #121316;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.82rem;
  font-family: ui-monospace, Menlo, monospace;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #cfd3dc;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.btn-danger {
  background: rgba(234, 67, 53, 0.15);
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
