:root {
  --bg: #f4f7f9;
  --text: #1f2d3d;
  --accent: #007a5a;
  --warn: #b35b00;
  --danger: #b32134;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #d5f5eb 0, var(--bg) 50%);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  margin-bottom: 16px;
}

h1,h2,h3 { margin: 0 0 12px; }

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.nav a { color: var(--accent); text-decoration: none; margin-left: 12px; }

button, .btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.secondary, .btn.secondary { background: #6d7f8f; }
button.warn, .btn.warn { background: var(--warn); }
button.danger, .btn.danger { background: var(--danger); }

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d2dbe4;
  border-radius: 8px;
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 8px;
  border-bottom: 1px solid #e7edf3;
  text-align: left;
}

.card table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.alert {
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.alert.ok { background: #d8f3e5; }
.alert.err { background: #f8d7da; }
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.small { color: #5f7282; font-size: 13px; }

.stamp-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.stamp-btn {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  min-height: 50px;
  border: 2px solid transparent;
}

.stamp-btn.active {
  box-shadow: 0 0 0 3px rgba(0, 122, 90, 0.2);
}

.stamp-btn.in { background: #007a5a; }
.stamp-btn.break-start { background: #b35b00; }
.stamp-btn.break-end { background: #2d6fbc; }
.stamp-btn.out { background: #b32134; }
.stamp-btn:disabled {
  background: #a8b5c0;
  cursor: not-allowed;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.calendar-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.calendar-wrap {
  overflow-x: auto;
}

.month-grid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  min-width: 860px;
}

.week-grid {
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  min-width: 1120px;
}

.year-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.year-card {
  margin-bottom: 0;
}

.calendar-weekday {
  text-align: center;
  font-weight: 700;
  color: #3c5266;
  background: #e9f0f6;
  border-radius: 8px;
  padding: 8px 6px;
}

.calendar-empty {
  border-radius: 10px;
  background: #eef3f7;
  min-height: 88px;
}

.calendar-day {
  border-radius: 10px;
  padding: 10px;
  color: #fff;
  min-height: 88px;
  cursor: pointer;
}

.calendar-date {
  font-size: 13px;
  opacity: 0.9;
}

.calendar-main {
  margin-top: 6px;
  font-weight: 700;
  font-size: 14px;
}

.calendar-sub {
  margin-top: 4px;
  font-size: 12px;
}

.calendar-day.work { background: #2d6fbc; }
.calendar-day.vacation { background: #007a5a; }
.calendar-day.sick { background: #b32134; }
.calendar-day.unpaid { background: #7a3f00; }
.calendar-day.special { background: #5c2ca5; }
.calendar-day.other { background: #6d7f8f; }
.calendar-day.hire { background: #0b8f6f; }
.calendar-day.exit { background: #8b1f4a; }
.calendar-day.weekend-day { opacity: 0.72; }
.calendar-day.selected-range {
  box-shadow: inset 0 0 0 3px #ffd24d;
}

.tag.work { background: #2d6fbc; }
.tag.vacation { background: #007a5a; }
.tag.sick { background: #b32134; }
.tag.unpaid { background: #7a3f00; }
.tag.special { background: #5c2ca5; }
.tag.other { background: #6d7f8f; }
.tag.hire { background: #0b8f6f; }
.tag.exit { background: #8b1f4a; }
.tag.weekend { background: #8a97a3; }

@media (max-width: 760px) {
  .container {
    padding: 12px;
  }

  .nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav a {
    margin-left: 0;
  }

  .card {
    padding: 12px;
  }

  th, td {
    font-size: 13px;
    padding: 7px;
  }

  .month-grid {
    min-width: 760px;
    grid-template-columns: repeat(7, minmax(100px, 1fr));
  }

  .week-grid {
    min-width: 900px;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
  }

  .calendar-nav h2 {
    font-size: 18px;
    text-align: center;
  }
}
