/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #1e40af;
  --primary-mid:    #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-light:  #eff6ff;
  --danger:         #dc2626;
  --danger-hover:   #b91c1c;
  --danger-light:   #fef2f2;
  --success:        #15803d;
  --success-light:  #f0fdf4;
  --warning:        #b45309;
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --border-focus:   #93c5fd;
  --text:           #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;
  --shadow-xs:      0 1px 2px rgba(15,23,42,.06);
  --shadow-sm:      0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.05);
  --shadow:         0 2px 6px rgba(15,23,42,.07), 0 1px 3px rgba(15,23,42,.05);
  --shadow-md:      0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.05);
  --shadow-lg:      0 12px 28px rgba(15,23,42,.10), 0 4px 8px rgba(15,23,42,.06);
  --radius:         6px;
  --radius-lg:      10px;
  --header-h:       56px;
  --transition:     0.15s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ===== LOGIN PAGE ===== */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 396px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login-logo svg { color: var(--primary-mid); }
.login-logo-text { font-size: 17px; font-weight: 700; color: var(--text); }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.login-card .form-group { margin-bottom: 14px; }

/* ===== HEADER ===== */
#header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  padding-right: 20px;
  border-right: 1px solid var(--border);
  margin-right: 16px;
  flex-shrink: 0;
}

.header-logo svg { color: var(--primary-mid); flex-shrink: 0; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.active { background: var(--primary-light); color: var(--primary-mid); font-weight: 600; }
.nav-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 16px;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lang-btn {
  padding: 4px 9px;
  border: none;
  background: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: .02em;
  transition: background var(--transition), color var(--transition);
}

.lang-btn.active { background: var(--primary-mid); color: #fff; }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.header-user-avatar {
  width: 30px; height: 30px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-mid);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.header-user-info { display: flex; flex-direction: column; }
.header-user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.header-user-role { font-size: 11px; color: var(--text-muted); }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-logout:hover {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-logout svg { width: 14px; height: 14px; }

/* ===== MAIN CONTENT ===== */
#main-content {
  margin-top: var(--header-h);
  padding: 28px 28px;
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  font-family: inherit;
  letter-spacing: -.01em;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary-mid);
  color: #fff;
  border-color: var(--primary-mid);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* Square icon buttons */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
}

.btn-icon svg { width: 14px; height: 14px; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm.btn-icon { width: 28px; height: 28px; padding: 0; }
.btn-sm.btn-icon svg { width: 13px; height: 13px; }

.btn-lg { padding: 10px 20px; font-size: 14px; font-weight: 600; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .01em;
  text-transform: uppercase;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--surface-2); color: var(--text-muted); }

select.form-control { cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text-muted); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error { font-size: 12px; color: var(--danger); margin-top: 2px; }

/* Toggle */
.toggle-group { display: flex; align-items: center; gap: 10px; }

.toggle { position: relative; width: 34px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-xs);
}

.toggle input:checked + .toggle-slider { background: var(--primary-mid); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle-label { font-size: 13px; color: var(--text-secondary); }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-body { padding: 20px; }

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
  text-transform: uppercase;
}

/* ===== FILTER TABS ===== */
.tiles-filter {
  display: flex;
  gap: 3px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  width: fit-content;
}

.filter-btn {
  padding: 5px 14px;
  border-radius: 4px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn.active { background: var(--primary-mid); color: #fff; font-weight: 600; }

/* Building filter */
.building-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  align-items: center;
}

.building-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 4px;
}

.building-btn {
  padding: 4px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.building-btn:hover { border-color: var(--primary-mid); color: var(--primary-mid); }
.building-btn.active { background: var(--primary-mid); border-color: var(--primary-mid); color: #fff; font-weight: 600; }

/* ===== USER TILES ===== */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.user-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.user-tile:hover {
  border-color: var(--primary-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.tile-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-location {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.tile-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-mid);
  line-height: 1;
}

.tile-unit { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.tile-date { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.tile-no-readings { font-size: 12px; color: var(--text-muted); }

/* ===== TABLE ===== */
.readings-table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius) 0 0; }

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-actions { display: flex; gap: 5px; justify-content: flex-end; }

/* ===== STATS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
}

.stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.stat-unit  { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-left: 2px; }

/* ===== CHART ===== */
.chart-wrap { position: relative; height: 210px; margin-bottom: 18px; }

/* ===== PERIOD TABS ===== */
.period-tabs { display: flex; gap: 3px; margin-bottom: 14px; }

.period-tab {
  padding: 4px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.period-tab.active {
  background: var(--primary-mid);
  border-color: var(--primary-mid);
  color: #fff;
  font-weight: 600;
}

/* ===== USER READINGS LAYOUT ===== */
.readings-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

/* ===== ROLES BADGES ===== */
.user-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-admin   { background: #ede9fe; color: #5b21b6; }
.badge-manager { background: #dcfce7; color: #15803d; }
.badge-user    { background: var(--primary-light); color: var(--primary-mid); }

.invite-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.invite-status.active  { background: #dcfce7; color: #15803d; }
.invite-status.pending { background: #fef9c3; color: #92400e; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible { opacity: 1; }

#confirm-overlay { z-index: 1100; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
}

.modal-overlay.visible .modal { transform: translateY(0) scale(1); }

.modal.modal-sm { max-width: 400px; }
.modal.modal-md { max-width: 500px; }
.modal.modal-lg { max-width: 700px; }
.modal.modal-xl { max-width: 880px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }

.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ===== CONFIRM MODAL ===== */
.confirm-icon {
  width: 44px; height: 44px;
  background: var(--danger-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  color: var(--danger);
}

.confirm-text { text-align: center; font-size: 14px; color: var(--text); line-height: 1.6; }

/* ===== INVITE LINK ===== */
.invite-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 6px;
}

.invite-url {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  font-family: monospace;
  margin-bottom: 8px;
  line-height: 1.6;
}

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

/* ===== SETTINGS ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-grid .span-2 { grid-column: 1 / -1; }

.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  max-width: 340px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s, transform 0.18s;
}

.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg { width: 44px; height: 44px; margin-bottom: 10px; opacity: 0.3; }
.empty-state-text { font-size: 13px; }

/* ===== MISC ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary-mid); }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

/* ===== DATE PICKER ===== */
.datepicker-wrap { position: relative; }

.datepicker-trigger {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  line-height: 1.5;
}

.datepicker-trigger:hover { border-color: var(--border-strong); }

.datepicker-trigger.open,
.datepicker-trigger:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}

.datepicker-trigger svg { flex-shrink: 0; color: var(--text-muted); }

.datepicker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  width: 268px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}

.datepicker-dropdown.visible { opacity: 1; transform: translateY(0); pointer-events: all; }

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

.dp-month-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.dp-nav-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.dp-nav-btn:hover { background: var(--bg); border-color: var(--primary-mid); color: var(--primary-mid); }

.dp-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }

.dp-weekday {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }

.dp-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
  line-height: 1;
}

.dp-day:hover:not(:disabled):not(.dp-selected) { background: var(--primary-light); color: var(--primary-mid); }

.dp-day.dp-today:not(.dp-selected) {
  color: var(--primary-mid);
  font-weight: 700;
  position: relative;
}

.dp-day.dp-today:not(.dp-selected)::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  background: var(--primary-mid);
  border-radius: 50%;
}

.dp-day.dp-selected { background: var(--primary-mid); color: #fff; font-weight: 600; }
.dp-day.dp-other-month { color: var(--border-strong); }
.dp-day:disabled { color: var(--border); cursor: not-allowed; background: none !important; }
.dp-day.dp-empty { pointer-events: none; }

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  #main-content { padding: 16px; }

  .readings-layout { grid-template-columns: 1fr; gap: 16px; }

  .section-title { font-size: 16px; }

  .tiles-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

  .stats-row { grid-template-columns: 1fr; gap: 8px; }
  .stat-value { font-size: 20px; }

  .form-row { grid-template-columns: 1fr; }

  .header-user-info { display: none; }
  .header-user-avatar { display: none; }

  .btn-logout span { display: none; }

  table th, table td { padding: 8px 10px; }

  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .span-2 { grid-column: 1; }

  .datepicker-dropdown { width: 100%; left: 0; right: 0; }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }

  .header-logo span { display: none; }

  #header { padding: 0 12px; }

  .form-control, .datepicker-trigger {
    font-size: 16px; /* prevent iOS zoom */
    padding: 10px 12px;
  }

  .btn-lg { padding: 12px 20px; font-size: 15px; }

  .tiles-grid { grid-template-columns: 1fr 1fr; }
}
