:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #18202f;
  --muted: #687386;
  --line: #dfe4ec;
  --accent: #1f7a8c;
  --accent-dark: #155d6b;
  --red-bg: #fff0f0;
  --red: #c53434;
  --yellow-bg: #fff8dc;
  --yellow: #9a6b00;
  --blue-bg: #eef5ff;
  --blue: #2468c9;
  --shadow: 0 10px 28px rgba(24, 32, 47, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 14px 36px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-width: 84px;
  height: 40px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.add-form,
.search-box {
  display: grid;
  gap: 8px;
}

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

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

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.14);
}

.primary-button,
.sort-button,
.delete-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:active {
  background: var(--accent-dark);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 10px;
}

.sort-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.sort-button.active {
  border-color: var(--accent);
  background: #e8f4f6;
  color: var(--accent-dark);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.dot.red {
  background: var(--red);
}

.dot.yellow {
  background: #d99a00;
}

.dot.blue {
  background: var(--blue);
}

.stock-list {
  display: grid;
  gap: 10px;
}

.stock-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 6px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stock-card.alert-red {
  border-left-color: var(--red);
  background: var(--red-bg);
}

.stock-card.alert-yellow {
  border-left-color: #d99a00;
  background: var(--yellow-bg);
}

.stock-card.alert-blue {
  border-left-color: var(--blue);
  background: var(--blue-bg);
}

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

.symbol {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.delete-button {
  width: 44px;
  min-width: 44px;
  background: #edf0f5;
  color: var(--muted);
}

.delete-button:active {
  background: #dfe4ec;
}

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

.price-box {
  min-height: 68px;
  padding: 9px;
  border: 1px solid rgba(104, 115, 134, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.price-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.price-value {
  font-size: 18px;
  font-weight: 900;
}

.negative {
  color: var(--red);
}

.empty-message {
  margin: 24px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

@media (max-width: 380px) {
  .app-shell {
    padding-inline: 10px;
  }

  .input-row,
  .price-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }
}
