:root {
      --primary: #0055cc;
      --primary-dark: #003399;
      --text: #003366;
      --bg: #A1A1A1;
      --card: #ffffff;
      --border: #d7d7d7;
      --muted: #52606d;
      --success: #0a7a2f;
      --danger: #b00020;
      --warning: #a66a00;
      --shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
      --radius: 14px;
      --soft-blue: #eef4ff;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: Arial, Helvetica, sans-serif;
    }

    header {
      background: var(--primary);
      color: #ffffff;
      padding: 22px 16px;
      text-align: center;
    }

    header h1 {
      margin: 0;
      font-size: clamp(1.5rem, 4vw, 2.4rem);
      line-height: 1.15;
    }

    header p {
      margin: 8px 0 0;
      font-weight: bold;
      opacity: 0.95;
    }

    main {
      width: min(1280px, calc(100% - 24px));
      margin: 0 auto;
      padding: 24px 0 40px;
    }

    .card {
      background: var(--card);
      border-radius: 18px;
      box-shadow: var(--shadow);
      padding: 18px;
      margin-bottom: 22px;
    }

    .card h2 {
      margin: 0 0 16px;
      color: var(--text);
      font-size: clamp(1.35rem, 3vw, 1.9rem);
    }

    .hint {
      margin: 0 0 16px;
      color: var(--muted);
      line-height: 1.45;
      font-size: 1.02rem;
    }

    .msg-error,
    .msg-success {
      border-radius: 14px;
      box-shadow: var(--shadow);
      padding: 14px 16px;
      margin-bottom: 18px;
      font-weight: bold;
    }

    .msg-error {
      background: #fff3f3;
      color: var(--danger);
    }

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

    .team-filter-details {
      background: var(--card);
      border-radius: 18px;
      box-shadow: var(--shadow);
      padding: 0;
      margin-bottom: 22px;
      overflow: hidden;
    }

    .team-filter-details summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      cursor: pointer;
      padding: 18px;
      list-style: none;
      color: var(--text);
      font-weight: bold;
      font-size: clamp(1.25rem, 3vw, 1.8rem);
    }

    .team-filter-details summary::-webkit-details-marker {
      display: none;
    }

    .team-filter-details summary::after {
      content: "⌄";
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      border-radius: 999px;
      background: var(--soft-blue);
      color: var(--primary);
      font-size: 1.2rem;
      transition: transform 0.18s ease;
      flex-shrink: 0;
    }

    .team-filter-details[open] summary::after {
      transform: rotate(180deg);
    }

    .team-filter-inner {
      padding: 0 18px 18px;
    }

    .team-filter-box {
      display: grid;
      gap: 10px;
    }

    .team-filter-placeholder,
    .calendar-empty {
      background: #ffffff;
      border-radius: 16px;
      border: 1px solid #ececec;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
      padding: 18px;
      text-align: center;
      color: #4c607d;
      font-weight: bold;
      font-size: 1.05rem;
    }

    .team-filter-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
      gap: 12px;
    }

    .team-filter-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px 14px;
      background: #f7faff;
      border: 1px solid var(--border);
      border-radius: 14px;
      cursor: pointer;
    }

    .team-filter-item input {
      margin-top: 3px;
      width: 18px;
      height: 18px;
      flex-shrink: 0;
    }

    .team-filter-color {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      margin-top: 4px;
      flex-shrink: 0;
      border: 1px solid rgba(0,0,0,.08);
    }

    .team-filter-item strong {
      display: block;
      color: var(--text);
      line-height: 1.3;
      font-size: 1rem;
    }

    .team-filter-item small {
      display: block;
      color: var(--muted);
      line-height: 1.35;
      margin-top: 3px;
    }

    .calendar-toolbar {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 16px;
    }

    .toolbar {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 18px;
    }

    .calendar-nav {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .calendar-title-wrap {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 8px;
      text-align: center;
      min-width: 0;
    }

    .calendar-title {
      font-size: clamp(1.5rem, 4vw, 2rem);
      font-weight: bold;
      color: #1f2b3a;
      white-space: nowrap;
    }

    .calendar-title-caret {
      width: 0;
      height: 0;
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-top: 6px solid #707b88;
      margin-top: 4px;
    }

    .view-switch {
      display: inline-flex;
      gap: 8px;
      background: #e9eef8;
      border-radius: 999px;
      padding: 8px;
      justify-content: flex-end;
    }

    button,
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 42px;
      padding: 10px 16px;
      border-radius: 999px;
      border: none;
      background: #0f5bd3;
      color: #ffffff;
      font-weight: bold;
      text-decoration: none;
      cursor: pointer;
      font-size: 1rem;
      white-space: nowrap;
      transition: background .15s ease;
    }

    button:hover,
    .btn:hover {
      background: #0848a8;
      text-decoration: none;
    }

    .btn-secondary {
      background: #ffffff;
      color: var(--text);
      border: 1px solid var(--border);
    }

    .btn-secondary:hover {
      background: var(--soft-blue);
      color: var(--text);
    }

    .btn-ghost {
      background: #ffffff;
      color: #1a2c46;
      border: 1px solid #c9ced6;
      box-shadow: none;
    }

    .btn-ghost:hover {
      background: #f3f6fb;
      color: #1a2c46;
    }

    .view-switch button {
      background: transparent;
      color: #0b2d5d;
      min-height: 40px;
      padding: 10px 20px;
    }

    .view-switch button.active {
      background: #0f5bd3;
      color: #ffffff;
    }

    .calendar-content {
      min-height: 260px;
    }

    .calendar-subscribe-card h3 {
      margin: 0 0 6px;
      color: var(--text);
      font-size: 1.15rem;
    }

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

    .feed-item {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: #f7fbff;
      padding: 14px;
    }

    .feed-item p {
      margin: 0 0 12px;
      color: var(--muted);
      line-height: 1.35;
    }

    .feed-link-row {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    .feed-link-row input {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      white-space: nowrap;
      border: 0;
    }

    .feed-link-row .btn,
    .feed-link-row button {
      flex: 0 0 auto;
      min-width: 92px;
      text-align: center;
    }

    .feed-help {
      margin: 0 0 18px;
      padding-left: 22px;
      line-height: 1.5;
      color: #17212f;
    }

    .agenda-list {
      display: grid;
      gap: 0;
    }

    .agenda-day {
      display: grid;
      grid-template-columns: 140px 1fr;
      gap: 18px;
      padding: 14px 10px;
      border-top: 1px solid #d7dde6;
      align-items: start;
    }

    .agenda-day:first-child {
      border-top: none;
    }

    .agenda-date {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .agenda-date-circle {
      width: 44px;
      height: 44px;
      min-width: 44px;
      border-radius: 50%;
      background: #0f5bd3;
      color: #ffffff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 1.15rem;
      line-height: 1;
    }

    .agenda-date-meta {
      display: grid;
      gap: 3px;
      line-height: 1;
    }

    .agenda-date-meta strong {
      color: #3e6dc1;
      font-size: 0.95rem;
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }

    .agenda-date-meta small {
      color: #3b4e69;
      text-transform: uppercase;
      font-weight: bold;
      font-size: 0.8rem;
    }

    .agenda-events {
      display: grid;
      gap: 8px;
      align-items: stretch;
      justify-items: stretch;
      width: 100%;
      min-width: 0;
    }

    .agenda-event-row,
    button.agenda-event-row {
      display: flex !important;
      align-items: center;
      justify-content: flex-start !important;
      width: 100%;
      min-width: 0;
      gap: 10px;
      text-align: left !important;
      text-decoration: none;
      color: inherit;
      border-radius: 12px;
      padding: 10px 12px;
      background: #f7faff;
      border: 1px solid var(--border);
      border-left: 5px solid var(--event-color, #0055cc);
      font: inherit;
      min-height: 0;
    }

    .agenda-event-row:hover {
      background: #eef4ff;
      text-decoration: none;
    }

    .agenda-event-dot {
      width: 13px;
      height: 13px;
      flex: 0 0 13px;
      border-radius: 50%;
      background: var(--event-color, #0055cc);
      border: 1px solid rgba(0, 0, 0, 0.08);
    }

    .agenda-event-time {
      flex: 0 0 58px;
      color: #1f2b3a;
      font-size: 0.98rem;
      white-space: nowrap;
      font-weight: bold;
      text-align: left !important;
    }

    .agenda-event-title {
      flex: 1 1 auto;
      min-width: 0;
      color: #17212f;
      font-size: 1rem;
      line-height: 1.35;
      font-weight: 700;
      word-break: normal;
      overflow-wrap: anywhere;
      text-align: left !important;
      justify-self: auto !important;
      margin: 0;
    }

    .agenda-event-result {
      flex: 0 0 auto;
      margin-left: auto;
      color: var(--text);
      background: #ffffff;
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 4px 10px;
      font-weight: bold;
      white-space: nowrap;
      text-align: center;
    }

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

    .week-day {
      background: #f8fbff;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 10px;
      min-height: 220px;
    }

    .week-day-head {
      margin-bottom: 10px;
      padding-bottom: 8px;
      border-bottom: 1px solid #dce3ef;
    }

    .week-day-head strong {
      display: block;
      font-size: 1rem;
      color: var(--text);
    }

    .week-day-head small {
      color: var(--muted);
      font-weight: bold;
    }

    .week-events {
      display: grid;
      gap: 8px;
    }

    .week-event {
      display: grid;
      gap: 3px;
      border-radius: 10px;
      padding: 8px 10px;
      background: #f7faff;
      border: 1px solid var(--border);
      border-left: 4px solid var(--event-color, #0055cc);
      color: #152338;
      text-decoration: none;
      line-height: 1.35;
      font-size: 0.92rem;
      text-align: left;
    }

    .week-event:hover {
      background: #eef4ff;
      text-decoration: none;
    }

    .week-event strong {
      display: block;
      text-align: left;
    }

    .week-event small {
      display: block;
      color: #4b5c75;
      margin-top: 2px;
      text-align: left;
    }

    .month-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 10px;
    }

    .month-weekday {
      text-align: center;
      font-weight: bold;
      color: var(--text);
      padding: 8px 4px;
    }

    .month-day {
      min-height: 140px;
      background: #f8fbff;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 8px;
    }

    .month-day.outside {
      background: #f1f3f7;
      opacity: 0.55;
    }

    .month-day-number {
      font-weight: bold;
      color: var(--text);
      margin-bottom: 8px;
    }

    .month-events {
      display: grid;
      gap: 6px;
    }

    .month-event {
      display: block;
      width: 100%;
      border: 1px solid var(--border);
      background: #ffffff;
      border-left: 4px solid var(--event-color, #0055cc);
      color: #17212f;
      border-radius: 8px;
      padding: 6px 7px;
      text-align: left;
      font-size: 0.78rem;
      line-height: 1.25;
      cursor: pointer;
      min-height: 0;
    }

    .month-event:hover {
      background: #eef4ff;
    }

    .legend {
      display: flex;
      flex-wrap: wrap;
      gap: 12px 16px;
      margin-top: 16px;
      padding-top: 12px;
      border-top: 1px solid #e4e8ef;
    }

    .legend-item {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: #2c3f5d;
      font-size: 0.95rem;
    }

    .legend-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      flex-shrink: 0;
    }

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

      .toolbar {
        display: grid;
      }

      .calendar-nav,
      .calendar-title-wrap {
        justify-content: center;
      }

      .feed-link-row .btn,
      .feed-link-row button,
      .toolbar .btn {
        flex: 1 1 calc(50% - 10px);
      }

      .view-switch {
        justify-content: center;
      }

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

      .month-weekday {
        display: none;
      }

      .month-day.outside {
        display: none;
      }
    }

    @media (max-width: 760px) {
      main {
        width: calc(100% - 16px);
        padding: 16px 0 32px;
      }

      header {
        padding: 18px 12px;
      }

      .card {
        padding: 14px;
      }

      .agenda-day {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 8px;
        padding: 10px 0;
        align-items: start;
      }

      .agenda-date {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 4px;
        text-align: center;
        padding-top: 2px;
      }

      .agenda-date-circle {
        width: 38px;
        height: 38px;
        min-width: 38px;
        border-radius: 50%;
        background: #0f5bd3;
        color: #ffffff;
        font-size: 1.05rem;
        font-weight: bold;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
      }

      .agenda-date-meta {
        display: grid;
        gap: 1px;
        text-align: center;
        line-height: 1;
      }

      .agenda-date-meta strong {
        display: block;
        color: #0f5bd3;
        font-size: 0.72rem;
        line-height: 1;
      }

      .agenda-date-meta small {
        display: block;
        color: #334155;
        font-size: 0.68rem;
        line-height: 1;
        text-transform: uppercase;
        font-weight: bold;
      }

      .agenda-events {
        gap: 8px;
        min-width: 0;
      }

      .agenda-event-row,
      button.agenda-event-row {
        display: flex !important;
        width: 100%;
        min-width: 0;
        gap: 7px;
        padding: 9px 8px;
        border-left-width: 4px;
      }

      .agenda-event-dot {
        width: 9px;
        height: 9px;
        flex: 0 0 9px;
      }

      .agenda-event-time {
        flex: 0 0 42px;
        font-size: 0.82rem;
        white-space: nowrap;
        text-align: left !important;
      }

      .agenda-event-title {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.84rem;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left !important;
      }

      .agenda-event-result {
        flex: 0 0 auto;
        margin-left: auto;
        padding: 2px 7px;
        font-size: 0.82rem;
        line-height: 1.2;
      }

      .calendar-nav {
        justify-content: center;
      }

      .view-switch {
        width: 100%;
      }

      .view-switch button {
        flex: 1;
      }
    }

    @media (max-width: 520px) {
      .feed-link-row .btn,
      .feed-link-row button {
        flex-basis: 100%;
      }
    }

    @media print {
      .app-top-nav,
      .side-menu,
      .account-menu,
      .app-footer,
      button,
      .btn,
      .team-filter-details,
      .view-switch {
        display: none !important;
      }

      body {
        background: #ffffff;
        color: #000000;
        padding-top: 0 !important;
      }

      header {
        background: #ffffff;
        color: #000000;
        border-bottom: 2px solid #000000;
        text-align: left;
      }

      main {
        width: 100%;
        padding: 16px 0 0;
      }

      .card,
      .week-day,
      .month-day {
        box-shadow: none;
        border: 1px solid #999999;
      }
    }
