*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --text: #202124;
  --text-muted: #5f6368;
  --bg: #f8f9fa;
  --white: #ffffff;
  --border: #dadce0;
  --danger: #d93025;
  --success: #188038;
  --header-h: 56px;
  --nav-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; background: var(--bg); font-family: 'Segoe UI', Roboto, sans-serif; color: var(--text); overflow: hidden; }

/* SCREENS */
.screen { display: none; height: 100vh; height: 100dvh; overflow-y: auto; }
.screen.active { display: flex; flex-direction: column; }

/* LOGIN */
.login-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; gap: 20px; width: 100%; max-width: 320px; margin: 0 auto; }
.login-logo { text-align: center; }
.logo-img { max-width: 240px; width: 100%; height: auto; margin: 0 auto; display: block; }
.login-step { display: none; flex-direction: column; gap: 12px; width: 100%; }
.login-step.active { display: flex; }
.login-note { font-size: 13px; color: var(--text-muted); text-align: center; }
.input-field { width: 100%; padding: 14px 16px; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); }
.input-field:focus { outline: none; border-color: var(--blue); }
.btn-link { background: none; border: none; color: var(--blue); font-size: 13px; cursor: pointer; padding: 4px; }
.login-error { color: var(--danger); font-size: 13px; text-align: center; min-height: 16px; }
.powered-by { text-align: center; padding: 16px; font-size: 11px; color: var(--text-muted); padding-bottom: calc(16px + var(--safe-bottom)); }

/* BUTTONS */
.btn-primary { background: var(--blue); color: #fff; border: none; border-radius: 8px; padding: 14px 24px; font-size: 15px; font-weight: 500; cursor: pointer; width: 100%; transition: background 0.2s; }
.btn-primary:active { background: var(--blue-dark); }
.btn-icon { background: none; border: none; cursor: pointer; padding: 8px; color: #fff; display: flex; align-items: center; }

/* LOADING */
.loading-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* APP SHELL */
.app-header { background: var(--blue); color: #fff; height: var(--header-h); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; padding-top: var(--safe-top); flex-shrink: 0; }
#header-title { font-size: 17px; font-weight: 600; }
#app-main { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); }
.bottom-nav { background: var(--white); border-top: 1px solid var(--border); height: var(--nav-h); display: flex; align-items: center; justify-content: space-around; flex-shrink: 0; padding-bottom: var(--safe-bottom); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 8px 16px; }
.nav-item.active { color: var(--blue); }
.nav-item svg { width: 22px; height: 22px; }

/* CARDS */
.card { background: var(--white); border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.card .input-field { margin-bottom: 8px; }
.card textarea.input-field { resize: vertical; font-family: inherit; }
.list-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }

/* ERROR */
.error-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; gap: 16px; text-align: center; }
#error-msg { color: var(--danger); font-size: 15px; }
