/* まるしん勤怠 - タヌポータル風スタイル(社内Webアプリ規約準拠) */

:root {
  --orange: #E34601;
  --purple: #542494;
  --gold: #CC9401;
  --green: #2DA253;
  --cream: #F6EFDB;
  --paper: #FFFBF2;
  --ink: #4a3c1f;
  --ink-soft: #8a7a54;
  --border: #e6d9ae;
  --danger-bg: #FCEAE6;
  --danger-border: #E9B3A1;
  --danger-ink: #9C2A0E;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "M PLUS Rounded 1c", "Yu Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    repeating-linear-gradient(45deg, rgba(204,148,1,0.05) 0, rgba(204,148,1,0.05) 2px, transparent 2px, transparent 26px),
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.55), transparent 55%);
  display: flex;
  justify-content: center;
  padding: 20px 12px 40px;
}

.screen {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--cream) 100%);
  border-radius: 42px;
  border: 6px solid #ffffff;
  box-shadow:
    0 24px 60px rgba(120, 90, 20, 0.18),
    0 2px 0 rgba(255,255,255,0.9) inset;
  padding: 6px 6px 24px;
  position: relative;
  overflow: hidden;
}

.screen::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; /* insetの旧ブラウザ用フォールバック(Chrome86以前/Safari14未満) */
  inset: 0;
  background-image: radial-gradient(rgba(140, 110, 40, 0.07) 1.6px, transparent 1.6px);
  background-size: 22px 22px;
  pointer-events: none;
}

main {
  position: relative;
}

.hidden {
  display: none !important;
}

/* ---------- ヘッダー共通 ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px 20px 8px;
}

.app-header .mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 3px 0 rgba(0,0,0,0.12);
}

.app-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.02em;
}

/* ---------- ログイン画面 ---------- */

#screen-login .subtitle {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 0 20px 22px;
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 24px;
  margin: 0 18px 18px;
  padding: 22px 20px 26px;
  box-shadow: 0 8px 0 rgba(120,90,20,0.06);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  font-family: inherit;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 14px 12px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--ink);
  min-height: 56px;
}

.field input:focus {
  outline: none;
  border-color: var(--green);
}

.field .hint {
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 6px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  min-height: 58px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.14);
  transition: transform 0.08s ease;
}

.btn:active {
  transform: scale(0.96) translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.14);
}

.btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.btn-primary { background: var(--green); }
.btn-secondary {
  background: var(--paper);
  color: var(--ink-soft);
  box-shadow: none;
  border: 2px solid var(--border);
  min-height: 46px;
  font-size: 0.85rem;
}
.btn-secondary:active { transform: scale(0.97); }

.link-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.82rem;
  text-align: center;
  text-decoration: underline;
  padding: 10px;
  cursor: pointer;
}

.error-box {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-border);
  color: var(--danger-ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 18px 16px;
  line-height: 1.5;
}

.info-box {
  background: #EAF3EC;
  border: 1.5px solid #BFE0C9;
  color: #1f6b3a;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.82rem;
  margin: 0 18px 16px;
  line-height: 1.5;
}

/* ---------- 打刻画面 ---------- */

.employee-card {
  margin: 4px 18px 18px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 8px 0 rgba(120,90,20,0.06);
}

.employee-card .name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

.employee-card .store {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.clock {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.clock .time {
  font-size: 2.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1.1;
}

.clock .date {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.gps-note {
  margin: 0 20px 14px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

/* ---------- 位置情報ステータス(控えめ表示) ---------- */

.location-status {
  display: flex;
  justify-content: center;
  margin: 0 20px 6px;
}

.location-status-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  line-height: 1.6;
}

.location-status.ok .location-status-text {
  background: #EAF3EC;
  color: #1f6b3a;
}

.location-status.off .location-status-text {
  background: #EFEBDD;
  color: var(--ink-soft);
}

.punch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 18px 6px;
}

.punch-btn {
  min-height: 84px;
  border: none;
  border-radius: 22px;
  color: #fff;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.16);
  transition: transform 0.08s ease;
}

.punch-btn:active {
  transform: scale(0.94) translateY(3px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.16);
}

.punch-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.punch-btn .icon {
  font-size: 1.7rem;
  line-height: 1;
}

.punch-btn.clock_in { background: var(--green); }
.punch-btn.clock_out { background: var(--orange); }
.punch-btn.break_start { background: var(--gold); }
.punch-btn.break_end { background: var(--purple); }

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

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

.punch-error {
  margin: 14px 18px 4px;
}

/* ---------- 履歴 ---------- */

.history-section {
  margin: 20px 18px 6px;
}

.history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 2px 10px;
}

.history-title .leaf {
  width: 9px;
  height: 9px;
  border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
  background: var(--green);
  display: inline-block;
}

.history-list {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-item .dot.clock_in { background: var(--green); }
.history-item .dot.clock_out { background: var(--orange); }
.history-item .dot.break_start { background: var(--gold); }
.history-item .dot.break_end { background: var(--purple); }

.history-item .label {
  flex: 1;
  font-weight: 700;
  color: var(--ink);
}

.history-item .time {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-weight: 700;
}

.history-empty {
  padding: 18px 16px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- ログアウト ---------- */

.footer-actions {
  margin: 22px 18px 4px;
  text-align: center;
}

/* ---------- 打刻成功オーバーレイ ---------- */

.overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; /* insetの旧ブラウザ用フォールバック(Chrome86以前/Safari14未満) */
  inset: 0;
  background: rgba(74, 60, 31, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.overlay-card {
  background: var(--paper);
  border-radius: 28px;
  border: 6px solid #fff;
  padding: 36px 30px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  animation: pop-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.overlay-check {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.12);
}

.overlay-check svg {
  width: 40px;
  height: 40px;
}

.overlay-card .msg {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- レスポンシブ(PCブラウザ) ---------- */

@media (min-width: 640px) {
  body { padding: 40px 16px; }
  .screen { max-width: 480px; }
}

@media (max-width: 360px) {
  .clock .time { font-size: 2.2rem; }
  .punch-btn { min-height: 72px; font-size: 0.95rem; }
}
