* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #c0392b;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 16px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #444;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 4px;
  font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #c0392b;
}

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

.input-with-unit {
  display: flex;
  gap: 6px;
}

.input-with-unit input[type="number"] {
  flex: 1;
}

.unit-input {
  width: 56px !important;
  flex: none !important;
  text-align: center;
}

.unit-label {
  display: flex;
  align-items: center;
  padding: 0 8px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #555;
  white-space: nowrap;
}

.btn-calc {
  width: 100%;
  padding: 11px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

.btn-calc:hover {
  background: #a93226;
}

.result-card {
  border-left: 4px solid #c0392b;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.result-row:last-of-type {
  border-bottom: none;
}

.result-label {
  color: #666;
}

.result-value {
  font-weight: 700;
  color: #333;
}

.result-value.danger {
  color: #c0392b;
  font-size: 1.1rem;
}

.result-value.ok {
  color: #27ae60;
}

.verdict {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.verdict.stealth {
  background: #fdecea;
  color: #c0392b;
}

.verdict.price-up {
  background: #fff3e0;
  color: #e67e22;
}

.verdict.same {
  background: #e8f5e9;
  color: #27ae60;
}

.btn-save {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: #fff;
  color: #c0392b;
  border: 2px solid #c0392b;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-save:hover {
  background: #c0392b;
  color: #fff;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h2 {
  margin-bottom: 0;
}

.btn-clear {
  padding: 5px 10px;
  background: #fff;
  color: #aaa;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-clear:hover {
  background: #fdecea;
  color: #c0392b;
  border-color: #c0392b;
}

.history-item {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.history-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #333;
}

.history-item-date {
  font-size: 0.75rem;
  color: #aaa;
}

.history-item-detail {
  font-size: 0.82rem;
  color: #666;
  line-height: 1.6;
}

.history-item-rate {
  font-weight: 700;
  font-size: 1rem;
}

.history-item-rate.danger { color: #c0392b; }
.history-item-rate.ok { color: #27ae60; }

.history-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.btn-delete {
  padding: 3px 8px;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #aaa;
  cursor: pointer;
}

.btn-delete:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  font-size: 0.88rem;
  padding: 12px 0;
}

.hidden {
  display: none;
}

@media (max-width: 480px) {
  h1 { font-size: 1.2rem; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
