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

:root {
  --bg:        #f0f4f8;
  --surface:   #ffffff;
  --card:      #e8f0fe;
  --accent:    #d93025;
  --accent2:   #1a73e8;
  --accent2l:  #e8f0fe;
  --text:      #202124;
  --text-muted:#5f6368;
  --border:    #dadce0;
  --success:   #137333;
  --successbg: #e6f4ea;
  --successbd: #a8d5b5;
  --warning:   #b06000;
  --warningbg: #fef7e0;
  --warningbd: #fdd663;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
}

body {
  font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── View switching ── */
.view { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Loading overlay ── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(240,244,248,0.75);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active { display: flex; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--accent); }

/* ── Auth view ── */
#auth-view {
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

.auth-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-error {
  color: var(--accent);
  font-size: 0.84rem;
  background: #fce8e6;
  border: 1px solid #f5c6c2;
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
}

.auth-error.show { display: block; }

.btn-full { width: 100%; }

.auth-switch {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 700;
  margin-left: 4px;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-forgot {
  text-align: center;
  font-size: 0.80rem;
  margin-top: 6px;
}

.auth-forgot a {
  color: var(--text-muted);
  text-decoration: none;
}

.auth-forgot a:hover { text-decoration: underline; }

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-icon { font-size: 1.3rem; flex-shrink: 0; }

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex-shrink: 0;
}

header h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.header-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-select {
  flex: 1;
  min-width: 0;
  max-width: 200px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 5px 8px;
  font-family: inherit;
  cursor: pointer;
}

.vehicle-select:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.btn-header {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.btn-header:hover { background: var(--card); color: var(--text); }
.btn-icon { padding: 5px 8px; font-size: 1rem; }

/* ── Admin badge ── */
.admin-badge {
  background: var(--accent2);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Admin filters ── */
.admin-filters {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  flex: 1;
  min-width: 120px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 7px 10px;
  font-family: inherit;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

/* ── Main ── */
main {
  flex: 1;
  padding: 16px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

/* ── Month nav ── */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.month-nav button {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--accent2);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: var(--shadow);
}

.month-nav button:hover { background: var(--card); }

.month-label {
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 140px;
  text-align: center;
  color: var(--text);
}

/* ── Calendar ── */
.calendar {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.calendar-header span {
  text-align: center;
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.calendar-header span:first-child { color: #c5221f; }
.calendar-header span:last-child  { color: var(--accent2); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 72px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 3px;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--card); }
.cal-day.other-month { opacity: 0.35; pointer-events: none; }

.cal-day.today { background: #e8f0fe; }
.cal-day.today .day-num {
  background: var(--accent2);
  color: #fff;
  border-radius: 50%;
}

.cal-day.sunday  .day-num { color: #c5221f; }
.cal-day.saturday .day-num { color: var(--accent2); }

.day-num {
  font-size: 0.82rem;
  font-weight: 600;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}

.day-entry {
  font-size: 0.62rem;
  line-height: 1.35;
  text-align: center;
  width: 100%;
}
.day-entry .odo    { color: var(--accent2); font-weight: 600; }
.day-entry .time   { color: #7c3aed; }
.day-entry .fuel-c { color: var(--success); }
.day-entry .fuel-p { color: #b06000; }

/* ── Summary ── */
.summary {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.summary h2 {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-item {
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border: 1px solid;
}

.summary-item:nth-child(1) {
  background: var(--accent2l);
  border-color: #a8c7fa;
}
.summary-item:nth-child(2) {
  background: var(--successbg);
  border-color: var(--successbd);
}
.summary-item:nth-child(3) {
  background: var(--warningbg);
  border-color: var(--warningbd);
}

.summary-item .label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; }
.summary-item .value { font-size: 1.35rem; font-weight: 800; }
.summary-item:nth-child(1) .value { color: var(--accent2); }
.summary-item:nth-child(2) .value { color: var(--success); }
.summary-item:nth-child(3) .value { color: #b06000; }
.summary-item .unit { font-size: 0.7rem; color: var(--text-muted); margin-left: 2px; }

/* ── Entry list ── */
.entries-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.entries-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  gap: 10px;
}

.entries-header h2 {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  flex: 1;
}

.entries-col-labels {
  display: grid;
  grid-template-columns: 90px 1fr 58px 58px;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.admin-col-labels {
  grid-template-columns: 90px 80px 1fr 58px 58px;
}

.col-label { text-align: right; }

.entry-row {
  display: grid;
  grid-template-columns: 90px 1fr 58px 58px;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.12s;
}

.entry-row.admin-row {
  grid-template-columns: 90px 80px 1fr 58px 58px;
}

.entry-row:last-child { border-bottom: none; }
.entry-row:hover { background: var(--card); }

.e-date      { color: var(--text-muted); font-size: 0.78rem; }
.e-user      { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-main      { display: flex; flex-direction: column; gap: 1px; }
.e-odo       { color: var(--accent2); font-weight: 700; }
.e-time      { color: #7c3aed; font-size: 0.72rem; }
.e-dist      { color: var(--text-muted); font-size: 0.72rem; }
.e-vehicle   { color: var(--text-muted); font-size: 0.72rem; }
.e-fuel-c    { color: var(--success); text-align: right; }
.e-fuel-p    { color: #b06000; text-align: right; }

.no-entries {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Switch mode button ── */
.btn-switch {
  color: var(--accent2);
  border-color: var(--accent2);
  font-weight: 700;
  background: var(--card);
}
.btn-switch:hover { background: var(--accent2); color: #fff; }

/* ── CSV button ── */
.btn-csv {
  color: var(--success);
  border-color: var(--successbd);
  font-weight: 700;
  background: var(--successbg);
}
.btn-csv:hover { background: var(--success); color: #fff; border-color: var(--success); }

/* ── Excel button ── */
.btn-xlsx {
  color: #b06000;
  border-color: var(--warningbd);
  font-weight: 700;
  background: var(--warningbg);
}
.btn-xlsx:hover { background: var(--warning); color: #fff; border-color: var(--warning); }

/* ── Holiday toggle ── */
.holiday-row {
  background: var(--card);
  border-radius: 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
}

.holiday-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text);
}

.holiday-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent2);
}

#entry-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.15s;
}

#entry-input-wrap.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── 休 マーク (calendar cell) ── */
.day-entry .holiday-mark {
  display: inline-block;
  background: var(--text-muted);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-top: 2px;
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-wide { max-width: 480px; }

.modal-header {
  background: var(--accent2);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 { font-size: 1rem; font-weight: 700; color: #fff; }

.modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: #fff; }

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* モーダル内の中間ラッパー（vehicle-list-view / vehicle-form-view）もflexコンテナにする */
#vehicle-list-view,
#vehicle-form-view {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ── Form fields ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.required { color: var(--accent); }

.field input, .field textarea {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 9px 12px;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.field textarea { resize: vertical; min-height: 68px; }
.field input[type="number"] { -moz-appearance: textfield; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.field select.select-field {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 9px 12px;
  font-family: inherit;
  width: 100%;
  cursor: pointer;
}

.field select.select-field:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

/* ── Plate (ナンバー) grid ── */
.plate-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr 1.3fr;
  gap: 6px;
  align-items: center;
}

.plate-grid input {
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  padding: 9px 6px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.plate-grid input:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.plate-num { letter-spacing: 0.1em; }

/* ── Time picker ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.time-picker {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-select {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 9px 4px 9px 10px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s;
  text-align: center;
  min-width: 0;
}

.time-select:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.time-colon {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
  margin-bottom: 1px;
}

.btn-now {
  flex-shrink: 0;
  background: var(--accent2l);
  border: 1.5px solid var(--accent2);
  color: var(--accent2);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.btn-now:hover { background: var(--accent2); color: #fff; }

.prev-odo { font-size: 0.74rem; color: var(--text-muted); }
.prev-odo span { color: var(--accent2); font-weight: 600; }

.modal-footer {
  padding: 14px 20px 18px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Buttons ── */
.btn {
  flex: 1;
  padding: 11px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
}

.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent2); color: #fff; box-shadow: 0 2px 6px rgba(26,115,232,0.3); }
.btn-primary:hover { opacity: 0.88; }
.btn-danger  { background: var(--surface); border: 1.5px solid var(--accent); color: var(--accent); }
.btn-danger:hover  { background: var(--accent); color: #fff; }
.btn-cancel  { background: var(--surface); border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-cancel:hover  { background: var(--bg); }
.btn-success { background: var(--surface); border: 1.5px solid var(--success); color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-outline { background: var(--surface); border: 1.5px solid var(--accent2); color: var(--accent2); }
.btn-outline:hover { background: var(--accent2l); }
.btn-sm { font-size: 0.78rem; padding: 5px 10px; min-height: unset; border-radius: 6px; }

.btn-lg {
  font-size: 1.02rem;
  padding: 13px 16px;
  flex: 2;
}

/* ── Vehicle list ── */
.vehicle-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.vehicle-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.vehicle-item:last-child { border-bottom: none; }
.vehicle-item.active-vehicle { background: var(--accent2l); }

.vehicle-item-info { flex: 1; min-width: 0; }

.vehicle-item-label {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-badge {
  font-size: 0.65rem;
  background: var(--accent2);
  color: #fff;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 700;
}

.vehicle-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-sm {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  font-weight: 600;
}

.btn-sm:hover { background: var(--bg); color: var(--text); }
.btn-sm.danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.empty-vehicles {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 500px) {
  /* Header をコンパクトに */
  header { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  header h1 { font-size: 0.9rem; }
  .header-sub { font-size: 0.62rem; }
  .header-icon { font-size: 1.15rem; }
  .btn-header { padding: 4px 7px; font-size: 0.7rem; }
  .btn-icon   { padding: 4px 6px; font-size: 0.9rem; }
  .vehicle-select { max-width: 100%; flex-basis: 100%; order: 99; font-size: 0.78rem; }

  main { padding: 12px 10px; }

  /* Calendar */
  .cal-day { min-height: 60px; padding: 3px 2px; }
  .day-num { font-size: 0.78rem; width: 22px; height: 22px; }
  .day-entry { font-size: 0.56rem; }
  .calendar-header span { padding: 6px 2px; font-size: 0.7rem; }

  /* Summary */
  .summary { padding: 12px; }
  .summary-item { padding: 10px 6px; }
  .summary-item .value { font-size: 1.0rem; }
  .summary-item .label { font-size: 0.65rem; }

  /* Entry list */
  .entry-row { grid-template-columns: 70px 1fr 50px 50px; font-size: 0.76rem; padding: 9px 10px; gap: 6px; }
  .entry-row.admin-row { grid-template-columns: 64px 60px 1fr 44px 44px; }
  .entries-col-labels { grid-template-columns: 70px 1fr 50px 50px; padding: 0 10px 6px; }
  .admin-col-labels { grid-template-columns: 64px 60px 1fr 44px 44px; }

  /* Month nav */
  .month-nav { gap: 12px; margin-bottom: 12px; }
  .month-label { font-size: 1.1rem; min-width: 110px; }
  .month-nav button { width: 36px; height: 36px; font-size: 1.1rem; }

  /* Filters & modal */
  .admin-filters { padding: 10px; gap: 8px; }
  .filter-select { min-width: 90px; font-size: 0.8rem; padding: 6px 8px; }
  /* 開始・終了時刻を1列に縦並びに */
  .field-row { grid-template-columns: 1fr; gap: 10px; }
  .time-picker { gap: 6px; }
  .time-select { font-size: 0.95rem; padding: 8px 6px; }
  .btn-now { flex-shrink: 0; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }
}

@media (max-width: 360px) {
  .entry-row { grid-template-columns: 68px 1fr 46px; }
  .entries-col-labels { grid-template-columns: 68px 1fr 46px; }
  .entry-row.admin-row { grid-template-columns: 68px 1fr 46px; }
  .admin-col-labels { grid-template-columns: 68px 1fr 46px; }
  .e-fuel-p { display: none; }
}

/* ── User Management Modal ── */
.usermgmt-section { padding: 4px 0 8px; }
.usermgmt-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.usermgmt-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.usermgmt-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* 事前登録 */
.invite-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.invite-email-field {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.88rem;
  font-family: inherit;
}
.invite-email-field:focus { outline: none; border-color: var(--accent2); }
.invite-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--warningbg);
  border: 1px solid var(--warningbd);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.86rem;
}
.invite-empty {
  color: var(--text-muted);
  font-size: 0.84rem;
  padding: 4px 0;
  list-style: none;
}

/* ユーザー行 */
.usermgmt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.usermgmt-row:last-child { border-bottom: none; }
.usermgmt-row.suspended { opacity: 0.55; background: #fafafa; }

.usermgmt-info {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.usermgmt-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}
.usermgmt-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.usermgmt-email {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.usermgmt-badges {
  display: flex;
  gap: 4px;
  align-items: center;
}
.role-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.role-admin { background: #e8f0fe; color: var(--accent2); border: 1px solid #c5d9fc; }
.role-user  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.status-suspended { background: #fce8e6; color: var(--accent); border: 1px solid #f5c6c2; }

.usermgmt-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 12px 0;
}
.error-text {
  color: var(--accent);
  font-size: 0.88rem;
  padding: 12px 0;
}

@media (max-width: 500px) {
  .usermgmt-row { flex-direction: column; align-items: flex-start; }
  .usermgmt-actions { width: 100%; justify-content: flex-end; }
}
