:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #68758d;
  --line: #dbe3f0;
  --soft: #eef3fb;
  --accent: #2f6df6;
  --accent-dark: #1e53cc;
  --success: #16885a;
  --danger: #c73c3c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fff;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

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

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
  font-weight: 700;
}

.logout {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.logout span {
  color: var(--muted);
  font-size: 14px;
}

.content {
  padding: 34px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.small {
  font-size: 14px;
}

.panel,
.form-card,
.auth-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(23, 32, 51, 0.06);
}

.auth-panel {
  max-width: 520px;
  margin: 4vh auto;
  padding: 30px;
}

.form-card,
.form-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #33405a;
  font-weight: 700;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd6e6;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button,
.link-button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

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

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

.ghost,
.logout button,
.actions button,
.compact-form button {
  background: var(--soft);
  color: var(--ink);
}

.alert,
.success {
  margin: 18px 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.alert {
  color: var(--danger);
  background: #fff0f0;
}

.success {
  color: var(--success);
  background: #edf9f3;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stats article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) 1fr;
  gap: 18px;
  align-items: start;
}

.calendar-side {
  display: grid;
  gap: 18px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-row {
  display: grid;
  gap: 10px;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.compact-panel {
  margin-top: 22px;
  padding: 0;
}

.list {
  display: grid;
  gap: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff;
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.event-actions .compact-form {
  flex-direction: row;
}

.event-actions select {
  min-width: 130px;
}

.event-row.done {
  opacity: 0.65;
  border-left-color: var(--success);
}

.event-row.compact {
  grid-template-columns: 58px 1fr;
}

.priority-low {
  border-left-color: #7ba4d8;
}

.priority-normal {
  border-left-color: var(--accent);
}

.priority-high {
  border-left-color: #d9822b;
}

.priority-urgent {
  border-left-color: var(--danger);
}

.datebox {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-radius: 8px;
  background: var(--soft);
}

.datebox strong {
  font-size: 20px;
}

.datebox span {
  color: var(--muted);
  font-size: 12px;
}

.event-main p,
.event-row p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

.notes {
  margin-top: 8px;
  color: #3f4b62 !important;
}

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

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status-available {
  background: var(--success);
}

.status-busy {
  background: #d9822b;
}

.status-out {
  background: var(--accent);
}

.status-holiday {
  background: #8a63d2;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-row p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-section {
  margin-bottom: 18px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-row p {
  margin-bottom: 0;
  color: var(--muted);
}

.compact-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.compact-form input,
.compact-form select {
  min-width: 150px;
}

.profile-data {
  display: grid;
  gap: 10px;
}

.profile-data p {
  margin-bottom: 0;
  color: var(--muted);
}

.profile-data strong {
  color: var(--ink);
}

.note-row,
.template-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff;
}

.note-row.done {
  opacity: 0.65;
  border-left-color: var(--success);
}

.note-row p,
.template-row p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.template-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.template-use {
  display: grid;
  grid-template-columns: 150px 120px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.wide-form,
.settings-form {
  max-width: 820px;
}

.panel-subtitle {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}

.danger {
  color: var(--danger) !important;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.day-column {
  min-width: 150px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-event {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.mini-event span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  overflow-x: auto;
}

.month-cell {
  min-height: 130px;
  padding: 9px;
  background: #fff;
}

.muted-cell {
  background: #f8fafc;
}

.month-day {
  margin-bottom: 8px;
  font-weight: 800;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 20px;
  }

  .grid-two,
  .calendar-layout,
  .plan-grid,
  .work-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .compact-form {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-row,
  .history-row {
    grid-template-columns: 1fr;
  }

  .event-row {
    grid-template-columns: 58px 1fr;
  }

  .event-row form {
    grid-column: 1 / -1;
  }

  .event-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .template-use,
  .inline-fields {
    grid-template-columns: 1fr;
  }

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