:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --line: #dbe3e7;
  --text: #17212b;
  --ink: #17212b;
  --muted: #687783;
  --border: #dbe3e7;
  --blue: #1769e0;
  --green: #1f9d55;
  --orange: #d9822b;
  --red: #d64545;
  --purple: #7c3aed;
  --teal: #128a8a;
  --shadow: 0 10px 24px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #123c69, #1e6f78 52%, #f4b942);
  color: #fff;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 750;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.topbar-date {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
  padding-bottom: 92px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-button {
  flex: 0 0 92px;
  display: grid;
  gap: 3px;
  place-items: center;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-button.active {
  background: rgba(23, 105, 224, 0.12);
  color: var(--blue);
}

.icon {
  font-size: 20px;
  line-height: 1;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

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

.panel {
  padding: 14px;
}

.card {
  padding: 14px;
}

.metric {
  padding: 14px;
}

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

.metric-value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.app-summary {
  display: none;
}

.mobile-orders-top,
.ios-search,
.ios-sync-card {
  display: none;
}

.muted {
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button.danger {
  border-color: rgba(214, 69, 69, 0.28);
  color: var(--red);
}

.button.ghost {
  background: transparent;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row-main {
  min-width: 0;
}

.row-title {
  font-weight: 750;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.blue { background: rgba(23, 105, 224, 0.12); color: var(--blue); }
.badge.green { background: rgba(31, 157, 85, 0.12); color: var(--green); }
.badge.orange { background: rgba(217, 130, 43, 0.12); color: var(--orange); }
.badge.red { background: rgba(214, 69, 69, 0.12); color: var(--red); }
.badge.purple { background: rgba(124, 58, 237, 0.12); color: var(--purple); }
.badge.teal { background: rgba(18, 138, 138, 0.12); color: var(--teal); }

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

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

.input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

textarea.input {
  min-height: 86px;
  resize: vertical;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.chip.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.column {
  min-width: 240px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.column-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 800;
}

.habit-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.habit-day {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 8px;
  background: #edf3f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.habit-day.done {
  background: var(--green);
  color: #fff;
}

.habit-day.today {
  outline: 2px solid rgba(23, 105, 224, 0.25);
}

.login-screen {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 440px);
  align-items: center;
  gap: 28px;
  padding: clamp(22px, 5vw, 68px);
  background:
    radial-gradient(circle at 18% 18%, rgba(244, 185, 66, 0.24), transparent 28%),
    radial-gradient(circle at 78% 12%, rgba(18, 138, 138, 0.24), transparent 30%),
    linear-gradient(135deg, #10243a 0%, #173b45 48%, #f3f7f6 48%, #edf4f3 100%);
  overflow: hidden;
}

.login-hero {
  color: #ffffff;
  max-width: 720px;
  min-width: 0;
}

.hero-badge {
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.login-hero h1 {
  max-width: 650px;
  margin: 22px 0 14px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.login-hero p {
  max-width: 570px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 132px));
  gap: 10px;
  margin-top: 26px;
}

.hero-metrics div,
.hero-preview {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.hero-metrics div {
  border-radius: 10px;
  padding: 14px;
}

.hero-metrics strong,
.hero-metrics span {
  display: block;
}

.hero-metrics strong {
  font-size: 24px;
}

.hero-metrics span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 750;
}

.hero-preview {
  width: min(460px, 100%);
  margin-top: 28px;
  border-radius: 16px;
  padding: 16px;
}

.preview-top {
  display: flex;
  gap: 7px;
  margin-bottom: 16px;
}

.preview-top span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.preview-row + .preview-row {
  margin-top: 10px;
}

.preview-row.strong {
  background: rgba(244, 185, 66, 0.16);
}

.preview-row b,
.preview-row small {
  display: block;
}

.preview-row small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
}

.preview-row em {
  color: #f8d778;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.preview-progress {
  height: 9px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.preview-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f4b942, #42d6a4);
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 26px 80px rgba(16, 36, 58, 0.2);
  backdrop-filter: blur(20px);
}

.login-card .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(18, 60, 105, 0.26);
}

.login-card .brand-title {
  font-size: 20px;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.google-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fbfb);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  margin-top: 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.google-button:hover {
  border-color: rgba(23, 105, 224, 0.28);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.google-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(from -45deg, #4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0);
  color: #ffffff;
  font-weight: 900;
  font-size: 14px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 16px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.auth-error {
  border: 1px solid rgba(214, 69, 69, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(214, 69, 69, 0.08);
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(180deg, rgba(23, 105, 224, 0.08), transparent 240px),
      #eef3f6;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .topbar {
    display: none;
  }

  .topbar .brand {
    gap: 9px;
  }

  .topbar .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 13px;
  }

  .topbar .brand-title {
    font-size: 16px;
  }

  .topbar .brand-subtitle {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  .topbar-date {
    display: none;
  }

  .topbar .button.ghost {
    min-height: 34px;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.72);
    font-size: 12px;
  }

  .content {
    width: 100%;
    padding: calc(22px + env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom));
  }

  .mobile-orders-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .ios-circle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.84);
    color: #05070a;
    box-shadow: 0 14px 28px rgba(23, 33, 43, 0.12);
    font-size: 25px;
    font-weight: 900;
    line-height: 1;
  }

  .ios-circle.plus {
    font-size: 42px;
    font-weight: 500;
  }

  .toolbar {
    flex-direction: row;
    align-items: center;
    margin-bottom: 12px;
  }

  .toolbar h1 {
    font-size: 42px;
    line-height: 1;
    letter-spacing: 0;
  }

  .toolbar-actions {
    display: none;
  }

  .toolbar .button.primary {
    min-width: 44px;
    min-height: 44px;
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 12px 24px rgba(23, 105, 224, 0.25);
  }

  .ios-search {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    margin-bottom: 16px;
    padding: 0 18px;
    border-radius: 28px;
    background: #dedee4;
    color: #7e8188;
  }

  .ios-search span {
    color: #111827;
    font-size: 30px;
    transform: rotate(-8deg);
  }

  .ios-search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
  }

  .ios-search input::placeholder {
    color: #96989f;
  }

  .ios-sync-card {
    display: grid;
    gap: 18px;
    margin-bottom: 42px;
    padding: 24px 24px 26px;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(23, 33, 43, 0.06);
  }

  .sync-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    color: #8a8d93;
    font-size: 16px;
    font-weight: 700;
  }

  .sync-row strong {
    color: #777a82;
    font-size: 15px;
  }

  .sync-icon {
    font-size: 25px;
    color: #8f9298;
  }

  .sync-divider {
    height: 1px;
    margin-left: 58px;
    background: #e5e5ea;
  }

  .sync-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .sync-tab {
    min-height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 9px 16px;
    background: transparent;
    color: #111111;
    font-size: 17px;
    font-weight: 850;
    white-space: nowrap;
  }

  .sync-tab.active {
    background: #0a99ff;
    color: #ffffff;
  }

  .app-summary {
    display: block;
    margin-bottom: 24px;
    color: #8c8e96;
  }

  .app-summary span {
    display: block;
    margin-bottom: 12px;
    font-size: 21px;
    font-weight: 900;
  }

  .app-summary strong {
    display: block;
    padding: 17px 22px;
    border-radius: 24px;
    background: #ffffff;
    color: #999ca3;
    box-shadow: 0 12px 26px rgba(23, 33, 43, 0.04);
    font-size: 18px;
    line-height: 1.25;
  }

  .app-summary small {
    display: none;
  }

  .tabs {
    display: none;
  }

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

  .chip {
    min-height: 38px;
    border-radius: 999px;
    padding: 8px 13px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 6px 16px rgba(23, 33, 43, 0.05);
  }

  .panel,
  .card,
  .metric,
  .column {
    border-color: rgba(219, 227, 231, 0.78);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(23, 33, 43, 0.07);
  }

  .panel {
    padding: 20px 22px;
    border: 0;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(23, 33, 43, 0.05);
  }

  .row {
    align-items: flex-start;
    gap: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .row + .row {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5e5ea;
  }

  .order-card {
    display: grid;
    grid-template-columns: 1fr auto 16px;
    align-items: start;
    position: relative;
  }

  .order-card::after {
    content: "›";
    grid-column: 3;
    grid-row: 1 / span 3;
    align-self: center;
    color: #c4c5ca;
    font-size: 42px;
    font-weight: 300;
  }

  .order-card .row-main {
    grid-column: 1;
  }

  .order-card .badge {
    grid-column: 2;
    grid-row: 1;
    margin-right: 8px;
  }

  .order-card .balance-meta {
    grid-column: 1;
    margin-top: 10px;
    color: #777a82;
    font-size: 14px;
    font-weight: 700;
  }

  .order-card .button {
    display: none;
  }

  .row-title {
    font-size: 22px;
    line-height: 1.25;
    color: #05070a;
  }

  .row-meta {
    font-size: 17px;
    line-height: 1.55;
    color: #8b8e96;
  }

  .order-meta-lines {
    display: grid;
    gap: 3px;
    margin-top: 10px;
  }

  .order-meta-lines span {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .order-meta-lines b {
    width: 18px;
    color: #8b8e96;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
  }

  .badge {
    min-height: 26px;
    padding: 5px 11px;
    background: #dff1ff !important;
    color: #0a99ff !important;
    font-size: 14px;
  }

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

  .metric {
    padding: 14px;
    background: rgba(255, 255, 255, 0.82);
  }

  .metric-value {
    font-size: 26px;
  }

  .kanban {
    display: flex;
    gap: 12px;
    margin: 0 -14px;
    padding: 0 14px 10px;
    scroll-snap-type: x mandatory;
  }

  .column {
    flex: 0 0 86%;
    min-width: 0;
    padding: 12px;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.76);
  }

  .card {
    padding: 14px;
    background: #ffffff;
  }

  .button {
    min-height: 42px;
    border-radius: 12px;
  }

  .bottom-nav {
    right: 10px;
    bottom: 10px;
    left: 10px;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(219, 227, 231, 0.8);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 44px rgba(23, 33, 43, 0.18);
  }

  .nav-button {
    flex: 0 0 74px;
    min-height: 58px;
    border-radius: 18px;
    font-size: 11px;
  }

  .nav-button.active {
    background: #17212b;
    color: #ffffff;
  }

  .nav-button .icon {
    font-size: 19px;
  }

  .login-screen {
    width: 100vw;
    max-width: 100vw;
    display: block;
    grid-template-columns: 1fr;
    align-items: start;
    padding: 0;
    overflow-x: hidden;
    background:
      radial-gradient(circle at 20% 10%, rgba(244, 185, 66, 0.22), transparent 30%),
      linear-gradient(180deg, #10243a 0%, #173b45 44%, #eef5f4 44%, #eef5f4 100%);
  }

  .login-hero {
    width: 100%;
    max-width: 100%;
    padding: 18px 18px 0;
  }

  .login-hero h1 {
    display: block;
    width: calc(100vw - 36px);
    max-width: 100%;
    font-size: 22px;
    line-height: 1.18;
    white-space: normal;
    word-break: break-word;
  }

  .login-hero p {
    display: none;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hero-metrics div:last-child {
    grid-column: auto;
  }

  .hero-metrics div {
    padding: 10px 12px;
  }

  .hero-metrics strong {
    font-size: 20px;
  }

  .hero-preview {
    display: none;
  }

  .login-card {
    width: auto;
    max-width: none;
    margin: 18px 12px 24px;
    padding: 22px;
  }

  .login-card,
  .login-card * {
    min-width: 0;
  }

  .login-card .muted {
    display: none;
  }

  .content {
    padding: 14px;
    padding-bottom: 92px;
  }

  .grid.metrics,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
