:root {
  color-scheme: light;
  --navy: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --line: #dbe3ef;
  --page: #f2f4f8;
  --surface: #f8fafc;
  --white: #ffffff;
  --blue: #2563eb;
  --green: #059669;
  --orange: #d97706;
  --red: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--navy);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}

.login-card,
.card,
.form-card,
.metric-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 22px;
}

.brand {
  width: 190px;
  height: auto;
  display: block;
}

.brand-small {
  width: 118px;
  height: auto;
  flex: 0 0 auto;
}

.login-subtitle {
  color: var(--muted);
  margin: 14px 0 18px;
  font-size: 14px;
}

.product-signature {
  display: grid;
  gap: 3px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.product-signature strong {
  color: var(--slate);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  color: var(--slate);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  padding: 12px;
  min-height: 44px;
}

.field textarea {
  resize: vertical;
  min-height: 88px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--slate);
}

.btn-danger {
  background: var(--red);
  color: var(--white);
}

.screen {
  min-height: 100vh;
  background: var(--page);
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248, 250, 252, 0.94);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.screen-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-line {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.content {
  display: grid;
  gap: 12px;
  padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
}

.status-banner {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.status-banner.ok {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.status-banner.pending {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.status-banner.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--slate);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.icon-button svg,
.tab-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 760px);
  transform: translateX(-50%);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  gap: 4px;
  overflow-x: auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.08);
  scrollbar-width: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-tabs::-webkit-scrollbar {
  display: none;
}

.bottom-tab {
  min-height: 56px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
}

.bottom-tab.active {
  background: #eff6ff;
  color: var(--blue);
}

.tab-icon {
  display: grid;
  place-items: center;
}

.tab-label {
  font-size: 11px;
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
}

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

.metric-card {
  min-height: 92px;
  padding: 13px;
  border-left: 4px solid var(--blue);
}

.metric-card strong {
  display: block;
  font-size: 25px;
  line-height: 1;
  margin-bottom: 12px;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-title {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 800;
}

.card,
.form-card {
  padding: 13px;
}

.card {
  border-left: 4px solid var(--blue);
}

.card-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.card-subtitle,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 800;
}

.search {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  padding: 12px;
  min-height: 44px;
}

.status {
  padding: 10px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none;
}

@media (min-width: 720px) {
  .app-shell {
    max-width: 760px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

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

  .content {
    padding-left: 18px;
    padding-right: 18px;
  }
}
