:root {
  --navy: #14213A;
  --teal: #12897F;
  --light-teal: #E9F6F4;
  --bg: #F5F7F8;
  --border: #DCE3E6;
  --danger: #C0392B;
  --text: #222A33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

header.topbar {
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

header.topbar .brand {
  font-weight: bold;
  font-size: 1.1em;
}

header.topbar nav a {
  color: white;
  text-decoration: none;
  margin-right: 16px;
  opacity: 0.9;
}
header.topbar nav a:hover { opacity: 1; text-decoration: underline; }

header.topbar .user-info {
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 10px;
}

header.topbar form { margin: 0; }

header.topbar button.logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

h1 { font-size: 1.4em; color: var(--navy); margin-top: 0; }
h2 { font-size: 1.15em; color: var(--navy); }

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.summary-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.summary-tile {
  flex: 1;
  min-width: 90px;
  background: white;
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
}
.summary-tile .num { font-size: 1.5em; font-weight: bold; color: var(--navy); }
.summary-tile .label { font-size: 0.8em; color: #555; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 0.92em; }
th { color: #555; font-weight: normal; font-size: 0.85em; }

a.deal-link { color: var(--navy); font-weight: bold; text-decoration: none; }
a.deal-link:hover { text-decoration: underline; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  color: white;
}
.status-見込み { background: #8B98A8; }
.status-商談中 { background: #E0A729; }
.status-受注 { background: var(--teal); }
.status-失注 { background: var(--danger); }

.btn {
  display: inline-block;
  background: var(--teal);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95em;
}
.btn:hover { opacity: 0.92; }
.btn.secondary { background: white; color: var(--navy); border: 1px solid var(--border); }

form.stacked label { display: block; margin: 12px 0 4px; font-size: 0.9em; color: #444; }
form.stacked input, form.stacked select, form.stacked textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 1em;
  font-family: inherit;
}
form.stacked textarea { min-height: 70px; }

.error-box {
  background: #FBEAE8;
  color: var(--danger);
  border: 1px solid #F0C6C1;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 0.9em;
}
.success-box {
  background: var(--light-teal);
  color: var(--navy);
  border: 1px solid var(--teal);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 0.9em;
}

.filter-tabs { margin-bottom: 12px; }
.filter-tabs a {
  display: inline-block;
  padding: 6px 12px;
  margin-right: 6px;
  border-radius: 14px;
  font-size: 0.85em;
  text-decoration: none;
  color: var(--navy);
  border: 1px solid var(--border);
  background: white;
}
.filter-tabs a.active { background: var(--navy); color: white; border-color: var(--navy); }

.login-wrap {
  max-width: 380px;
  margin: 12vh auto;
  padding: 0 16px;
}
.login-wrap .card { padding: 28px; }
.login-wrap h1 { text-align: center; }

.hint { color: #777; font-size: 0.85em; }

.log-entry { border-bottom: 1px solid var(--border); padding: 10px 0; }
.log-entry .meta { font-size: 0.8em; color: #888; margin-bottom: 3px; }

/* ---- 予定カレンダー ---- */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.calendar-month-label {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--navy);
}
.calendar-wrap { overflow-x: auto; margin-bottom: 20px; }
table.calendar-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
}
table.calendar-table th {
  background: var(--navy);
  color: white;
  padding: 8px 4px;
  font-size: 0.85em;
  text-align: center;
}
table.calendar-table th.sun { color: #FFD1CC; }
table.calendar-table th.sat { color: #CFE9FB; }

.calendar-cell {
  border: 1px solid var(--border);
  vertical-align: top;
  padding: 6px;
  width: 14.28%;
  height: 96px;
  overflow: hidden;
}
.calendar-cell.sun, .calendar-cell.sat { background: #FBFCFD; }
.calendar-cell.out-of-month { background: #F2F3F4; color: #B7BEC4; }
.calendar-cell.out-of-month .calendar-date { color: #B7BEC4; }
.calendar-cell.is-today { background: var(--light-teal); border: 2px solid var(--teal); }

.calendar-date {
  font-size: 0.85em;
  font-weight: bold;
  color: var(--navy);
  margin-bottom: 4px;
}

.calendar-event {
  display: block;
  font-size: 0.72em;
  color: white;
  padding: 2px 5px;
  margin-bottom: 3px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event:hover { opacity: 0.85; }

@media (max-width: 480px) {
  header.topbar { flex-direction: column; align-items: flex-start; }
  .summary-row { flex-wrap: wrap; }
}
