@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-latin-700-normal.woff2') format('woff2');
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--color-background);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

.numeric {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--color-primary);
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--topbar-height);
  padding: 0 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.topbar__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
}

.topbar__title img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

/* Mode toggle (Owner/Tenant) */
.mode-toggle {
  display: inline-flex;
  background: var(--color-primary-soft);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}

.mode-toggle__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--color-primary-dark);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.mode-toggle__btn[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
}

.mode-toggle__btn:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}

/* Main content */
.screen {
  display: none;
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.screen.is-active {
  display: block;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

/* Card */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  margin-bottom: 16px;
}

.card__title {
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 4px;
}

.card__desc {
  color: var(--color-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--color-muted);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--color-primary);
}

.empty-state__title {
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 4px;
}

.empty-state__desc {
  font-size: 14px;
  margin: 0;
}

/* Status badges (icon + text, bukan warna sahaja) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.badge svg {
  width: 14px;
  height: 14px;
}

.badge--success { background: #E8F8EE; color: var(--color-success); }
.badge--warning { background: #FEF3E2; color: var(--color-warning); }
.badge--danger  { background: #FDECEC; color: var(--color-danger); }
.badge--info    { background: #E6F7FD; color: var(--color-info); }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav__item[aria-current="true"] {
  color: var(--color-primary);
}

.bottom-nav__item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Update toast fallback (dipakai jika SweetAlert2 belum dimuatkan) */
.update-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius-card);
  padding: 12px 16px;
  box-shadow: var(--shadow-soft);
  font-size: 14px;
}

.update-toast button {
  appearance: none;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
