/* Crossrate — application shell. Five screens, bottom tabs, no framework. */

:root {
  --bg:        #07090D;
  --surface:   #0E1118;
  --surface-2: #141924;
  --line:      #1E2532;
  --line-soft: #171D28;
  --text:      #E9EDF5;
  --muted:     #7E8798;
  --dim:       #59616F;
  --accent:    #E0A33E;
  --up:        #35C58A;
  --down:      #FF6B7D;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.app {
  display: flex; flex-direction: column; height: 100%;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------------------------------------------------------- app bar */

.appbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px 12px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface); flex: none;
}
.appbar__mark { width: 30px; height: 30px; flex: none; }
.appbar__title { display: block; font-size: 16px; font-weight: 640; letter-spacing: -0.01em; }
.appbar__sub { display: block; font-size: 11.5px; color: var(--dim); margin-top: -1px; }
.appbar__spacer { flex: 1; }

.ratechip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); background: transparent; cursor: pointer;
}
.ratechip i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); font-style: normal; flex: none; }
.ratechip.is-offline i { background: var(--dim); }

/* ---------------------------------------------------------------- views */

.views { flex: 1; position: relative; overflow: hidden; }
.view {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 18px 26px;
}
.view[hidden] { display: none; }

.sect { margin-bottom: 24px; }
.sect__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 11px;
}
.sect__head h2 { margin: 0; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.sect__head a, .sect__head button {
  font-size: 12.5px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
}

/* hero rate on the home screen */
.headline { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 18px; margin-bottom: 20px; }
.headline__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.headline__pair { font-size: 15px; font-weight: 620; letter-spacing: 0.01em; }
.headline__pair span { display: block; font-size: 11.5px; color: var(--dim); font-weight: 400; letter-spacing: 0; margin-top: 1px; }
.headline__rate { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 32px; letter-spacing: -0.02em; margin-top: 12px; }
.headline__chg { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; margin-top: 2px; }
.headline__spark { width: 100%; height: 64px; display: block; margin-top: 12px; }

/* generic list rows */
.list { border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; background: var(--surface); }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
  cursor: pointer; background: transparent; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; color: inherit;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface-2); }
.badge {
  width: 36px; height: 27px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 10px; font-weight: 650; letter-spacing: 0.03em; color: var(--muted); flex: none;
}
.row__name b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em; }
.row__name span { display: block; font-size: 11.5px; color: var(--dim); }
.row__val { text-align: right; }
.row__val b { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 550; }
.row__val span { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--dim); }

.empty { padding: 40px 20px; text-align: center; color: var(--dim); font-size: 14px; line-height: 1.6; }

/* search + filters */
.search {
  display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface); margin-bottom: 12px;
}
.search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 14.5px; min-width: 0; }
.search input::placeholder { color: var(--dim); }

.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); font-size: 12.5px; padding: 7px 13px; cursor: pointer;
}
.chip.is-on { background: rgba(224, 163, 62, 0.14); border-color: rgba(224, 163, 62, 0.4); color: var(--accent); }

/* pair detail */
.detail__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none;
}
.iconbtn:active { background: var(--surface-2); }
.iconbtn.is-on { color: var(--accent); border-color: rgba(224, 163, 62, 0.4); }
.detail__title b { display: block; font-size: 17px; font-weight: 640; letter-spacing: 0.01em; }
.detail__title span { display: block; font-size: 12px; color: var(--dim); }

.detail__rate { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 34px; letter-spacing: -0.02em; }
.detail__chg { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; margin-top: 2px; }
.chart { width: 100%; height: 168px; display: block; margin: 16px 0 8px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 20px; }
.stat { border: 1px solid var(--line-soft); border-radius: 11px; padding: 11px 12px; background: var(--surface); }
.stat span { display: block; font-size: 10.5px; color: var(--dim); letter-spacing: 0.05em; text-transform: uppercase; }
.stat b { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; margin-top: 4px; font-weight: 550; }

/* converter */
.conv { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; }
.conv__row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.conv__row + .conv__row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.conv label { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.conv input {
  width: 100%; background: transparent; border: 0; outline: 0; color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 21px; padding: 0;
}
.conv__cur { font-size: 14px; font-weight: 620; color: var(--muted); letter-spacing: 0.03em; }

/* profile rows */
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px; border-bottom: 1px solid var(--line-soft);
  width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0;
  color: inherit; text-align: left; cursor: pointer;
}
.opt:last-child { border-bottom: 0; }
.opt b { display: block; font-size: 14.5px; font-weight: 550; }
.opt span { display: block; font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.opt select {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 13.5px; padding: 8px 10px; outline: none;
}
.opt .val { font-size: 13.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.opt.is-danger b { color: var(--down); }

.disclaimer {
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px;
  background: var(--surface); font-size: 12.5px; color: var(--dim); line-height: 1.6; margin-top: 16px;
}
.disclaimer strong { color: var(--muted); }

/* ---------------------------------------------------------------- tab bar */

.tabbar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line-soft); background: var(--surface); flex: none;
}
.tab {
  border: 0; background: transparent; color: var(--dim); cursor: pointer;
  padding: 9px 4px 11px; display: grid; justify-items: center; gap: 3px; font-size: 10.5px;
}
.tab svg { opacity: 0.75; }
.tab.is-active { color: var(--accent); }
.tab.is-active svg { opacity: 1; }

/* ---------------------------------------------------------------- sheet + toast */

.sheet {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(3, 4, 7, 0.66); align-items: flex-end;
}
.sheet.is-on { display: flex; }
.sheet__box {
  width: 100%; background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
}
.sheet__box h3 { margin: 0 0 8px; font-size: 17px; font-weight: 640; }
.sheet__box p { margin: 0 0 18px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.sheet__box button {
  width: 100%; padding: 13px; border-radius: 11px; border: 0;
  background: var(--accent); color: #131007; font-size: 15px; font-weight: 600; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; font-size: 13px; color: var(--text);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 70;
  white-space: nowrap;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
