* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f4f8; min-height: 100vh; color: #1a202c;
}

/* LOGIN SCREEN */
#login-screen .card { padding: 44px 36px; border-radius: 20px; }
.login-header { text-align: center; margin-bottom: 28px; }
.logo-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.logo-icon { width: 38px; height: 38px; background: linear-gradient(135deg, #2b6cb0, #2c5282); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 16px; }
.logo { font-size: 22px; font-weight: 800; color: #2b6cb0; letter-spacing: -0.5px; }
.subtitle { color: #718096; font-size: 14px; }

/* TOP BAR */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; min-height: 56px; background: white;
  border-bottom: 1px solid #e8edf3; position: sticky; top: 0; z-index: 100;
}
.top-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-brand { display: flex; align-items: center; gap: 8px; }
.top-brand .logo-icon-small { width: 28px; height: 28px; background: linear-gradient(135deg, #2b6cb0, #2c5282); border-radius: 7px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 12px; }
.top-brand strong { font-size: 15px; color: #1a202c; letter-spacing: -0.3px; }
.top-divider { width: 1px; height: 20px; background: #e2e8f0; }
.doctor-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doctor-name { font-size: 13px; color: #4a5568; cursor: pointer; white-space: nowrap; }
.doctor-name:hover { color: #2b6cb0; }
.doctor-tags { display: flex; align-items: center; gap: 6px; }
.crm-badge { background: #e2e8f0; color: #4a5568; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; font-family: monospace; }
.specialty-badge { background: #ebf4ff; color: #2b6cb0; padding: 3px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.top-right { display: flex; gap: 8px; }

/* DASHBOARD LAYOUT */
.dash-layout { display: flex; gap: 24px; padding: 24px 28px; flex: 1; min-height: calc(100vh - 100px); }
.dash-sidebar { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.dash-main { flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* FILTERS */
.filter-box { background: white; border-radius: 16px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); border: 1px solid #edf2f7; }
.filter-box h3 { font-size: 12px; color: #4a5568; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 14px; }
.filter-box input {
  width: 100%; padding: 9px 12px; margin-bottom: 8px;
  border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px;
  background: #fafcff; transition: border 0.15s;
}
.filter-box input:focus { border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,0.08); outline: none; }
.filter-label { font-size: 11px; color: #a0aec0; margin-bottom: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* HISTORY */
.history-box { background: white; border-radius: 16px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); border: 1px solid #edf2f7; flex: 1; overflow-y: auto; max-height: calc(100vh - 200px); overscroll-behavior: contain; }
.history-box h3 { font-size: 12px; color: #4a5568; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.count-badge { font-size: 11px; color: #a0aec0; font-weight: 500; }
.edited-badge { font-size: 10px; background: #fefcbf; color: #975a16; padding: 1px 8px; border-radius: 10px; font-weight: 600; margin-left: 6px; white-space: nowrap; }
.history-item {
  padding: 12px 14px; border-radius: 10px; cursor: pointer; margin-bottom: 6px;
  border: 1px solid transparent; transition: all 0.15s;
}
.history-item:hover { background: #f7fafc; border-color: #e2e8f0; }
.history-item:active { background: #edf2f7; }
.hi-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 6px; flex-wrap: wrap; }
.hi-header strong { font-size: 13px; color: #2d3748; }
.hi-date { font-size: 11px; color: #a0aec0; }
.hi-preview { font-size: 12px; color: #718096; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { font-size: 13px; color: #a0aec0; text-align: center; padding: 30px 20px; }

/* RECORDING CARD */
.recording-card { text-align: center; padding: 28px 24px; border-radius: 16px; border: 1px solid #edf2f7; }
#recording-status { font-size: 13px; color: #718096; margin-bottom: 16px; font-weight: 500; }
.record-btn-wrap { position: relative; display: inline-block; margin-bottom: 8px; }
.record-ring { position: absolute; top: -8px; left: -8px; right: -8px; bottom: -8px; border-radius: 50%; border: 2px solid #48bb78; opacity: 0.3; }
.recording .record-ring { border-color: #e53e3e; animation: ring-pulse 1.5s infinite; }
@keyframes ring-pulse { 0% { transform: scale(1); opacity: 0.3; } 100% { transform: scale(1.15); opacity: 0; } }
#record-btn {
  width: 170px; height: 170px; border-radius: 50%; font-size: 15px; font-weight: 600;
  background: linear-gradient(135deg, #48bb78, #38a169); margin: 0; display: flex;
  align-items: center; justify-content: center; border: none; color: white;
  cursor: pointer; transition: all 0.2s; position: relative; letter-spacing: 0.3px;
}
#record-btn:hover { transform: scale(1.02); box-shadow: 0 8px 20px rgba(72,187,120,0.3); }
#record-btn.recording {
  background: linear-gradient(135deg, #e53e3e, #c53030);
  animation: btn-pulse 1.5s infinite;
}
#record-btn.recording:hover { box-shadow: 0 8px 20px rgba(229,62,62,0.3); }
#record-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
@keyframes btn-pulse { 0% { box-shadow: 0 0 0 0 rgba(229,62,62,0.4); } 100% { box-shadow: 0 0 0 18px rgba(229,62,62,0); } }

#pause-btn {
  padding: 8px 28px; margin: 12px auto 0; background: #ed8936;
  font-size: 13px; font-weight: 600; border: none; color: white;
  border-radius: 8px; cursor: pointer; display: none;
  letter-spacing: 0.3px;
}
#pause-btn:hover { background: #dd6b20; }

#timer { font-size: 30px; font-weight: 700; color: #2d3748; margin: 12px 0 18px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }

.patient-fields { display: flex; gap: 10px; margin-top: 4px; }
.patient-fields input {
  flex: 1; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; background: #fafcff; transition: border 0.15s;
}
.patient-fields input:focus { border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,0.08); outline: none; }

/* RESULT CARD */
.result-card { padding: 20px; border-radius: 16px; border: 1px solid #edf2f7; }
.result-tabs { display: flex; gap: 4px; margin-bottom: 14px; background: #f7fafc; padding: 3px; border-radius: 8px; }
.tab {
  flex: 1; padding: 7px 16px; font-size: 12px; font-weight: 600;
  border: none; background: transparent; border-radius: 6px;
  cursor: pointer; color: #718096; transition: all 0.15s;
}
.tab.active { background: white; color: #2b6cb0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.result-card textarea {
  width: 100%; min-height: 160px; padding: 14px; font-size: 13px; line-height: 1.7;
  border: 1px solid #e2e8f0; border-radius: 10px; resize: vertical;
  font-family: inherit; background: #fafcff; transition: border 0.15s;
}
.result-card textarea:focus { outline: none; border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,0.08); }
.result-actions { display: flex; gap: 8px; margin-top: 14px; }

/* BUTTONS */
.card button:not(.tab):not(.btn-small) {
  width: 100%; padding: 12px; background: #2b6cb0; color: white;
  border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.card button:not(.tab):not(.btn-small):hover { background: #2c5282; }

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; letter-spacing: 0.2px;
}
.btn-primary { background: #2b6cb0; color: white; }
.btn-primary:hover { background: #2c5282; box-shadow: 0 4px 12px rgba(43,108,176,0.25); }
.btn-secondary { background: #edf2f7; color: #4a5568; }
.btn-secondary:hover { background: #e2e8f0; }

#download-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; letter-spacing: 0.2px; background: #48bb78; color: white; }
#download-btn:hover { background: #38a169; box-shadow: 0 4px 12px rgba(72,187,120,0.25); }
#update-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; letter-spacing: 0.2px; background: #edf2f7; color: #4a5568; }
#update-btn:hover { background: #e2e8f0; }

.btn-small {
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  background: #edf2f7; color: #4a5568; border-radius: 7px;
  border: none; cursor: pointer; transition: all 0.15s;
}
.btn-small:hover { background: #e2e8f0; }
.btn-small-outline { background: transparent; border: 1px solid #e2e8f0; }
.btn-small-outline:hover { background: #f7fafc; border-color: #cbd5e0; }
.config-actions { display: flex; gap: 8px; margin-top: 10px; }
.config-actions button { flex: 1; }
/* COMMON */
.card { background: white; border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-wrapper { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.login-wrapper .footer { position: static; border: none; background: transparent; padding: 0; }

.card input, .config-card input {
  width: 100%; padding: 11px 14px; margin-bottom: 10px;
  border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px;
  background: #fafcff; transition: border 0.15s;
}
.card input:focus { border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,0.08); outline: none; }

.toggle { color: #2b6cb0; font-size: 13px; text-align: center; margin-top: 14px; cursor: pointer; font-weight: 500; }
.toggle:hover { color: #2c5282; }
.error { color: #e53e3e; font-size: 13px; margin-top: 8px; text-align: center; }

/* FOOTER */
.footer {
  text-align: center; padding: 14px 28px; font-size: 12px; color: #a0aec0;
  border-top: 1px solid #edf2f7; background: white;
}
.footer strong { color: #718096; font-weight: 600; }

#main-screen { flex-direction: column; padding: 0; align-items: stretch; justify-content: flex-start; }

/* ATD & VERSION BADGES */
.atd-badge { font-size: 10px; background: #ebf4ff; color: #2b6cb0; padding: 1px 8px; border-radius: 10px; font-weight: 700; font-family: monospace; letter-spacing: 0.3px; margin-right: 6px; }
.version-badge { font-size: 10px; color: #a0aec0; font-weight: 500; }
.hi-footer { margin-top: 4px; }
.hi-footer .edited-badge { font-size: 10px; background: #fefcbf; color: #975a16; padding: 1px 8px; border-radius: 10px; font-weight: 600; }

/* SIDEBAR HEADER (mobile close) */
.sidebar-header { display: none; }
.btn-back-mobile {
  display: none; padding: 8px 20px; font-size: 13px; font-weight: 600;
  background: #2b6cb0; color: white; border: none; border-radius: 8px;
  cursor: pointer; letter-spacing: 0.3px; width: 100%; max-width: 260px;
}
.btn-back-mobile:hover { background: #2c5282; }
.btn-hist-mobile { display: none; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .dash-layout { flex-direction: column; padding: 14px; gap: 14px; min-height: calc(100vh - 56px); }
  .dash-main { min-height: auto; }
  .dash-sidebar {
    width: 100%; display: none;
    position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
    z-index: 200; background: #f0f4f8; padding: 16px;
    overflow-y: auto;
  }
  .dash-sidebar.open { display: flex; flex-direction: column; }
  .top-bar { padding: 0 16px; }
  .top-left { flex-wrap: wrap; gap: 6px; }
  .doctor-info { flex-direction: column; align-items: flex-start; gap: 2px; }
  .doctor-name { font-size: 12px; }
  #record-btn { width: 140px; height: 140px; font-size: 14px; }
  .history-box { max-height: none; }
  .btn-hist-mobile { display: inline-flex !important; font-size: 16px; padding: 4px 10px; }
  .btn-back-mobile { display: block; margin: 0 auto 12px; }
}
