:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-dark: #1e3a8a;
  --border: #d9dce1;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --ok-bg: #ecfdf5;
  --ok-text: #065f46;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.6;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #000 url('/assets/login-bg.jpg') center center / cover no-repeat;
}
.login-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(2px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 320px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.login-card h1 { font-size: 1.2rem; margin-top: 0; }
.login-logo {
  display: block;
  height: 40px;
  margin: 0 auto 20px;
}

.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.admin-header h1 { font-size: 1.3rem; margin: 0; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.panel h2 { font-size: 1.05rem; margin-top: 0; }
.panel h3 { font-size: 0.95rem; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 10px;
}
input, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

button {
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button:disabled { background: #9ca3af; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-block;
}
.btn-link {
  display: inline-block;
  margin-left: 10px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.btn-danger {
  background: var(--danger);
}
.btn-danger:hover { background: #7f1414; }

.inline-form {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.inline-form label { flex: 1; min-width: 180px; }

.table-scroll {
  overflow-x: auto;
}

.deal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 640px;
}
.deal-table th, .deal-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.status-pending { color: #92400e; }
.status-submitted { color: #1d4ed8; }
.status-pdf_generated { color: #065f46; }

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 8px;
  font-size: 0.9rem;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.staff-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
  margin-bottom: 14px;
}
.staff-form label {
  margin-bottom: 0;
}

.plate-group {
  grid-column: span 2;
}
.plate-group-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 6px;
}
.plate-inputs {
  display: flex;
  gap: 6px;
  align-items: center;
}
.plate-input {
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  text-align: center;
  min-width: 0;
}
.plate-office { flex: 1.4; }
.plate-class { flex: 1; }
.plate-hiragana { flex: 0.8; }
.plate-number { flex: 1.2; }

@media (max-width: 480px) {
  .plate-group { grid-column: span 1; }
  .plate-inputs { flex-wrap: wrap; }
  .plate-input { flex: 1 1 40%; }
}

.price-row, .link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 14px;
}
.price-row label, .link-row label { flex: 1; min-width: 200px; margin-bottom: 0; }
.link-row button { flex-shrink: 0; }

.id-images {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.id-images figure {
  margin: 0;
  text-align: center;
}
.id-images img {
  max-width: 280px;
  max-height: 200px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  background: #fff;
}
.id-images figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.pdf-actions { margin-top: 16px; }

.danger-panel {
  border-color: #fecaca;
}

.error {
  color: var(--error);
  background: var(--error-bg);
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: 12px;
}
.muted { color: var(--muted); font-size: 0.85rem; }
.hidden { display: none !important; }
