:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --ok: #dcfce7;
  --ok-text: #166534;
  --under: #fef3c7;
  --under-text: #92400e;
  --missing: #fee2e2;
  --missing-text: #991b1b;
  --over: #ffedd5;
  --over-text: #9a3412;
  --weekend: #f3f4f6;
  --weekend-text: #6b7280;
  --weekend-work: #ede9fe;
  --weekend-work-text: #5b21b6;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.login-banner {
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #fff7ed;
  border: 2px solid #fb923c;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-banner-text {
  font-size: 1rem;
  color: #9a3412;
}

.btn-login-big {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  min-width: 220px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #fc6d26;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(252, 109, 38, 0.35);
}

.btn-login-big:hover {
  background: #e24329;
}

.empty-state .btn-login-big {
  margin-top: 16px;
}

@media (max-width: 900px) {
  .login-banner {
    margin-top: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .btn-login-big {
    width: 100%;
  }
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-box {
  display: flex;
  align-items: center;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-name {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-warning {
  font-size: 0.85rem;
  color: #991b1b;
}

.btn-gitlab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #fc6d26;
  color: #fff;
  border-color: #fc6d26;
}

.btn-gitlab:hover {
  background: #e24329;
  border-color: #e24329;
  color: #fff;
}

input[readonly] {
  background: #f9fafb;
  color: var(--muted);
}

.setup-notice {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.setup-notice h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.setup-notice ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-notice code {
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.85rem;
}

.setup-notice a {
  color: var(--primary);
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  cursor: pointer;
  background: #fff;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  border-color: var(--border);
  background: #fff;
}

.btn-secondary:hover {
  background: #f9fafb;
}

.btn-tab {
  border-color: var(--border);
  background: #fff;
}

.btn-tab.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.settings {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.settings.hidden {
  display: none;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
}

input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--text);
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.view-switch,
.period-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.period-label {
  min-width: 180px;
  text-align: center;
  font-weight: 600;
}

.status-bar {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
}

.login-main {
  margin-top: 16px;
  display: inline-flex;
}

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

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: #fff;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.user-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.user-card-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.user-summary {
  color: var(--muted);
  font-size: 0.9rem;
}

.grid-wrap {
  overflow-x: auto;
  padding: 16px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.weekday-header {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 4px;
}

.day-cell {
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.day-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.day-cell.outside {
  opacity: 0.45;
}

.day-cell.empty-day {
  background: transparent;
  border-style: dashed;
  cursor: default;
}

.day-cell.empty-day:hover {
  transform: none;
  box-shadow: none;
}

.day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.day-number {
  font-weight: 700;
}

.day-hours {
  font-size: 1.1rem;
  font-weight: 700;
}

.day-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.status-ok {
  background: var(--ok);
  color: var(--ok-text);
}

.status-under {
  background: var(--under);
  color: var(--under-text);
}

.status-missing {
  background: var(--missing);
  color: var(--missing-text);
}

.status-over {
  background: var(--over);
  color: var(--over-text);
}

.status-weekend {
  background: var(--weekend);
  color: var(--weekend-text);
}

.status-weekend_work {
  background: var(--weekend-work);
  color: var(--weekend-work-text);
}

.status-outside {
  background: #f9fafb;
  color: #9ca3af;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  width: min(640px, calc(100% - 32px));
  margin: 8vh auto 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  padding: 16px 18px 20px;
}

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry-list li {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.entry-list a {
  color: var(--primary);
  text-decoration: none;
}

.entry-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .header-top,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .status-bar {
    margin-left: 0;
  }
}
