:root {
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-text: #1a2332;
  --color-muted: #5c6b7a;
  --color-primary: #0b6e4f;
  --color-primary-contrast: #ffffff;
  --color-danger: #c0392b;
  --color-warn: #b7791f;
  --color-border: #d8dee6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --header-h: 3rem;
  --nav-h: 3.25rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0 0 var(--space-md);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0 var(--space-md);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.app-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  flex: 1;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-xl) + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.view {
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.muted {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  font-weight: 600;
}
