:root {
  --ink: #15171a;
  --muted: #667085;
  --red: #c52727;
  --blue: #1f6fa9;
  --gold: #cba451;
  --soft: #f5f6f3;
  --panel: #ffffff;
  --line: #d9ddd7;
  --dark: #17191c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Segoe UI", Arial, sans-serif;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 16px 24px;
  color: #fff;
  background: var(--dark);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}

.admin-header p,
.admin-header h1 {
  margin: 0;
}

.admin-header p {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-header h1 {
  margin-top: 3px;
  font-size: 23px;
  line-height: 1.1;
}

#status {
  display: inline-block;
  margin-top: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  color: #dce3ea;
  font-size: 12px;
  font-weight: 800;
}

#status[data-mode="ok"] {
  color: #dbffe8;
  border-color: rgba(65, 211, 126, .45);
}

#status[data-mode="warning"] {
  color: #fff1cc;
  border-color: rgba(255, 205, 86, .55);
}

#status[data-mode="danger"] {
  color: #ffd6d6;
  border-color: rgba(255, 96, 96, .55);
}

.admin-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

button,
.admin-header a,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 6px;
  padding: 10px 13px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

button.primary {
  border-color: var(--red);
  background: var(--red);
}

button.quiet {
  color: #e6e8ed;
  background: transparent;
}

.import-button input {
  display: none;
}

main {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 88px);
}

aside {
  position: sticky;
  top: 88px;
  align-self: start;
  height: calc(100vh - 88px);
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.tab {
  display: flex;
  width: 100%;
  margin-bottom: 9px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  text-align: left;
}

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

#editor {
  display: grid;
  gap: 18px;
  width: min(1060px, 100%);
  padding: 26px;
}

.editor-intro {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.editor-intro p {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.editor-intro h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

.editor-intro span {
  color: var(--muted);
  font-weight: 700;
}

.intro-actions {
  margin-top: 16px;
}

.advanced-warning {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 205, 86, .55);
  border-radius: 6px;
  color: #684900;
  background: #fff7dd;
  font-weight: 850;
}

.editor-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.editor-group header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.editor-group h3 {
  margin: 0;
  font-size: 21px;
}

.editor-group p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

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

.field:has(textarea) {
  grid-column: 1 / -1;
}

.field span {
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.45;
}

.field input[type="color"] {
  width: 96px;
  min-height: 46px;
  padding: 4px;
}

.field textarea {
  min-height: 116px;
  resize: vertical;
}

.custom-card {
  display: grid;
  gap: 12px;
}

button.danger {
  justify-self: start;
  margin-left: 18px;
  margin-bottom: 18px;
  border-color: #b42318;
  color: #fff;
  background: #b42318;
}

.upload-image {
  justify-self: start;
  min-height: 38px;
  border-color: rgba(31, 111, 169, .25);
  color: #fff;
  background: var(--blue);
}

.upload-image:disabled {
  opacity: .65;
  cursor: wait;
}

.event-tools {
  margin-inline: 18px;
}

.events-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.events-editor {
  min-width: 0;
}

.empty-event-editor {
  min-height: 280px;
}

.empty-event-editor header {
  display: grid;
  min-height: 220px;
  align-content: center;
}

.events-sidebar {
  position: sticky;
  top: 106px;
  max-height: calc(100vh - 126px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.events-sidebar header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.events-sidebar h3 {
  margin: 0;
  font-size: 20px;
}

.events-sidebar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.event-mini {
  border: 1px solid var(--line);
  border-left: 8px solid var(--event-color);
  border-radius: 8px;
  background: #fff;
}

.event-mini.active {
  border-color: rgba(31, 111, 169, .42);
  box-shadow: 0 12px 30px rgba(31, 111, 169, .12);
}

.event-mini > button {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  width: 100%;
  min-height: 0;
  border: 0;
  padding: 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.event-mini i {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 2px solid #fff;
  border-radius: 999px;
  outline: 1px solid rgba(16, 17, 19, .18);
  background: var(--event-color);
}

.event-mini strong,
.event-mini small {
  display: block;
}

.event-mini strong {
  font-size: 14px;
  line-height: 1.2;
}

.event-mini small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.event-mini__actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 0 10px 10px 46px;
}

.event-mini__actions span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.event-mini__actions button {
  min-height: 30px;
  border-color: rgba(180, 35, 24, .2);
  color: #b42318;
  background: #fff5f5;
  font-size: 12px;
}

.event-close-button {
  justify-self: start;
  margin-left: 18px;
}

.event-date-tool {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  gap: 10px;
  align-items: end;
  padding: 18px 18px 8px;
}

.event-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.event-bulk-actions label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 850;
}

.event-bulk-actions input {
  width: 96px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
}

.repeat-date-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 18px;
}

.repeat-date-list span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(31, 111, 169, .18);
  border-radius: 999px;
  padding: 7px 8px 7px 12px;
  background: #f3f8fc;
  font-weight: 850;
}

.repeat-date-list.excluded span {
  border-color: rgba(180, 35, 24, .18);
  background: #fff5f5;
}

.repeat-date-list button {
  min-height: 28px;
  padding: 0 10px;
  color: var(--blue);
  background: #fff;
}

.repeat-date-list.excluded button {
  color: #b42318;
}

.repeat-date-list p {
  margin: 0;
  color: var(--muted);
}

.event-tools h4 {
  margin: 0;
  padding: 0 18px;
}

.event-date-tool label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.event-date-tool input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

.event-date-tool .primary {
  min-height: 42px;
  align-self: end;
}

.event-date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 18px 18px;
}

.event-date-chips span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border-radius: 999px;
  padding: 7px 8px 7px 12px;
  color: #fff;
  background: var(--dark);
  font-weight: 850;
}

.event-date-chips button {
  min-height: 26px;
  min-width: 26px;
  padding: 0;
  border-color: rgba(255,255,255,.25);
  color: #fff;
  background: rgba(255,255,255,.14);
}

.event-date-chips p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .event-date-tool {
    grid-template-columns: 1fr;
  }
}

.advanced-editor {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.advanced-editor textarea {
  width: 100%;
  min-height: 66vh;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  font: 13px/1.55 Consolas, "Courier New", monospace;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 3px solid rgba(31, 111, 169, .16);
  border-color: var(--blue);
}

@media (max-width: 900px) {
  .admin-header {
    display: block;
  }

  .admin-header nav {
    justify-content: flex-start;
    margin-top: 14px;
  }

  main {
    display: block;
  }

  aside {
    position: static;
    display: flex;
    gap: 8px;
    height: auto;
    overflow-x: auto;
  }

  .tab {
    min-width: 122px;
    margin-bottom: 0;
  }

  #editor {
    padding: 18px;
  }

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

  .events-workspace {
    grid-template-columns: 1fr;
  }

  .events-sidebar {
    position: static;
    max-height: none;
  }
}
