:root {
  /* マイ現場 navy theme */
  --navy: #051230;        /* header / dark surfaces */
  --accent: #F466A1;      /* pink: primary CTA, active */
  --purple: #7A6EDC;      /* secondary buttons, tags */
  --bg: #F5F7FF;          /* soft white background */
  --card: #fff;
  --line: #dfe3f0;
  --text: #1b2340;
  --muted: #6b7290;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  font-size: 15px;
}
main { max-width: 960px; margin: 0 auto; padding: 12px; padding-bottom: 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px 14px; flex-wrap: wrap;
  background: var(--navy); color: #F5F7FF; padding: 8px 14px;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 60px; width: auto; display: block; }
.topbar nav {
  display: flex; align-items: center; flex-wrap: wrap;
  justify-content: flex-end; gap: 8px 14px;
}
.topbar nav a {
  color: #F5F7FF; text-decoration: none; opacity: .8; font-size: 14px;
  white-space: nowrap;
}
.topbar nav a i { margin-right: 3px; font-size: 13px; }
@media (max-width: 460px) {
  .brand img { height: 40px; }
  .topbar nav { gap: 6px 12px; }
  .topbar nav a { font-size: 12px; }
}
.topbar nav a.on {
  opacity: 1; font-weight: 700; color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
/* JA / EN language toggle */
.lang-switch { display: inline-flex; border: 1px solid rgba(245,247,255,.35);
  border-radius: 6px; overflow: hidden; }
.lang-switch a { margin: 0 !important; padding: 2px 7px; font-size: 12px; opacity: .7;
  border-bottom: none !important; }
.lang-switch a.on { background: var(--accent); color: #fff; opacity: 1; font-weight: 700; }
@media (max-width: 460px) { .lang-switch a { padding: 2px 5px; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; margin-bottom: 14px;
}
.site-footer {
  max-width: 960px; margin: 24px auto 0; padding: 16px 12px 24px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  justify-content: center; text-align: center;
  color: var(--muted); font-size: 13px;
}
.site-footer a { color: var(--purple); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* main / optional tag on plan items */
.prio { display: inline-block; float: right; margin-left: 6px; font-size: 11px;
  font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.prio-main { background: #fde8f0; color: #c2477e; border: 1px solid var(--accent); }
.prio-opt  { background: #eef0f7; color: var(--muted); border: 1px solid var(--line); }
h2 { font-size: 17px; margin: 4px 0 10px; }
h3 { font-size: 15px; margin: 8px 0 6px; }
.muted { color: var(--muted); font-size: 13px; }
.error { background: #fdeef0; color: #c25a6e; border: 1px solid #e8a2b0; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.ok    { background: #e8f5e9; color: #2e7d32; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }

/* "group not in the list? request it" callout on the schedule page */
.req-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #f3f0ff; border: 1px solid var(--purple); border-left: 4px solid var(--purple);
  border-radius: 10px; padding: 12px 14px; margin: 4px 0 12px;
}
.req-banner-text { flex: 1; min-width: 200px; font-size: 14px; font-weight: 600; color: #4a3fa8; }
.req-banner-text i { margin-right: 6px; }
.req-banner .btn { flex: none; }

input[type=text], input[type=url], input[type=date], input[type=time],
input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 60px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 3px; }

.btn {
  display: inline-block; border: none; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff; padding: 10px 16px; font-size: 14px;
  text-decoration: none; font-weight: 600;
}
.btn.secondary { background: #eee6ff; color: #4a3fa8; border: 1px solid var(--purple); }
.btn.danger { background: #fdeef0; color: #c25a6e; border: 1px solid #e8a2b0; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 120px; }

/* group chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px;
  background: #fff; font-size: 13px; user-select: none;
}
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.chip .dot { width: 22px; height: 22px; border-radius: 50%; }
.chip.off { opacity: .35; }

/* event list */
.ev {
  display: flex; gap: 10px; padding: 10px; border-radius: 8px;
  border: 1px solid var(--line); margin-bottom: 8px; background: #fff;
}
.ev .icon { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.ev .icon.dot { flex: none; }
.ev .body { flex: 1; min-width: 0; }
.ev .t { font-weight: 700; }
.ev .desc { font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 5.5em; overflow: hidden; }
.ev .gname { font-size: 12px; font-weight: 600; }

/* modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: none; align-items: flex-end; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  position: relative;
  background: #fff; width: 100%; max-width: 640px; max-height: 85vh;
  border-radius: 14px 14px 0 0; padding: 16px; overflow-y: auto;
}
@media (min-width: 700px) {
  .modal-bg { align-items: center; }
  .modal { border-radius: 14px; }
}
.modal h3 { margin-top: 0; padding-right: 32px; }
.modal-x {
  position: absolute; top: 8px; right: 10px; z-index: 1;
  background: none; border: none; padding: 2px 6px; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--muted);
}
.modal-x:hover { color: var(--text); }

/* plan detail */
.day-block { margin-bottom: 18px; }
.day-head {
  font-weight: 700; background: #f5f5f5; padding: 6px 10px; border-radius: 8px;
  margin-bottom: 8px;
}
.pi {
  border-left: 4px solid var(--accent); background: #fff; border-radius: 0 8px 8px 0;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding: 8px 10px; margin-bottom: 8px;
}
.pi .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.pi .note { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
details.editbox summary { cursor: pointer; font-size: 12px; color: var(--muted); }
/* a summary styled as a button (e.g. the prominent "edit plan" toggle) */
details.editbox summary.btn { display: inline-block; font-size: 13px; list-style: none; }
details.editbox summary.btn::-webkit-details-marker { display: none; }
details.plan-edit[open] summary.btn { margin-bottom: 8px; }

/* suggestion chips (parsed from event descriptions); tap to fill */
button.sugg {
  display: inline-block; margin-top: 4px; padding: 3px 10px; font-size: 12px;
  background: #f3f0ff; color: #4a3fa8; border: 1px dashed var(--purple);
  border-radius: 999px; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.sugg:hover { background: #e9e3ff; }

/* same-event candidate tag (title similarity); tap to select the set */
button.tag-similar {
  display: inline-flex; align-items: center; padding: 2px 9px; font-size: 11px;
  font-weight: 700; background: #fdeef5; color: #c2447e;
  border: 1px dashed var(--accent); border-radius: 999px; cursor: pointer;
}
button.tag-similar:hover { background: #fbdcea; }

/* pending group requests: visible but clearly inactive */
.pending-group { opacity: .6; border-style: dashed; margin-top: 10px; }
.tag-pending {
  display: inline-block; font-size: 11px; font-weight: 700; color: #8a6d00;
  background: #fff3cd; border: 1px solid #e6c65a; border-radius: 999px;
  padding: 1px 8px; vertical-align: 2px;
}
.tag-rejected {
  display: inline-block; font-size: 11px; font-weight: 700; color: #a34d5e;
  background: #fdeef0; border: 1px solid #e8a2b0; border-radius: 999px;
  padding: 1px 8px; vertical-align: 2px;
}

/* merge UI */
.mergebox { display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
            color: var(--muted); cursor: pointer; }
.merge-bar {
  position: sticky; bottom: 0; align-items: center; gap: 10px;
  background: #fff3e0; border: 1px solid #ffb74d; border-radius: 8px;
  padding: 8px 12px; margin-top: 8px; font-size: 13px;
}

/* busy-button spinner (slow network ops: add group / sync / twitter refetch) */
.spin {
  display: inline-block; width: 12px; height: 12px; vertical-align: -2px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button:disabled { opacity: .6; cursor: wait; }

/* fullcalendar tweaks for mobile */
#calendar {
  background: #fff; border-radius: 10px; padding: 16px;
  border: 1px solid var(--line); margin-top: 14px;
}
@media (max-width: 600px) {
  #calendar { padding: 10px; }
}
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 14px; }
.fc .fc-daygrid-day-frame { padding: 2px; }
.fc .fc-toolbar-title { font-size: 16px; }
.fc .fc-button-primary {
  background: var(--navy); border-color: var(--navy);
}
.fc .fc-button-primary:not(:disabled):hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--purple); border-color: var(--purple);
}
.fc .fc-day-today { background: #fdeef5 !important; }
.fc a { color: var(--text); }
.fc .fc-daygrid-event { font-size: 10px; }
@media (max-width: 600px) {
  .fc .fc-toolbar.fc-header-toolbar { flex-wrap: wrap; gap: 4px; }
}
