:root {
  --bg: #effafc;
  --panel: #ffffff;
  --primary: #1b6f7a;
  --primary-dark: #124b56;
  --secondary: #dff5f8;
  --text: #18363d;
  --muted: #58757d;
  --success: #1d8f6d;
  --warning: #d08f2d;
  --danger: #c65b5b;
  --shadow: 0 12px 24px rgba(18, 60, 78, 0.08);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  padding: 0 0 calc(84px + var(--safe-bottom));
}

button, input {
  font: inherit;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  background: linear-gradient(180deg, #f3fcfd 0%, #eef6ff 100%);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, #2ca4b3 100%);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1, h2, h3, p {
  margin: 0;
}

.topbar h1 {
  font-size: 1.07rem;
  color: var(--text);
}

.ghost-button {
  border: 0;
  background: #dff5f8;
  color: var(--primary-dark);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.hidden { display: none !important; }

.app-view {
  padding: 0 18px 12px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.auth-card,
.card,
.summary-card,
.list-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 22px 18px 18px;
  margin-top: 12px;
}

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.logo-wrap .brand-badge {
  width: 68px;
  height: 68px;
  font-size: 1.7rem;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 6px;
}

.auth-card p {
  text-align: center;
  color: var(--muted);
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

input {
  width: 100%;
  border: 1px solid #dfeaf0;
  background: #fbfdff;
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(27, 111, 122, 0.1);
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #2ea2b7 100%);
  color: white;
  font-weight: 700;
  padding: 15px 16px;
  box-shadow: 0 8px 18px rgba(27, 111, 122, 0.18);
}

.secondary-link {
  text-align: center;
  color: var(--primary-dark);
  font-size: 0.8rem;
  margin-top: 14px;
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  display: none;
}

.alert.error { background: #faecec; color: #8f2f2f; display: block; }
.alert.success { background: #eaf8f1; color: #1e7a4f; display: block; }

.dashboard-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 14px;
}

.dashboard-header h2,
.section-header h3 {
  font-size: 1.2rem;
}

.muted {
  color: var(--muted);
  font-size: 0.72rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 18px 14px;
}

.summary-card .label {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 1.5rem;
  font-weight: 700;
}

.summary-card .trend {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--success);
  background: rgba(29, 143, 109, 0.1);
  border-radius: 999px;
  padding: 5px 8px;
}

.card {
  padding: 18px 16px;
  margin-bottom: 14px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-item {
  background: #edf9fb;
  border: 0;
  border-radius: 16px;
  padding: 12px 10px;
  color: var(--primary-dark);
  font-weight: 700;
  min-height: 78px;
}

.action-item span {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.list-card {
  padding: 18px 16px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid #edf4f7;
}

.list-item:last-child { border-bottom: 0; }

.item-copy strong {
  display: block;
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.badge.ok {
  background: rgba(29, 143, 109, 0.12);
  color: var(--success);
}

.badge.warn {
  background: rgba(208, 143, 45, 0.12);
  color: var(--warning);
}

.badge.info {
  background: rgba(27, 111, 122, 0.1);
  color: var(--primary-dark);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(8px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(100% - 18px, 460px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(27, 111, 122, 0.08);
  box-shadow: 0 -8px 22px rgba(18, 18, 28, 0.08);
  border-radius: 18px;
  padding: 8px 8px 10px;
  backdrop-filter: blur(10px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px 6px;
  border-radius: 12px;
  font-weight: 700;
}

.nav-item.active {
  background: var(--secondary);
  color: var(--primary-dark);
}

.nav-item span { font-size: 1.2rem; }
.nav-item small { font-size: 0.64rem; }

@media (min-width: 640px) {
  body {
    padding: 18px 0 100px;
  }

  .app-shell {
    border-radius: 28px;
    overflow: hidden;
    margin: 0 auto 24px;
    min-height: calc(100vh - 24px);
    box-shadow: 0 18px 40px rgba(23, 41, 54, 0.08);
  }
}
