/* LocoField — モバイルファースト。白・緑・グレー基調の信頼感あるSaaSデザイン。 */
:root {
  --green: #1f9d6b;
  --green-dark: #157a52;
  --green-light: #e8f6f0;
  --gray-900: #1a1f24;
  --gray-700: #3f4a52;
  --gray-500: #6b7680;
  --gray-300: #d3d9de;
  --gray-100: #f3f5f7;
  --white: #ffffff;
  --red: #d64545;
  --amber: #e0a106;
  --blue: #2f80ed;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* hidden 属性は常に優先（.auth-view 等の display 指定に上書きされないように） */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif;
  color: var(--gray-900);
  background: var(--gray-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-dark); }

.view { padding: 16px; max-width: 720px; margin: 0 auto; }

/* ---- 認証画面 ---- */
.auth-view { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.brand { text-align: center; }
.logo { font-size: 34px; font-weight: 800; color: var(--green); letter-spacing: -0.02em; }
.tagline { font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
.subtagline { color: var(--gray-500); font-size: 13px; margin: 0; }

/* ---- カード ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 17px; }

/* ---- フォーム ---- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1.5px solid var(--gray-300); border-radius: 10px; background: var(--white);
}
.field input:focus { outline: none; border-color: var(--green); }

/* ---- ボタン（大きめ・タップしやすく） ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 18px; font-size: 16px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer; min-height: 48px;
}
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:active { background: var(--green-dark); }
.btn-block { width: 100%; }
.row { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-700); }

/* ---- アプリヘッダ / コンテンツ / 下部ナビ ---- */
.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--white); border-bottom: 1px solid var(--gray-300);
}
.app-title { font-weight: 800; font-size: 18px; flex: 1; }
.app-content { padding-bottom: 24px; }

/* ---- 左サイドバー（ドロワー / 三本線で開閉） ---- */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
  width: 264px; max-width: 80vw;
  background: var(--white); border-right: 1px solid var(--gray-300);
  transform: translateX(-100%); transition: transform 0.22s ease;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}
.drawer.open { transform: translateX(0); }
.drawer-brand {
  font-size: 22px; font-weight: 800; color: var(--green);
  padding: 18px 20px; border-bottom: 1px solid var(--gray-300);
}
#drawer-nav { padding: 16px 8px 8px; overflow-y: auto; }
.drawer-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; border: none; background: none; cursor: pointer;
  font-size: 15px; font-weight: 700; color: var(--gray-700);
  border-radius: 10px; text-align: left;
}
.drawer-item span { font-size: 20px; width: 24px; text-align: center; }
.drawer-item.is-active { background: var(--green-light); color: var(--green-dark); }
.drawer-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, 0.4);
}
.menu-toggle { font-size: 22px; }

/* ---- 今日やること: 数値タイル ---- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.tile .num { font-size: 28px; font-weight: 800; color: var(--green); }
.tile .num.warn { color: var(--amber); }
.tile .num.alert { color: var(--red); }
.tile .lbl { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ---- リスト項目 ---- */
.list-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
}
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; font-size: 15px; }
.list-item .sub { color: var(--gray-500); font-size: 12px; }

/* ---- ステータスバッジ（色分け） ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge.green { background: var(--green-light); color: var(--green-dark); }
.badge.amber { background: #fdf3d7; color: #8a6400; }
.badge.red { background: #fbe3e3; color: #a32626; }
.badge.blue { background: #e4eefc; color: #1d5fc0; }
.badge.gray { background: var(--gray-100); color: var(--gray-500); }

/* ---- 汎用 ---- */
.muted { color: var(--gray-500); }
.small { font-size: 12px; }
.error { color: var(--red); font-size: 13px; }
.loading { text-align: center; color: var(--gray-500); padding: 40px 0; }
.section-head { font-size: 13px; font-weight: 700; color: var(--gray-700); margin: 18px 0 8px; }
.empty { text-align: center; color: var(--gray-500); padding: 30px 0; font-size: 14px; }
.disclaimer { font-size: 11px; color: var(--gray-500); background: var(--gray-100); padding: 10px 12px; border-radius: 10px; margin-top: 12px; }
.legal-links { text-align: center; }

/* 小さめボタン / 戻る / 危険 */
.btn.mini {
  padding: 8px 12px; min-height: auto; font-size: 13px; margin-left: 8px;
  background: var(--green-light); color: var(--green-dark);
}
.btn.mini.danger { background: #fbe3e3; color: #a32626; }
.back-btn {
  background: none; color: var(--gray-700); padding: 6px 0; min-height: auto;
  font-size: 14px; margin-bottom: 6px;
}
.section-head .btn.mini { float: right; }

/* 明細エディタ */
.li-row {
  display: grid;
  grid-template-columns: 1fr 64px 84px 78px 32px;
  gap: 6px; margin-bottom: 8px; align-items: center;
}
.li-row input, .li-row select {
  padding: 10px 8px; font-size: 14px; border: 1.5px solid var(--gray-300); border-radius: 8px; width: 100%;
}
.li-row .li-del {
  background: #fbe3e3; color: #a32626; border: none; border-radius: 8px; height: 38px; font-size: 16px; cursor: pointer;
}

/* ---- 現場トーク ---- */
.chat-wrap { padding-bottom: 76px; }
.msg { max-width: 80%; margin: 8px 0; padding: 10px 12px; border-radius: 14px; background: var(--white); box-shadow: var(--shadow); }
.msg.mine { margin-left: auto; background: var(--green-light); }
.msg.pinned { border: 1.5px solid var(--amber); }
.msg .meta { font-size: 11px; color: var(--gray-500); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.msg .text { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg .acts { margin-top: 4px; display: flex; gap: 10px; }
.msg .acts button { background: none; border: none; color: var(--gray-500); font-size: 12px; cursor: pointer; padding: 0; }
.chat-input {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; gap: 8px; padding: 10px 12px; background: var(--white); border-top: 1px solid var(--gray-300);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.chat-input textarea { flex: 1; resize: none; padding: 10px 12px; border: 1.5px solid var(--gray-300); border-radius: 18px; font-size: 15px; max-height: 100px; }
.chat-input button { border: none; background: var(--green); color: #fff; border-radius: 18px; padding: 0 18px; font-weight: 700; cursor: pointer; }

.rep-photo { display: block; padding: 7px 0; font-size: 14px; }
