:root {
  --bg: #050505;
  --surface: rgba(255, 255, 255, 0.07);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --ink: #f8fafc;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --pink: #d6487e;
  --cyan: #06b6d4;
  --green: #16a76b;
  --red: #ef4444;
  --amber: #d97706;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --glow: 0 0 32px rgba(214, 72, 126, 0.32), 0 0 72px rgba(6, 182, 212, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(214, 72, 126, 0.28), transparent 34rem),
    radial-gradient(circle at 92% 2%, rgba(6, 182, 212, 0.18), transparent 32rem),
    linear-gradient(180deg, #0d0d0f 0%, var(--bg) 42%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.app {
  position: relative;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -24px -24px 16px;
  padding: 18px 24px;
  background: rgba(5, 5, 5, 0.76);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: white;
  font-weight: 950;
  box-shadow: var(--glow);
}

.header-controls {
  display: grid;
  grid-template-columns: 170px 240px;
  gap: 10px;
}

.app-header p,
.app-header h1,
.panel-head p,
.panel-head h2 {
  margin: 0;
}

.app-header p,
.panel-head p {
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.app-header h1 {
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.date-control,
.field,
.activity-form label,
.time-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.date-control label {
  display: flex;
  align-items: center;
  gap: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  min-height: 46px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

select option {
  color: #111827;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(214, 72, 126, 0.75);
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 0 0 4px rgba(214, 72, 126, 0.16);
}

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(214, 72, 126, 0.24);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(214, 72, 126, 0.13), rgba(6, 182, 212, 0.07));
  padding: 14px 16px;
}

.notice span {
  color: var(--muted);
}

.sync-banner {
  margin-bottom: 14px;
  border: 1px solid rgba(217, 119, 6, 0.36);
  border-radius: 14px;
  background: rgba(217, 119, 6, 0.14);
  color: #fed7aa;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 850;
}

.tabs button,
.primary,
.secondary,
.activity-row button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tabs button:hover,
.secondary:hover,
.activity-row button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.11);
}

.tabs button.active,
.primary {
  border-color: rgba(214, 72, 126, 0.55);
  background: linear-gradient(135deg, var(--pink), #b8356a);
  color: #fff;
  box-shadow: 0 8px 24px rgba(214, 72, 126, 0.28);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(214, 72, 126, 0.4);
}

.secondary.danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.28);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stats article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stats article {
  padding: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.stats article:hover,
.panel:hover {
  border-color: rgba(214, 72, 126, 0.32);
}

.stats strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

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

.panel-head.compact {
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.badge.present,
.badge.done,
.present,
.done {
  background: var(--green);
}

.badge.absent,
.absent {
  background: var(--red);
}

.badge.missing,
.missing {
  background: var(--amber);
}

.time-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.time-grid,
.activity-form,
.totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.activity-form {
  grid-template-columns: minmax(0, 1fr) 130px auto;
  align-items: end;
  margin: 14px 0;
}

.totals div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.totals span,
.week-total small,
.person small,
.activity-row span,
.empty-state span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.totals strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}

.activity-list,
.team-table,
.week-grid {
  display: grid;
  gap: 10px;
}

.activity-row,
.team-row,
.week-row,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.055);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.activity-row:hover,
.team-row:hover,
.week-row:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 72, 126, 0.34);
  background: rgba(255, 255, 255, 0.08);
}

.activity-row button {
  min-height: 36px;
  color: #fecaca;
  padding: 0 12px;
}

.notes {
  margin-top: 14px;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 100px 70px 70px 90px;
  gap: 12px;
  align-items: center;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person > span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(214, 72, 126, 0.24), rgba(6, 182, 212, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  flex: 0 0 auto;
}

.week-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 100px;
  gap: 14px;
  align-items: center;
}

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

.week-days span {
  min-height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.week-days span:not(.present):not(.done):not(.absent):not(.missing) {
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

.week-total {
  text-align: right;
}

.empty-state {
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, 0.045);
}

@media (max-width: 820px) {
  .app {
    padding: 12px;
  }

  .app-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
    margin: -12px -12px 12px;
    padding: 14px 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .app-header h1 {
    font-size: 27px;
  }

  .header-controls {
    grid-template-columns: 1fr;
  }

  .tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 18px;
  }

  .tabs button {
    padding: 0 10px;
  }

  .stats,
  .layout,
  .time-actions,
  .time-grid,
  .activity-form,
  .totals {
    grid-template-columns: 1fr;
  }

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

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .primary,
  .secondary {
    width: 100%;
  }

  .team-row,
  .week-row {
    grid-template-columns: 1fr;
  }

  .week-total {
    text-align: left;
  }

  .week-days {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
  }
}
