/* ── Top App Bar ───────────────────────────────────────── */
.top-app-bar {
  background: var(--md-surface-container);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 6px 2px rgba(0,0,0,.2);
}
.top-app-bar-leading,
.top-app-bar-trailing {
  display: flex;
  align-items: center;
  width: 48px;
  justify-content: center;
  flex-shrink: 0;
}
.top-app-bar-title {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 400;
  color: var(--md-on-surface);
  letter-spacing: 0;
}

/* ── Icon Button ───────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  transition: background 0.2s;
  font-size: 24px;
  padding: 0;
}
.icon-btn:hover  { background: rgba(255,255,255,.08); }
.icon-btn:active { background: rgba(255,255,255,.12); }
.icon-btn .material-symbols-rounded { font-size: 24px; }

/* ── Cards ─────────────────────────────────────────────── */
.md-card {
  background: var(--md-surface-container);
  border-radius: 12px;
}
.md-card-elevated {
  background: var(--md-surface-container-low);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
}

/* ── Outlined Text Field ───────────────────────────────── */
.md-field {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
.md-field-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--md-outline);
  border-radius: 4px;
  background: transparent;
  color: var(--md-on-surface);
  font-family: Roboto, sans-serif;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.md-field-input::-webkit-calendar-picker-indicator { display: none !important; }
.md-field-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 4px;
  color: var(--md-on-surface-variant);
  font-family: Roboto, sans-serif;
  font-size: 16px;
  line-height: 1;
  transition: top 0.15s, font-size 0.15s, color 0.15s;
  pointer-events: none;
  background: var(--md-surface-container);
}
.md-field-input:focus ~ .md-field-label,
.md-field-input:not(:placeholder-shown) ~ .md-field-label {
  top: 0;
  font-size: 12px;
  color: var(--md-primary);
}
.md-field-input:focus {
  border-color: var(--md-primary);
  border-width: 2px;
  padding: 13px 15px;
}
.md-field-input:focus ~ .md-field-label { color: var(--md-primary); }

/* ── Select Field ──────────────────────────────────────── */
.md-select-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.md-select-wrap > span {
  font-size: 12px;
  color: var(--md-on-surface-variant);
  padding-left: 2px;
}
.md-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--md-outline);
  border-radius: 4px;
  color: var(--md-on-surface);
  font-family: Roboto, sans-serif;
  font-size: 16px;
  padding: 10px 36px 10px 14px;
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23958EA0' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}
.md-select:focus  { border-color: var(--md-primary); border-width: 2px; padding: 9px 35px 9px 13px; }
.md-select option { background: var(--md-surface-container-highest); color: var(--md-on-surface); }

/* ── Filled Button ─────────────────────────────────────── */
.md-btn-filled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  border: none;
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-family: Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .1px;
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.2s;
}
.md-btn-filled:hover  { box-shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.2); }
.md-btn-filled:active { box-shadow: none; }
.md-btn-filled:focus  { outline: 3px solid var(--md-primary); outline-offset: 2px; }

/* ── Outlined Button ───────────────────────────────────── */
.md-btn-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  border: 1px solid var(--md-outline);
  background: transparent;
  color: var(--md-primary);
  font-family: Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .1px;
  cursor: pointer;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
.md-btn-outlined:hover  { background: rgba(128,203,196,.08); }
.md-btn-outlined:active { background: rgba(128,203,196,.12); }
.md-btn-outlined:focus  { outline: 3px solid var(--md-primary); outline-offset: 2px; border-color: var(--md-primary); }

/* ── Switch ────────────────────────────────────────────── */
.md-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--md-on-surface);
  cursor: pointer;
  user-select: none;
}
.md-switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}
.md-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.md-switch-track {
  position: absolute;
  inset: 0;
  background: var(--md-surface-container-highest);
  border: 2px solid var(--md-outline);
  border-radius: 16px;
  transition: background 0.2s, border-color 0.2s;
}
.md-switch-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  left: 6px;
  top: 6px;
  background: var(--md-outline);
  border-radius: 50%;
  transition: left 0.2s, top 0.2s, width 0.1s, height 0.1s, background 0.2s;
}
.md-switch input:checked ~ .md-switch-track {
  background: var(--md-primary);
  border-color: var(--md-primary);
}
.md-switch input:checked ~ .md-switch-track .md-switch-thumb {
  background: var(--md-on-primary);
  width: 24px;
  height: 24px;
  left: 22px;
  top: 2px;
}

/* ── Chip ──────────────────────────────────────────────── */
.md-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--md-outline-variant);
  background: transparent;
  color: var(--md-on-surface-variant);
  font-family: Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.md-chip:hover  { background: rgba(255,255,255,.08); border-color: var(--md-outline); color: var(--md-on-surface); }
.md-chip:active { background: rgba(255,255,255,.12); }
.md-chip:focus  { outline: 2px solid var(--md-primary); outline-offset: 1px; }

/* ── Divider ───────────────────────────────────────────── */
.md-divider {
  height: 1px;
  background: var(--md-outline-variant);
  border: none;
  margin: 0;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar       { width: 8px; }
::-webkit-scrollbar-track { background: var(--md-surface); }
::-webkit-scrollbar-thumb { background: var(--md-outline-variant); border-radius: 4px; }
