:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e5ea;
  --text: #1a1d23;
  --text-muted: #5a6171;
  --accent: #2d5a3d;
  --accent-hover: #234730;
  --danger: #b3261e;
  --warning: #b86e00;
  --success: #2e7d32;
  --info: #1565c0;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  position: sticky; top: 0; z-index: 10;
}
.app-header .brand {
  font-weight: 700;
  font-size: 16px;
  margin-right: 32px;
  color: var(--accent);
}
.app-header nav { display: flex; gap: 4px; flex: 1; }
.app-header nav a {
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
}
.app-header nav a.active { background: var(--bg); color: var(--text); }
.app-header .user {
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 12px;
}

.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0; font-size: 22px; font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar input, .toolbar select {
  height: 32px;
}

button, .btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
button:hover { background: var(--bg); }
.btn-primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }

input, select, textarea {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-weight: 600;
  background: var(--bg);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: var(--bg); cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-available { background: #e8f5e9; color: #1b5e20; }
.badge-hold { background: #fff8e1; color: #856404; }
.badge-sold { background: #e3f2fd; color: #0d47a1; }
.badge-scrapped { background: #fbe9e7; color: #6e2c1f; }

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

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 95%; max-width: 640px;
  max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
label.field { display: block; }
label.field span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card { width: 360px; padding: 28px; }
.login-card h1 { margin: 0 0 4px 0; font-size: 20px; color: var(--accent); }
.login-card p.sub { margin: 0 0 20px 0; color: var(--text-muted); font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card button { width: 100%; height: 38px; font-size: 14px; }

.notice {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}
.notice-error { background: #fdecea; color: var(--danger); }
.notice-success { background: #e8f5e9; color: var(--success); }

/* Stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 22px; font-weight: 600; margin-top: 4px; }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .app-header { padding: 0 12px; }
  .app-header .brand { margin-right: 16px; }
  .container { padding: 12px; }
}
