:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1e3a8a;
  --primary-soft: #dbeafe;
  --accent: #2563eb;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #15803d;
  --radius: 18px;
  --shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body,
input,
button,
select,
textarea {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", Tahoma, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 82px;
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand-block {
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.icon-button {
  border: 1px solid var(--border);
  background: var(--surface);
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.hero-card {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: white;
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  opacity: 0.8;
}

.hero-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.hero-text {
  margin: 10px 0 0;
  color: #dbeafe;
  line-height: 1.45;
}

.section-title {
  margin: 24px 0 12px;
  font-size: 18px;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  min-height: 72px;
}

.quick-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
  flex: 0 0 auto;
}

.quick-title {
  font-weight: 800;
}

.quick-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  font-size: 30px;
  font-weight: 900;
  margin-top: 6px;
}

.feed {
  display: grid;
  gap: 12px;
}

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.feed-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.feed-title {
  font-weight: 800;
}

.feed-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-success {
  color: #166534;
  background: #dcfce7;
}

.badge-warning {
  color: #92400e;
  background: #fef3c7;
}

.badge-danger {
  color: #991b1b;
  background: #fee2e2;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 8px;
}

.bottom-link {
  text-decoration: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 12px;
  border-radius: 14px;
}

.bottom-link strong {
  font-size: 18px;
  line-height: 1;
}

.bottom-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: white;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.login-brand {
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 18px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-subtitle,
.login-footnote {
  color: var(--muted);
}

.login-card label {
  display: block;
  font-weight: 700;
  margin: 16px 0;
}

.login-card input {
  width: 100%;
  margin-top: 7px;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  font-size: 16px;
}

.login-card button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
}

.logout-form {
  margin: 0;
}

.logout-button {
  border: 1px solid var(--border);
  background: white;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

@media (min-width: 720px) {
  .page {
    padding: 26px;
  }

  .quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .hero-title {
    font-size: 32px;
  }
}

@media (min-width: 1100px) {
  .app-shell {
    padding-bottom: 0;
  }

  .bottom-nav {
    max-width: 1180px;
    left: 50%;
    transform: translateX(-50%);
    bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
  }

  .page {
    padding-bottom: 112px;
  }
}
