/* ============================================================
   Daily Report DX — style.css
   Aesthetic: Industrial Clean  |  Main: #00b385
   Fonts: DM Sans (headings) + Noto Sans JP (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,700;9..40,800&family=Noto+Sans+JP:wght@400;500;700;800&display=swap');

/* ── Variables ──────────────────────────────────────────── */
:root {
  --main:       #00b385;
  --main-dark:  #008f6a;
  --main-light: #d1faf0;
  --main-bg:    #f0fdf8;
  --blue:       #00b385;
  --blue2:      #008f6a;
  --bg:         #f2f5f4;
  --card:       #ffffff;
  --text:       #0f1f18;
  --muted:      #5a7a6e;
  --line:       #d8eae4;
  --danger:     #dc2626;
  --ok:         #16a34a;
  --warn:       #b45309;
  --shadow-sm:  0 2px 8px rgba(0,50,35,.07);
  --shadow:     0 8px 28px rgba(0,50,35,.10);
  --shadow-lg:  0 18px 50px rgba(0,50,35,.13);
  --r-sm:       10px;
  --r:          16px;
  --r-lg:       22px;
}

/* ── Reset / Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  line-height: 1.7;
}
a { color: var(--main); text-decoration: none; }
a:hover { color: var(--main-dark); }
img { max-width: 100%; vertical-align: middle; }
p { margin: 0 0 12px; color: var(--muted); }
h1 {
  font-family: 'DM Sans', 'Noto Sans JP', sans-serif;
  font-size: clamp(22px, 4vw, 32px);
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.02em;
}
h2 {
  font-family: 'DM Sans', 'Noto Sans JP', sans-serif;
  font-size: 18px;
  margin: 28px 0 14px;
  color: var(--text);
  font-weight: 800;
}
small { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   PUBLIC FORM  (index.php / thanks.php)
   ══════════════════════════════════════════════════════════ */

.form-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.form-hero {
  background: linear-gradient(135deg, #00b385 0%, #006e52 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: 0 12px 36px rgba(0,100,70,.22);
  position: relative;
  overflow: hidden;
}
.form-hero::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  pointer-events: none;
}
.form-hero::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.form-hero span {
  display: inline-block;
  background: rgba(255,255,255,.22);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.form-hero h1 {
  margin: 8px 0 6px;
  font-size: clamp(22px, 4vw, 30px);
  color: #fff;
  letter-spacing: -.02em;
}
.form-hero p { color: rgba(255,255,255,.85); margin: 0; font-size: 14px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.form-card { padding: 28px; }

/* Fields */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 7px;
}
.field b {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

/* Inputs */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  padding: 12px 13px;
  font-size: 16px;
  min-height: 45px;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: auto;
  flex-shrink: 0;
  accent-color: var(--main);
  cursor: pointer;
  -webkit-appearance: auto;
  appearance: auto;
  border: none;
  padding: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300b385'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}
textarea { min-height: 120px; resize: vertical; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--main);
  box-shadow: 0 0 0 3px rgba(0,179,133,.16);
}
.readonly-box {
  background: var(--main-bg);
  border: 1.5px solid var(--main-light);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  font-weight: 700;
  color: var(--main-dark);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn, button.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid var(--main-light);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  padding: 11px 18px;
  line-height: 1.2;
  background: var(--main-bg);
  color: var(--main-dark);
  transition: background .15s, transform .1s, box-shadow .15s, border-color .15s, color .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--main-light); color: var(--main-dark); }

.btn.primary {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  background: var(--main);
  color: #fff;
  border: 2px solid var(--main);
  box-shadow: 0 4px 16px rgba(0,179,133,.28);
  letter-spacing: .02em;
}
.btn.primary:hover {
  background: var(--main-dark);
  border-color: var(--main-dark);
  box-shadow: 0 6px 22px rgba(0,179,133,.36);
  transform: translateY(-1px);
  color: #fff;
}
.btn.primary:active { transform: translateY(0); }

.btn.danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1.5px solid #fecaca;
}
.btn.danger:hover { background: #fee2e2; }

.mini-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
  border: none;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  text-decoration: none;
  line-height: 1.3;
}
.mini-btn:hover { background: #1a3828; color: #fff; }
.mini-btn.danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1.5px solid #fecaca;
}
.mini-btn.danger:hover { background: #fee2e2; }

/* Time */
.time-result {
  background: var(--main-bg);
  border: 1.5px solid var(--main-light);
  color: var(--main-dark);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 700;
}
.time-shortcuts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.time-shortcuts button {
  width: auto;
  min-height: auto;
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid var(--main-light);
  background: var(--main-bg);
  color: var(--main-dark);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .13s;
}
.time-shortcuts button:hover { background: var(--main-light); }

/* Check / Radio */
.check-list { display: grid; gap: 10px; }
.check-list label { font-weight: 500; display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* checkbox style is handled globally */
.radio-row { display: flex; gap: 20px; }
.radio-row label { font-weight: 500; display: flex; align-items: center; gap: 7px; cursor: pointer; }
/* radio style is handled globally */

.preview img {
  display: block; width: 120px; height: 90px; object-fit: cover;
  border-radius: 10px; margin: 8px 0; border: 1.5px solid var(--line);
}

.alert {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: var(--danger);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-weight: 600;
}
.alert ul { margin: 0; padding-left: 18px; }
.success {
  background: var(--main-bg);
  border: 1.5px solid var(--main-light);
  color: var(--main-dark);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-weight: 600;
}

.thanks { text-align: center; padding: 48px 24px; }

/* ── Combo ──────────────────────────────────────────────── */
.combo { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.combo input { min-width: 0; }
.combo-toggle {
  width: auto; min-height: auto;
  border: 1.5px solid var(--main-light);
  background: var(--main-bg);
  color: var(--main-dark);
  border-radius: var(--r-sm);
  padding: 0 14px;
  font-size: 13px; font-weight: 800; cursor: pointer; font-family: inherit;
  -webkit-appearance: none; appearance: none;
  transition: background .13s;
}
.combo-toggle:hover { background: var(--main-light); }
.combo-list {
  display: none; position: absolute; left: 0; right: 0;
  top: calc(100% + 6px); z-index: 20;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; padding: 6px;
}
.combo.is-open .combo-list { display: block; }
.combo-list button {
  display: block; width: 100%;
  -webkit-appearance: none; appearance: none;
  border: none; background: transparent; text-align: left;
  padding: 11px 13px; border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--text);
  cursor: pointer; transition: background .13s; line-height: 1.4;
}
.combo-list button:hover, .combo-list button:focus { background: var(--main-bg); color: var(--main-dark); outline: none; }
.combo-empty { padding: 12px 13px; color: var(--muted); font-size: 14px; }

.muted { color: var(--muted); font-size: 13px; }

/* ══════════════════════════════════════════════════════════
   ADMIN
   ══════════════════════════════════════════════════════════ */

.admin-body { background: var(--bg); }

.admin-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 54px;
}
.admin-header div { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.admin-header strong {
  font-family: 'DM Sans', 'Noto Sans JP', sans-serif;
  font-size: 16px; font-weight: 800; color: var(--main); white-space: nowrap;
}
.admin-header span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.admin-header nav { display: flex; gap: 2px; flex-wrap: wrap; }
.admin-header nav a {
  padding: 6px 10px; border-radius: 8px;
  color: var(--muted); font-weight: 700; font-size: 13px;
  transition: background .13s, color .13s; white-space: nowrap;
}
.admin-header nav a:hover { background: var(--main-bg); color: var(--main-dark); }

.admin-main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 56px; }
.admin-main h1 { margin-top: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%; background: var(--main); border-radius: 4px 0 0 4px;
}
.stat span {
  display: block; color: var(--muted);
  font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px;
}
.stat b {
  display: block; font-family: 'DM Sans', sans-serif;
  font-size: 34px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -.02em;
}

/* Menu grid */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.menu-grid a {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px; font-weight: 800; color: var(--text); font-size: 15px;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .12s; display: block;
}
.menu-grid a:hover { background: var(--main-bg); border-color: var(--main-light); transform: translateY(-2px); color: var(--main-dark); }

/* Filter */
.filter-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filter-form input:not([type="checkbox"]):not([type="radio"]),
.filter-form select {
  width: auto;
  min-width: 140px;
  padding: 9px 12px;
  font-size: 14px;
  min-height: auto;
}
.filter-form label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { border-bottom: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: middle; font-size: 14px; }
th {
  background: var(--main-bg); font-size: 12px; font-weight: 800;
  color: var(--main-dark); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7fdfb; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-grid div {
  background: var(--main-bg); border: 1px solid var(--main-light);
  border-radius: var(--r-sm); padding: 13px 14px;
}
.detail-grid span {
  display: block; color: var(--muted);
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px;
}
.detail-grid b { font-size: 15px; font-weight: 700; }

/* Photo */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.photo-grid img { width: 100%; height: 180px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); display: block; }

.admin-form { display: block; }
.nl { white-space: pre-wrap; font-size: 15px; line-height: 1.8; }
.inline { display: inline; }
.inline select { width: auto; min-width: 100px; min-height: auto; padding: 6px 28px 6px 9px; font-size: 13px; }
.url-input { font-size: 12px; min-width: 360px; }
.qr-card { text-align: center; }
.qr-card #qrcode { display: inline-block; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, #edfaf5 0%, #f4faf8 50%, #edfaf5 100%);
}
.login-card { width: min(420px, 100%); }
.login-card h1 { margin: 0 0 6px; }

/* ══════════════════════════════════════════════════════════
   スマホ：日報テーブル → カード型
   ══════════════════════════════════════════════════════════ */
.rfbtns{
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top:1.5em;
}  
.rfbtns a,
.rfbtns form{
  margin:0 0.5em;
} 
@media (max-width: 640px) {
  .table-wrap { border-radius: var(--r); overflow: visible; border: none; box-shadow: none; background: transparent; }

  table.admin-table { min-width: 0; display: block; }
  table.admin-table thead { display: none; }
  table.admin-table tbody { display: grid; gap: 12px; }

  table.admin-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  table.admin-table td {
    display: flex; flex-direction: column;
    padding: 10px 13px; border-bottom: 1px solid var(--line);
    border-right: none; font-size: 13px; white-space: normal; min-height: auto;
  }

  table.admin-table td::before {
    content: attr(data-label);
    display: block; font-size: 10px; font-weight: 800;
    color: var(--main-dark); letter-spacing: .08em;
    text-transform: uppercase; margin-bottom: 3px; opacity: .75;
  }

  table.admin-table td[data-label="作業内容"],
  table.admin-table td[data-label="操作"],
  table.admin-table td:last-child { grid-column: 1 / -1; }
  table.admin-table td:last-child { border-bottom: none; }
  /* 操作ボタンを横並びに */
  table.admin-table td[data-label="操作"] { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  table.admin-table td[data-label="操作"]::before { flex: 0 0 100%; }
  table.admin-table td[data-label="操作"] .mini-btn,
  table.admin-table td[data-label="操作"] form { flex-shrink: 0; }
  table.admin-table td[data-label="操作"] form .mini-btn { width: auto; }
}

/* ══════════════════════════════════════════════════════════
   Responsive (general)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .detail-grid, .photo-grid { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .admin-header { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 6px; }
  .admin-header div { width: 100%; }
  .admin-header nav { width: 100%; padding-bottom: 4px; }
  .admin-header nav a { padding: 7px 8px; font-size: 12px; }
  .admin-main { padding: 16px 14px 40px; }
  .form-wrap { padding: 14px 12px 40px; }
  .filter-form input:not([type="checkbox"]):not([type="radio"]),
  .filter-form select { width: 100%; min-height: 45px;}
  .filter-form label { width: 100%; }
  .stats { gap: 10px; }
}

@media (max-width: 480px) {
  .menu-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .combo { grid-template-columns: 1fr; }
  .combo-toggle { width: 100%; padding: 11px; }
  .combo-list { position: static; margin-top: 8px; }
  .combo:not(.is-open) .combo-list { display: none; }
}

/* ── mini-btn 左右余白 ──────────────────────────────────── */
.mini-btn + .mini-btn,
.mini-btn + form,
form + .mini-btn,
form + form { margin-left: 6px; }

/* ══════════════════════════════════════════════════════════
   スマホ：管理テーブル共通カード化
   admin-table クラスのないtableもカード化
   ══════════════════════════════════════════════════════════ */
input[type="month"]{
    width: 70% !important;
    max-width: 300px;
    margin-right: 0.5em;
    
  }
.filter-form input[type="month"]{
    width: auto !important;
    max-width: 100%;
}   
@media (max-width: 640px) {

  /* thead付きでないtable（th行がtbodyにある場合）の先頭tr非表示 */
  .table-wrap table:not(.admin-table) thead,
  .table-wrap table:not(.admin-table) tr:first-child:has(th) { display: none; }

  /* 全テーブルをカード化 */
  .table-wrap table:not(.admin-table) {
    min-width: 0;
    display: block;
  }
  .table-wrap table:not(.admin-table) tbody {
    display: grid;
    gap: 10px;
  }
  /* theadなしのtableはtbodyがないのでtrを直接グリッドに */
  .table-wrap table:not(.admin-table):not(:has(tbody)) {
    display: grid;
    gap: 10px;
  }
  .table-wrap table:not(.admin-table) tr:not(:first-child),
  .table-wrap table:not(.admin-table) tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }
  .table-wrap table:not(.admin-table) td {
    display: flex;
    flex-direction: column;
    padding: 10px 13px;
    border-bottom: 1px solid var(--line);
    border-right: none;
    font-size: 13px;
    white-space: normal;
  }
  .table-wrap table:not(.admin-table) td::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: var(--main-dark);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 3px;
    opacity: .75;
  }
  /* ID列は非表示（幅の節約） */
  .table-wrap table td[data-label="ID"] { display: none; }

  /* 操作列・名前列は全幅 */
  .table-wrap table td[data-label="操作"],
  .table-wrap table td[data-label="現場名"],
  .table-wrap table td[data-label="作業者名"],
  .table-wrap table td[data-label="項目"] { }

  .table-wrap table td:last-child { border-bottom: none; }

  /* 操作ボタン横並び */
  .table-wrap table td[data-label="操作"] {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .table-wrap table td[data-label="操作"]::before { flex: 0 0 100%; }
  .table-wrap table td[data-label="操作"] form { display: inline; margin: 0; }

  /* monthly.php の grid2（現場別・作業者別）を縦積みに */
  .grid2 .card.table-wrap { border-radius: var(--r-lg); }

  /* stats を2列維持（月次集計） */
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card{
    padding:1em;
  }
  .card.table-wrap{
    padding:0;
  }
  .card.table-wrap table{background: none;}
  .grid2 {
    grid-template-columns: 1fr;
  }
  
  .filter-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }
  .filter-form input:not([type="checkbox"]):not([type="radio"]){
    width: 48% !important;
  }
  .filter-form .flex{
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .filter-form select,
  .filter-form label{
    width: 48%;
  }
  
}
