* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #1f2937
}

.appbar {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: #111827;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100
}

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

.appbar form {
    margin: 0
}

.muted {
    color: #9ca3af;
    font-size: 13px;
    margin-left: 8px
}

.toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: white;
    border-bottom: 1px solid #d1d5db
}

.toolbar h1 {
    margin: 0;
    font-size: 24px
}

.btn {
    border: 1px solid #cbd5e1;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #111827;
    cursor: pointer
}

.btn.primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb
}

.btn.danger {
    background: #dc2626;
    color: white;
    border-color: #dc2626
}

.sheet-wrap {
    width: 100%;
    overflow: auto;
    height: calc(100vh - 116px);
    background: white
}

.calendar-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1700px;
    width: 100%;
    font-size: 13px
}

.calendar-table th,
.calendar-table td {
    border-right: 1px solid #d1d5db;
    border-bottom: 1px solid #d1d5db;
    padding: 9px 10px;
    vertical-align: top;
    background: white
}

.calendar-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #e5e7eb;
    text-align: left;
    white-space: nowrap;
    border-top: 1px solid #cbd5e1
}

.calendar-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 10
}

.calendar-table thead .sticky-col {
    z-index: 30
}

.month-head {
    min-width: 150px
}

.month-cell {
    min-width: 150px;
    text-align: center;
    font-weight: 700;
    border-left: 1px solid #d1d5db
}

.quarter {
    font-size: 12px;
    opacity: .7;
    margin-bottom: 4px
}

.month-name {
    font-size: 16px
}

.event-row {
    cursor: pointer
}

.event-row:hover td:not(.month-cell) {
    background: #f8fafc
}

.event-name {
    font-weight: 700;
    min-width: 180px
}

.channels {
    min-width: 160px
}

.channels span {
    display: inline-block;
    background: #eef2ff;
    border-radius: 999px;
    padding: 3px 7px;
    margin: 1px;
    font-size: 11px
}

.status {
    display: inline-block;
    padding: 6px 9px;
    border-radius: 5px;
    font-weight: 700;
    white-space: nowrap
}

.status-planned {
    background: #fde047;
    color: #111827
}

.status-submitted {
    background: #3b82f6;
    color: white
}

.status-asap {
    background: #dc2626;
    color: white
}

.history-link {
    border: 0;
    background: transparent;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
    padding: 0
}

.empty {
    text-align: center;
    padding: 30px !important
}

.month-january {
    background: #dbeafe !important
}

.month-february {
    background: #fce7f3 !important
}

.month-march {
    background: #dcfce7 !important
}

.month-april {
    background: #fef3c7 !important
}

.month-may {
    background: #ccfbf1 !important
}

.month-june {
    background: #ffedd5 !important
}

.month-july {
    background: #fee2e2 !important
}

.month-august {
    background: #fef9c3 !important
}

.month-september {
    background: #ede9fe !important
}

.month-october {
    background: #fed7aa !important
}

.month-november {
    background: #e5e7eb !important
}

.month-december {
    background: #e0f2fe !important
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.modal.hidden {
    display: none
}

.modal-card {
    width: min(720px, 95vw);
    max-height: 90vh;
    overflow: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3)
}

.modal-card.wide {
    width: min(900px, 96vw)
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #e5e7eb
}

.modal-header h2 {
    margin: 0
}

.icon-btn {
    border: 0;
    background: transparent;
    font-size: 28px;
    cursor: pointer
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 18px
}

.form-grid label {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    gap: 5px
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.user-form input,
.user-form select {
    width: 100%;
    padding: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit
}

.span-2 {
    grid-column: 1/-1
}

.checks {
    display: flex;
    gap: 14px;
    flex-wrap: wrap
}

.checks label {
    flex-direction: row;
    align-items: center;
    font-weight: 400
}

.checks input {
    width: auto
}

.modal-actions {
    display: flex;
    padding: 14px 18px;
    border-top: 1px solid #e5e7eb;
    gap: 8px
}

.spacer {
    flex: 1
}

.history-body {
    padding: 16px
}

.history-item {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb
}

.history-item>span {
    float: right;
    color: #6b7280;
    font-size: 12px
}

.old {
    text-decoration: line-through;
    color: #991b1b
}

.new {
    color: #166534;
    font-weight: 700
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7
}

.auth-card {
    width: min(420px, 92vw);
    background: white;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .12)
}

.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 12px 0;
    font-size: 13px;
    font-weight: 700
}

.auth-card input {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px
}

.auth-card .btn {
    width: 100%;
    margin-top: 10px
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 6px
}

.small {
    font-size: 12px;
    color: #6b7280
}

.page-pad {
    padding: 20px
}

.panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px
}

.user-form {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px
}

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

.simple-table th,
.simple-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    text-align: left
}

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

    .span-2 {
        grid-column: auto
    }

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

    .muted {
        display: none
    }
}

.hidden {
    display: none !important;
}

/* Basic rich-text editor */
.rich-text-toolbar {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 5px;
}

.rich-text-toolbar button {
  width: auto;
  padding: 5px 9px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #f7f7f7;
  cursor: pointer;
  font-size: 13px;
}

.rich-text-toolbar button:hover {
  background: #ececec;
}

.rich-text-editor {
  min-height: 80px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  font: inherit;
  line-height: 1.4;
  overflow-y: auto;
}

.rich-text-editor:focus {
  outline: 2px solid #b9d5ff;
  border-color: #7aa7e8;
}

.rich-text-editor ul,
.rich-text-editor ol {
  margin: 5px 0;
  padding-left: 24px;
}

.rich-text-editor p {
  margin: 5px 0;
}

/* Formatted rich text when displayed in the calendar */
.rich-text-display p {
  margin: 0 0 5px 0;
}

.rich-text-display p:last-child {
  margin-bottom: 0;
}

.rich-text-display ul,
.rich-text-display ol {
  margin: 4px 0;
  padding-left: 20px;
}

.rich-text-display li {
  margin: 2px 0;
}

/* ==========================================================
   QUILL RICH-TEXT EDITOR
   Keep the editor compact inside the event modal.
   ========================================================== */

#detailsEditor {
  min-height: 100px;
}

/* ==========================================================
   KEY DATES / TACTICS
   Tactic stays on the left and its date aligns on the right.
   ========================================================== */

.key-dates {
  min-width: 260px;
}

.key-date-row {
  display: grid;
  grid-template-columns: 70px auto;
  column-gap: 8px;
  align-items: baseline;
  width: 100%;
  margin-bottom: 4px;
}

.key-date-row:last-child {
  margin-bottom: 0;
}

.key-date-row span {
  white-space: nowrap;
  text-align: left;
  font-weight: 400;
}

.key-date-row strong {
  min-width: 0;
}

.key-date-row:last-child {
  margin-bottom: 0;
}

.key-date-row strong {
  min-width: 0;
}

.key-date-row span {
  white-space: nowrap;
  text-align: left;
  font-weight: 400;
}


/* ==========================================================
   MARKETING / CORE EVENTS
   Marketing-owned events are shared core events.
   Use a subtle highlight so they stand out from team events.
   ========================================================== */

.calendar-table .event-row[data-owner-team="marketing"] td:not(.month-cell) {
  background: #f1f5f9;
}

.calendar-table .event-row[data-owner-team="marketing"]:hover td:not(.month-cell) {
  background: #e8eef5;
}

/* ==========================================================
   KEY DATES / TACTICS - ENTRY FORM
   Tactic + date + completion status.
   ========================================================== */

#additionalDatesFields .key-dates-form-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#additionalDatesFields .key-date-form-row {
  display: grid;
  grid-template-columns: 180px minmax(200px, 1fr) 80px;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin: 0;
}

#additionalDatesFields .key-date-form-name {
  display: block;
  font-weight: 600;
}

#additionalDatesFields .key-date-form-row input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
}

/* Keep the completion checkbox compact instead of inheriting
   the normal full-width form label/input styles. */
#additionalDatesFields .key-date-completed {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: auto;
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}

#additionalDatesFields .key-date-completed input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex: none;
}

#additionalDatesFields .key-date-completed span {
  width: auto;
  flex: none;
  font-weight: 600;
}

@media (max-width: 650px) {
  #additionalDatesFields .key-date-form-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  #additionalDatesFields .key-date-completed {
    margin-bottom: 8px;
  }
}

/* Completed Key Date / Tactic */

.key-date-row.completed span,
.key-date-row.completed strong {
  text-decoration: line-through;
}
/* Manual visibility is independent of tactic completion. */
.event-visibility-control { margin: 16px 18px; }
.event-visibility-control input { width: auto; }
.event-visibility-control p { margin: 6px 0 0; font-size: 0.875rem; }
.hidden-event-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; background: #eee; color: #666; font-size: 0.75rem; font-weight: normal; }

#additionalDatesFields .other-feature-control { margin-top: 14px; }
#additionalDatesFields #otherFeatureFields { margin-top: 8px; }
#additionalDatesFields #otherFeatureFields.hidden { display: none; }
#additionalDatesFields #otherFeatureList { display: flex; flex-direction: column; gap: 6px; }
#additionalDatesFields .other-feature-row { grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.7fr) 70px 74px; }
#additionalDatesFields .other-feature-row label { margin: 0; }
#additionalDatesFields .other-feature-row label input { margin-top: 3px; }
#additionalDatesFields .other-feature-remove,
#additionalDatesFields #addOtherFeature { width: auto; padding: 5px 8px; font-size: 0.8rem; }
#additionalDatesFields #addOtherFeature { margin-top: 6px; }
