/* ============================================================
   RegalCast Management — Global Stylesheet v2
   Design: Apple HIG / Material Design 3
   Primary: #2563EB (Blue)  |  Base: White / Gray scale
   Fonts: Inter + Noto Sans JP + DM Mono
   ============================================================ */

:root {
  /* ── Base ── */
  --bg:       #F8FAFC;
  --surface:  #FFFFFF;
  --surface2: #F1F5F9;

  /* ── Border ── */
  --border:   #E2E8F0;

  /* ── Text ── */
  --ink:  #0F172A;
  --ink2: #334155;
  --ink3: #94A3B8;

  /* ── Semantic Colors ── */
  --accent:  #EF4444;   /* danger / alert / red */
  --accent2: #059669;   /* success / positive / green */
  --blue:    #2563EB;   /* primary action */
  --warn:    #D97706;   /* warning / orange */
  --gold:    #B45309;

  /* ── Shadows ── */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.05);
  --shadow:       0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 20px -4px rgba(37,99,235,0.14), 0 4px 8px -2px rgba(0,0,0,0.06);

  /* ── Radius ── */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   LOGIN SCREEN — Apple HIG style
   ============================================================ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #EFF6FF 0%, #F8FAFC 45%, #F0FDF4 100%);
}

.login-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 48px 40px 44px;
  width: 400px;
  max-width: 95vw;
  box-shadow:
    0 0 0 1px var(--border),
    0 8px 24px rgba(15,23,42,0.08),
    0 24px 56px rgba(15,23,42,0.07);
}

/* Logo mark — circular monogram */
.login-logomark {
  width: 56px;
  height: 56px;
  background: var(--blue);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
  margin: 0 auto 20px;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}

.login-logo {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
  text-align: center;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: var(--ink3);
  text-align: center;
  margin-bottom: 36px;
  letter-spacing: 0.3px;
  font-weight: 400;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  margin-top: 4px;
  letter-spacing: 0.2px;
}
.login-btn:hover  { background: #1D4ED8; }
.login-btn:active { transform: scale(0.97); }

.login-error {
  font-size: 12px;
  margin-top: 12px;
  min-height: 18px;
  text-align: center;
  color: var(--accent);
}

.login-reset {
  font-size: 12px;
  color: var(--ink3);
  text-align: center;
  margin-top: 14px;
  cursor: pointer;
  transition: color 0.15s;
}
.login-reset:hover { color: var(--blue); text-decoration: underline; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app-screen { display: none; flex-direction: column; min-height: 100vh; }

/* ── Top Bar (PC) — white surface ── */
.top-bar {
  background: var(--surface);
  color: var(--ink);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; color: var(--ink); }
.brand span { color: var(--blue); }
.brand sub  { font-size: 9px; font-weight: 400; letter-spacing: 1.5px; opacity: .4; display: block; }

.top-right { display: flex; align-items: center; gap: 12px; }
.user-info  { text-align: right; }
.user-info .uname { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-info .urole { font-size: 11px; color: var(--ink3); font-family: 'DM Mono', monospace; }

.logout-btn {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink2);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}
.logout-btn:hover  { background: var(--accent); border-color: var(--accent); color: #fff; }
.logout-btn:active { transform: scale(0.97); }

/* ============================================================
   NAVIGATION TABS — PC
   ============================================================ */
.nav-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 20px;
  flex-shrink: 0;
  overflow: visible;
}

.tab {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  color: var(--ink3);
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}
.tab:hover  { color: var(--ink2); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

/* ── Tab Groups with Dropdowns ── */
.tab-group {
  position: relative;
  flex-shrink: 0;
}
.tab-group-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ink3);
  border-bottom: 2.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  height: 100%;
  box-sizing: border-box;
}
.tab-group-header:hover { color: var(--ink2); }
.tab-group.active > .tab-group-header { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tab-group-arrow { font-size: 9px; opacity: 0.7; transition: transform 0.15s; }
.tab-group:hover .tab-group-arrow { transform: rotate(180deg); }

.tab-group-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
  min-width: 160px;
  z-index: 200;
  padding: 4px 0;
}
.tab-group:hover .tab-group-dropdown { display: block; }

.tab-dropdown-item {
  padding: 10px 16px !important;
  border-bottom: none !important;
  display: block !important;
  border-radius: 0 !important;
  font-size: 13px;
}
.tab-dropdown-item:hover { background: var(--surface2); color: var(--ink1); }
.tab-dropdown-item.active { background: rgba(42,82,152,0.07); color: var(--blue); font-weight: 600; }

/* ── Tab content fade-in ── */
.view { display: none; }
.view.active { display: block; animation: viewFadeIn 0.18s ease; }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CONTENT
   ============================================================ */
.content { flex: 1; padding: 24px 28px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}

.kpi-num   { font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -1px; }
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink3);
  margin-top: 5px;
  font-family: 'DM Mono', monospace;
}
.kpi-clickable { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.kpi-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi-hint {
  font-size: 9px;
  color: var(--ink3);
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink3);
  font-family: 'DM Mono', monospace;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   TABLE
   ============================================================ */
.tbl-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.tbl-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.tbl-title  { font-size: 13px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--surface2); }
th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink3);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: 'DM Mono', monospace;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F8FAFC; }

/* ============================================================
   BADGES & CHIPS
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
}
.badge-todo   { background: #F1F5F9; color: var(--ink3); }
.badge-doing  { background: #EFF6FF; color: var(--blue); }
.badge-done   { background: #ECFDF5; color: var(--accent2); }
.badge-leader { background: #FFFBEB; color: #92400E; }

.member-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--ink2);
}

.mini-btn {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink2);
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}
.mini-btn:hover  { background: var(--ink); color: #fff; border-color: var(--ink); }
.mini-btn:active { transform: scale(0.97); }

.add-btn {
  padding: 8px 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.add-btn:hover  { background: #1D4ED8; }
.add-btn:active { transform: scale(0.97); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.prog-wrap  { display: flex; align-items: center; gap: 8px; }
.prog-bar   { height: 5px; border-radius: 3px; background: var(--surface2); flex: 1; min-width: 60px; overflow: hidden; }
.prog-fill  { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.prog-label { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--ink3); width: 32px; text-align: right; }
.deadline-warn { color: var(--accent); font-weight: 600; }

/* ============================================================
   MODAL — Slide-up + backdrop blur
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.40);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 520px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  animation: modalSlideUp 0.2s ease;
  box-shadow: 0 20px 50px rgba(15,23,42,0.16), 0 4px 12px rgba(15,23,42,0.08);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
@keyframes modalSlideUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -0.2px;
}
.modal-close {
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  color: var(--ink3);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--surface2); color: var(--ink); }

/* ── Form ── */
.form-row { margin-bottom: 14px; }
.form-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink3);
  margin-bottom: 5px;
  display: block;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  padding: 9px 18px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary       { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1D4ED8; }
.btn-secondary     { background: var(--surface2); color: var(--ink2); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ============================================================
   ATTENDANCE
   ============================================================ */
.att-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.att-action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.att-action-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.att-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}
.att-btn:active    { transform: scale(0.97); }
.att-btn-in        { background: var(--accent2); color: #fff; }
.att-btn-in:hover  { background: #047857; }
.att-btn-out       { background: var(--blue); color: #fff; }
.att-btn-out:hover { background: #1D4ED8; }

.att-status-card { padding: 14px; background: var(--surface2); border-radius: var(--r-sm); }
.att-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: none; }
.att-label { font-size: 12px; color: var(--ink3); }
.att-time  { font-size: 17px; font-weight: 700; font-family: 'DM Mono', monospace; color: var(--ink3); }
.att-time.recorded { color: var(--accent2); }

/* ============================================================
   SHIFT CALENDAR
   ============================================================ */
.shift-controls { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.shift-cal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.shift-cal-header  { display: none; }
.shift-cal-dayname { display: none; }
.shift-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.shift-cal-cell {
  min-height: 76px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 5px;
  transition: background 0.1s;
}
.shift-cal-cell.empty { background: var(--surface2); }
.shift-cal-cell.today { background: rgba(37,99,235,0.04); }
.shift-cal-num { font-size: 12px; font-weight: 600; margin-bottom: 4px; }

.shift-chip {
  font-size: 9px;
  background: rgba(37,99,235,0.10);
  color: var(--blue);
  border-radius: 4px;
  padding: 2px 5px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shift-chip-off  { background: rgba(239,68,68,0.10); color: var(--accent); }
.shift-chip-mine { cursor: pointer; border: 1px dashed var(--blue); transition: opacity 0.15s; }
.shift-chip-mine:hover { opacity: 0.7; }
.shift-chip-edit { cursor: pointer; border: 1px dashed rgba(255,255,255,0.5); transition: opacity 0.15s; }
.shift-chip-edit:hover { opacity: 0.8; border-style: solid; }

/* ============================================================
   MONTH PICKER
   ============================================================ */
.month-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.month-row label { font-size: 11px; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.6px; font-family: 'DM Mono', monospace; }

/* ============================================================
   FILTER BUTTONS (PJ / Task / Alert)
   ============================================================ */
.pj-filter-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink3);
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}
.pj-filter-btn:hover  { background: var(--surface2); color: var(--ink); }
.pj-filter-btn:active { transform: scale(0.97); }
.pj-filter-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ============================================================
   NOTIFICATIONS / BANNERS
   ============================================================ */
#notif-banner { margin-bottom: 16px; display: none; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r);
  margin-bottom: 10px;
}
.notif-error { background: #FEF2F2; border: 1px solid #FECACA; border-left: 4px solid var(--accent); }
.notif-warn  { background: #FFFBEB; border: 1px solid #FDE68A; border-left: 4px solid var(--warn); }
.notif-icon  { font-size: 20px; flex-shrink: 0; line-height: 1; }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.notif-list  { display: flex; flex-wrap: wrap; gap: 6px; }
.notif-chip  { font-size: 11px; background: rgba(0,0,0,0.06); padding: 2px 8px; border-radius: 100px; }

.notif-badge {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 17px;
  height: 17px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
}
.tab { position: relative; }

/* ============================================================
   GANTT CHART
   ============================================================ */
.g-label-th  { width:180px;min-width:180px;position:sticky;left:0;background:var(--surface2);z-index:3;padding:8px 12px;font-size:10px;text-align:left;border-right:2px solid var(--border);border-bottom:1px solid var(--border);color:var(--ink3);text-transform:uppercase;letter-spacing:1px;font-family:'DM Mono',monospace; }
.g-month-th  { background:var(--ink);color:#fff;padding:6px 4px;text-align:center;font-size:11px;font-weight:600;border-right:1px solid rgba(255,255,255,.12);border-bottom:1px solid var(--border); }
.g-day-th    { min-width:26px;width:26px;padding:5px 2px;text-align:center;font-size:10px;font-family:'DM Mono',monospace;color:var(--ink3);background:var(--surface2);border-right:1px solid var(--border);border-bottom:1px solid var(--border);font-weight:500; }
.g-today-col { background:rgba(37,99,235,.08) !important;color:var(--blue) !important;font-weight:700 !important; }
.g-label-td  { position:sticky;left:0;background:var(--surface);z-index:2;border-right:2px solid var(--border);border-bottom:1px solid var(--border);padding:7px 12px;min-width:180px; }
.g-cell      { min-width:26px;width:26px;height:36px;border-right:1px solid rgba(226,232,240,.4);border-bottom:1px solid var(--border);background:var(--surface);vertical-align:middle; }
.g-row:hover .g-label-td, .g-row:hover .g-cell { background:var(--surface2) !important; }
.gantt-legend      { display:flex;gap:16px;flex-wrap:wrap;padding:12px 16px;border-top:1px solid var(--border);font-size:11px;color:var(--ink3); }
.gantt-legend-item { display:flex;align-items:center;gap:6px; }

/* ============================================================
   REPORTS / ALERTS
   ============================================================ */
.report-admin-tab, .alert-cat-tab {
  padding: 10px 16px;
  border: none;
  border-bottom: 2.5px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink3);
  transition: all 0.15s;
  margin-bottom: -2px;
  white-space: nowrap;
  font-family: inherit;
}
.report-admin-tab.active, .alert-cat-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.report-admin-tab:hover, .alert-cat-tab:hover    { color: var(--ink2); }

.alert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.alert-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.alert-card[data-cat="motivation"] { border-left-color: var(--blue); }
.alert-card[data-cat="irregular"]  { border-left-color: var(--warn); }
.alert-card[data-cat="bug"]        { border-left-color: var(--accent); }
.alert-card[data-cat="other"]      { border-left-color: var(--accent2); }
.alert-card[data-status="未対応"]  { background: #FFFBEB; }

/* ============================================================
   MENTAL WEATHER
   ============================================================ */
.mental-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 18px;
  gap: 3px;
  transition: all 0.15s;
  background: var(--surface);
  min-width: 46px;
}
.mental-btn div { font-size: 9px; color: var(--ink3); font-family: 'DM Mono', monospace; text-align: center; white-space: nowrap; }
.mental-btn:has(input:checked), .mental-btn.selected                        { border-color: var(--blue);    background: rgba(37,99,235,.08);  box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.mental-btn:has(input[value="雨"]:checked),   .mental-btn.selected[data-val="雨"]   { border-color: var(--blue);    background: rgba(37,99,235,.10); }
.mental-btn:has(input[value="豪雨"]:checked),  .mental-btn.selected[data-val="豪雨"]  { border-color: #6366F1;        background: rgba(99,102,241,.12); }
.mental-btn:has(input[value="雷"]:checked),   .mental-btn.selected[data-val="雷"]   { border-color: var(--warn);    background: rgba(217,119,6,.10); }
.mental-btn:has(input[value="嵐"]:checked),   .mental-btn.selected[data-val="嵐"]   { border-color: #7C3AED;        background: rgba(124,58,237,.10); }
.mental-btn:has(input[value="天災"]:checked),  .mental-btn.selected[data-val="天災"]  { border-color: var(--accent);  background: rgba(239,68,68,.08); }
.mental-btn:has(input[value="快晴"]:checked),  .mental-btn.selected[data-val="快晴"]  { border-color: var(--accent2); background: rgba(5,150,105,.08); }
.mental-btn:has(input[value="曇り"]:checked),  .mental-btn.selected[data-val="曇り"]  { border-color: var(--ink3);    background: rgba(148,163,184,.12); }

/* ============================================================
   MOBILE CARDS
   ============================================================ */
.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.m-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.empty { text-align: center; padding: 36px; color: var(--ink3); font-size: 13px; }

/* ============================================================
   MOBILE LAYOUT
   ============================================================ */
.mobile-header {
  display: none;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
}

.mobile-content { display: none; padding-top: 64px; }

.mobile-view { display: none !important; }
.mobile-view.active {
  display: block !important;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: calc(100vh - 64px);
  animation: viewFadeIn 0.18s ease;
}

/* ── Bottom Navigation ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  z-index: 50;
  padding: 0 0 env(safe-area-inset-bottom);
}
.mobile-nav-inner { display: flex; flex-wrap: wrap; justify-content: center; }

.mnav-item {
  flex: 0 0 auto;
  width: 18%;
  max-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 9px 4px 7px;
  cursor: pointer;
  color: var(--ink3);
  transition: color 0.15s;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.mnav-item.active { color: var(--blue); }
.mnav-icon  { font-size: 20px; line-height: 1; }
.mnav-label { font-size: 9px; letter-spacing: 0.5px; text-transform: uppercase; font-family: 'DM Mono', monospace; }

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: calc(155px + 12px + env(safe-area-inset-bottom));
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,0.40);
  z-index: 45;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.15s;
}
.fab:hover  { box-shadow: 0 6px 20px rgba(37,99,235,0.50); }
.fab:active { transform: scale(0.92); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .top-bar, .nav-tabs, .content { display: none !important; }
  .mobile-header  { display: flex !important; flex-direction: column; }
  .mobile-content { display: block !important; }
  .mobile-nav     { display: flex !important; }
  .fab            { display: flex !important; }
  #login-screen .login-box { padding: 32px 24px; }
}
@media (min-width: 641px) {
  .mobile-header, .mobile-content, .mobile-nav, .fab { display: none !important; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink3); }

/* ============================================================
   SELECT / OPTGROUP
   ============================================================ */
optgroup        { font-weight: 600; color: var(--ink2); }
optgroup option { font-weight: 400; color: var(--ink); }

/* ============================================================
   MYSHIFT CALENDAR interactions
   ============================================================ */
#myshift-calendar [onclick], #myshift-calendar-m [onclick] { -webkit-tap-highlight-color: transparent; }
#myshift-calendar [onclick]:hover, #myshift-calendar-m [onclick]:hover { filter: brightness(.95); transform: scale(.97); }

/* ============================================================
   TOAST NOTIFICATIONS — slide in from right
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 13px 20px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastSlideIn 0.2s ease;
  max-width: 320px;
  pointer-events: all;
}
@keyframes toastSlideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   ALLIANCE SCREEN
   ============================================================ */
#alliance-screen { display: none; flex-direction: column; min-height: 100vh; background: var(--bg); }

/* ============================================================
   MOBILE ATTENDANCE — 出退勤タブ特化スタイル
   ============================================================ */

/* 打刻カード */
.m-att-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
}

/* 大ボタン（出退勤） */
.m-att-btn-big {
  width: 100%;
  min-height: 68px;
  border: none;
  border-radius: var(--r);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.m-att-btn-big:active { transform: scale(0.97); }
.att-btn-in.m-att-btn-big  { box-shadow: 0 4px 14px rgba(5,150,105,0.30); }
.att-btn-out.m-att-btn-big { box-shadow: 0 4px 14px rgba(37,99,235,0.30); }

/* メンタル天気セクション */
.m-mental-section {
  background: linear-gradient(135deg, rgba(37,99,235,0.04), rgba(5,150,105,0.04));
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: var(--r);
  padding: 14px 12px;
  margin-bottom: 16px;
}
.m-mental-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.required-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.m-mental-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
/* メンタル天気ボタンをモバイルで大きく */
.m-mental-grid .mental-btn {
  min-height: 60px;
  font-size: 22px;
  padding: 10px 4px;
  border-radius: var(--r-sm);
}
.m-mental-grid .mental-btn div {
  font-size: 10px;
  margin-top: 2px;
}

/* アコーディオン（<details>/<summary>） */
.m-accordion { margin-top: 4px; }
.m-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink2);
  list-style: none;
  user-select: none;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.m-accordion summary::-webkit-details-marker { display: none; }
.m-accordion summary:hover { background: var(--border); }
.m-accordion[open] > summary {
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: var(--surface2);
}
.m-accordion-chevron {
  font-size: 11px;
  color: var(--ink3);
  display: inline-block;
  transition: transform 0.2s ease;
}
.m-accordion[open] .m-accordion-chevron { transform: rotate(180deg); }

.m-accordion-body {
  padding: 16px;
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: var(--surface);
}

/* ============================================================
   MOBILE NAV — SVG アイコン
   ============================================================ */
.mnav-icon i,
.mnav-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  display: block;
}

/* 出退勤ナビアイテム：常に青系でハイライト */
.mnav-item.mnav-attendance {
  color: rgba(37,99,235,0.55);
}
.mnav-item.mnav-attendance.active {
  color: var(--blue);
}
.mnav-item.mnav-attendance .mnav-icon {
  background: rgba(37,99,235,0.10);
  border-radius: 12px;
  width: 42px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2px;
}
.mnav-item.mnav-attendance .mnav-icon i,
.mnav-item.mnav-attendance .mnav-icon svg {
  width: 24px;
  height: 24px;
}

/* ============================================================
   MOBILE UX — iOS自動ズーム防止・タップターゲット
   ============================================================ */
@media (max-width: 640px) {
  /* font-size 16px 以上でiOSのズームを防止 */
  .form-input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="time"],
  input[type="month"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }
  .login-input { font-size: 16px !important; }

  /* タップターゲット最低48px */
  .mini-btn,
  .pj-filter-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .mnav-item { min-height: 52px; }

  /* form-input のタップターゲット確保 */
  .form-input {
    min-height: 48px;
    padding: 12px 14px;
  }

  /* モバイルナビ高さ調整: JSで動的に設定するためCSSでは指定しない */
}
