* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --page: #06070a;
  --surface: #10131a;
  --surface-soft: #151a23;
  --surface-muted: #202633;
  --text: #f6f8fb;
  --muted: #aab4c4;
  --subtle: #7c8798;
  --border: #283141;
  --border-strong: #39465c;
  --blue: #3b82f6;
  --blue-dark: #1d4ed8;
  --green: #2dd4bf;
  --green-dark: #14b8a6;
  --red: #ef4444;
  --red-dark: #dc2626;
  --amber: #f59e0b;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.52);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.38);
  --radius: 8px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.96) 0%, #06070a 44%, #050505 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  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: 44px 44px;
  opacity: 0.22;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 7, 10, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.topbar-inner {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-icon,
.login-icon,
.panel-icon {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #14b8a6, #2563eb);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.brand-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.brand strong {
  display: block;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.brand:hover .brand-icon {
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12), var(--shadow-soft);
}

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

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  padding: 9px 14px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:hover,
button.btn:hover {
  background: linear-gradient(180deg, #60a5fa, var(--blue-dark));
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.btn:focus-visible,
button.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.btn-soft {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.btn-soft:hover {
  background: rgba(255, 255, 255, 0.095);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text);
}

.btn-green {
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
  border-color: rgba(94, 234, 212, 0.35);
  color: #042f2e;
}

.btn-green:hover {
  background: linear-gradient(180deg, #5eead4, var(--green-dark));
  color: #042f2e;
}

.btn-red {
  background: linear-gradient(180deg, var(--red), #b91c1c);
  border-color: rgba(248, 113, 113, 0.36);
  color: #ffffff;
}

.btn-red:hover {
  background: linear-gradient(180deg, #f87171, var(--red-dark));
}

.calendar-card,
.event-list,
.card,
.hero-panel,
.hero-stats,
.login-box {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18, 22, 31, 0.98), rgba(12, 15, 21, 0.98));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  margin: 24px 0 18px;
}

.hero-panel {
  padding: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(45, 212, 191, 0.35);
  background: rgba(20, 184, 166, 0.12);
  color: #ccfbf1;
  font-size: 13px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  max-width: 820px;
  font-size: 42px;
  line-height: 1.06;
  letter-spacing: 0;
  color: var(--text);
}

.hero p {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.hero-actions {
  margin-top: 22px;
}

.hero-stats {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.stat {
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.calendar-card {
  padding: 18px;
}

.month-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.month-title {
  text-align: center;
  min-width: 0;
}

.month-title strong {
  display: block;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.month-title span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

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

.weekday {
  min-height: 36px;
  display: grid;
  place-items: center;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
}

.day-cell {
  position: relative;
  min-height: 126px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 19, 27, 0.92);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  overflow: hidden;
}

.day-cell:hover {
  transform: translateY(-1px);
  border-color: #4b5f7b;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.day-cell.empty {
  background: rgba(7, 9, 13, 0.8);
  opacity: 0.62;
}

.day-cell.today {
  border-color: rgba(20, 184, 166, 0.72);
  box-shadow: inset 0 0 0 2px rgba(20, 184, 166, 0.16);
}

.day-cell.selected {
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.day-number {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.today .day-number {
  background: rgba(20, 184, 166, 0.18);
  color: #99f6e4;
}

.selected .day-number {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
}

.event-mini {
  display: block;
  margin-top: 7px;
  padding: 6px 7px;
  border-radius: var(--radius);
  background: #111827;
  border: 1px solid #1d4ed8;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-count {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #2dd4bf;
  color: #042f2e;
  font-size: 12px;
  font-weight: 800;
}

.event-more {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.event-list {
  padding: 20px;
  margin-top: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.section-title p {
  margin: 5px 0 0;
  color: var(--muted);
}

.events {
  display: grid;
  gap: 12px;
}

.event-card {
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  box-shadow: none;
}

.event-card:hover {
  border-color: #3c4b63;
  background: rgba(255, 255, 255, 0.052);
}

.break-card {
  border-left: 5px solid var(--amber);
  background: rgba(245, 158, 11, 0.075);
  border-color: rgba(245, 158, 11, 0.26);
}

.break-card:hover {
  border-color: rgba(245, 158, 11, 0.44);
  background: rgba(245, 158, 11, 0.105);
}

.break-card h3 {
  color: #fde68a;
}

.event-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.event-head h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: 0;
}

.event-time {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius);
  padding: 7px 10px;
  background: rgba(20, 184, 166, 0.13);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #99f6e4;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.break-time {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.38);
  color: #fde68a;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: var(--radius);
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  color: #e8edf5;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
}

.event-note {
  margin-top: 12px;
  color: #d6deea;
  line-height: 1.55;
}

.card {
  padding: 22px;
}

.card h1,
.card h2 {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.panel-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
}

.panel-icon {
  width: 54px;
  height: 54px;
  font-size: 27px;
  margin-bottom: 16px;
}

.panel-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 20px;
}

.panel-card .btn {
  margin-top: auto;
  width: max-content;
}

form label {
  display: block;
  color: #e5e7eb;
  font-weight: 700;
  margin: 12px 0 7px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(5, 7, 11, 0.92);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(96, 165, 250, 0.76);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

input[type="color"] {
  padding: 4px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(12, 15, 21, 0.98);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(12, 15, 21, 0.98);
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.055);
  font-size: 13px;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-box {
  width: min(430px, 100%);
  padding: 30px;
  text-align: center;
}

.login-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  font-size: 32px;
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 29px;
  line-height: 1.2;
}

.login-box p {
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.55;
}

.login-box form {
  text-align: left;
}

.login-box button.btn {
  width: 100%;
  margin-top: 14px;
}

.error {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: #2a0f12;
  border: 1px solid #7f1d1d;
  color: #fecaca;
  font-weight: 700;
}

.footer-note {
  width: min(1240px, calc(100% - 32px));
  margin: 8px auto 24px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-grid {
    gap: 6px;
  }

  .day-cell {
    min-height: 102px;
    padding: 8px;
  }

  .event-mini {
    font-size: 11px;
    padding: 5px 6px;
  }
}

@media (max-width: 720px) {
  .container,
  .topbar-inner,
  .footer-note {
    width: min(100% - 20px, 1240px);
  }

  .container {
    padding-top: 14px;
  }

  .topbar-inner {
    align-items: flex-start;
  }

  .brand {
    width: 100%;
  }

  .brand small {
    display: none;
  }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav .btn {
    width: 100%;
  }

  .hero {
    margin-top: 14px;
  }

  .hero-panel,
  .card,
  .event-list,
  .calendar-card,
  .login-box {
    padding: 14px;
  }

  .hero h1 {
    font-size: 31px;
  }

  .hero p {
    font-size: 15px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .month-nav {
    grid-template-columns: 1fr 1fr;
  }

  .month-title {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 2px;
  }

  .month-title strong {
    font-size: 24px;
  }

  .month-title span {
    font-size: 13px;
  }

  .month-nav .btn:first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .month-nav .btn:last-child {
    grid-column: 2;
    grid-row: 2;
  }

  .weekday {
    min-height: 30px;
    font-size: 11px;
  }

  .day-cell {
    min-height: 56px;
    padding: 5px;
  }

  .day-number {
    width: 25px;
    height: 25px;
    font-size: 13px;
  }

  .event-mini,
  .event-more {
    display: none;
  }

  .event-count {
    top: auto;
    right: auto;
    left: 50%;
    bottom: 7px;
    transform: translateX(-50%);
    min-width: 8px;
    width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
    color: transparent;
  }

  .section-title {
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .section-title h2 {
    font-size: 22px;
  }

  .section-title .btn {
    width: 100%;
  }

  .event-head {
    flex-direction: column;
    gap: 8px;
  }

  .event-head h3 {
    font-size: 17px;
  }

  .event-time {
    width: 100%;
    justify-content: flex-start;
  }

  .event-meta {
    gap: 6px;
  }

  .pill {
    font-size: 12px;
    min-height: 28px;
  }

  .event-note {
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-card .btn,
  .hero-actions .btn,
  .actions .btn,
  button.btn {
    width: 100%;
  }

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

@media (max-width: 420px) {
  .calendar-grid {
    gap: 4px;
  }

  .weekday {
    font-size: 10px;
  }

  .day-cell {
    min-height: 52px;
  }

  .month-nav {
    gap: 8px;
  }

  .btn,
  button.btn {
    padding: 9px 10px;
    font-size: 13px;
  }
}
