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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #212529;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.container.narrow {
  max-width: 420px;
  padding-top: 5rem;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

h1 { font-size: 1.6rem; color: #1a1a2e; }

h2 {
  font-size: 1.1rem;
  color: #1a1a2e;
  margin-bottom: 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.subtitle {
  font-size: 0.78rem;
  font-weight: 400;
  color: #6c757d;
}

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

.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.flash-success { background: #d1e7dd; color: #0a3622; }
.flash-error   { background: #f8d7da; color: #58151c; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #dee2e6;
  color: #6c757d;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fa; }

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  background: #f0f2f5;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}

.price-cell { min-width: 160px; }
.price { font-variant-numeric: tabular-nums; }
.price.up   small { color: #198754; }
.price.down small { color: #dc3545; }
.loading { color: #6c757d; font-style: italic; font-size: 0.88rem; }
.error   { color: #dc3545; font-size: 0.88rem; }

.empty {
  color: #6c757d;
  font-style: italic;
  margin-bottom: 1rem;
}

.add-form {
  margin-top: 0.5rem;
  border-top: 1px solid #dee2e6;
  padding-top: 1rem;
}
.add-form summary {
  cursor: pointer;
  color: #0d6efd;
  font-size: 0.92rem;
  font-weight: 500;
  user-select: none;
  margin-bottom: 0.75rem;
}
.add-form summary:hover { color: #0a58ca; }

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.form-group-check {
  justify-content: flex-end;
  padding-bottom: 0.4rem;
}
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #495057;
}
.form-group input[type="text"] {
  padding: 0.45rem 0.65rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.92rem;
  width: 160px;
}
.form-group input[type="text"]:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}
.form-group-check label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
}

.help-text {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.5rem;
}

.hidden { display: none; }

.actions-cell { white-space: nowrap; display: flex; gap: .4rem; align-items: center; }

.form-select {
  padding: 0.45rem 0.65rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.92rem;
  background: #fff;
}
.form-select:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #0d6efd; color: #fff; }
.btn-danger  { background: #dc3545; color: #fff; }
.btn-sm      { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-test    { background: #e9ecef; color: #495057; }
.btn-test:hover { background: #dee2e6; opacity: 1; }

/* Login form */
.container.narrow .card {
  padding: 2rem;
}
.container.narrow h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}
.container.narrow label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #495057;
}
.container.narrow input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 1rem;
}
.container.narrow input[type="password"]:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}
.container.narrow .btn { width: 100%; justify-content: center; }
