:root {
      --bg: #f7f8fb;
      --surface: #ffffff;
      --surface-2: #eef2f7;
      --text: #202631;
      --muted: #667085;
      --line: #dce3ee;
      --indigo: #3f5fba;
      --indigo-deep: #263f8f;
      --indigo-soft: #e7ecfb;
      --blue: #3478c7;
      --blue-soft: #e5f0fb;
      --green: #2f8a67;
      --green-deep: #1f6d51;
      --green-soft: #e0f3ea;
      --teal: #168b8f;
      --teal-soft: #def4f3;
      --orange: #c87518;
      --orange-soft: #fff0d6;
      --amber: #c87518;
      --amber-soft: #fff0d6;
      --rose: #c54f4a;
      --rose-soft: #fde4e1;
      --violet: #7257c8;
      --violet-soft: #eee8fb;
      --gray-action: #4f6075;
      --gray-soft: #edf1f5;
      --shadow: 0 16px 40px rgba(32, 38, 49, .09);
      --shadow-soft: 0 8px 22px rgba(32, 38, 49, .06);
      --motion-fast: 160ms;
      --motion-med: 260ms;
      font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    [hidden] {
      display: none !important;
    }

    body {
      margin: 0;
      color: var(--text);
      background:
        linear-gradient(135deg, rgba(255,255,255,.92) 0%, rgba(247,248,251,.98) 46%, rgba(238,244,250,.94) 100%),
        var(--bg);
      min-height: 100vh;
      letter-spacing: 0;
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }

    .icon-svg {
      width: 18px;
      height: 18px;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
      fill: none;
      flex: 0 0 auto;
    }

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

    button {
      border: 0;
      cursor: pointer;
    }

    .app {
      max-width: 1480px;
      margin: 0 auto;
      padding: 22px;
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 18px;
      padding: 14px;
      border: 1px solid rgba(216, 226, 220, .8);
      border-radius: 8px;
      background: rgba(255,255,255,.72);
      box-shadow: var(--shadow-soft);
      backdrop-filter: blur(14px);
    }

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

    .brand-mark {
      width: 48px;
      height: 48px;
      border-radius: 8px;
      background: linear-gradient(145deg, var(--indigo), var(--indigo-deep));
      color: white;
      display: grid;
      place-items: center;
      box-shadow: 0 12px 24px rgba(63, 95, 186, .22);
    }

    .brand h1 {
      margin: 0;
      font-size: clamp(24px, 3vw, 34px);
      line-height: 1.1;
      font-weight: 760;
    }

    .brand p {
      margin: 5px 0 0;
      color: var(--muted);
      font-size: 14px;
    }

    .toolbar {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .delete-tools {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .more-actions {
      display: contents;
    }

    .more-actions > summary {
      display: none;
      list-style: none;
    }

    .more-actions > summary::-webkit-details-marker {
      display: none;
    }

    .more-actions-menu {
      display: contents;
    }

    .language-picker {
      min-height: 40px;
      border-radius: 8px;
      background: var(--surface);
      color: var(--text);
      border: 1px solid var(--line);
      box-shadow: 0 8px 20px rgba(29, 38, 33, .05);
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 0 10px;
      font-size: 13px;
      font-weight: 700;
    }

    .language-picker select {
      min-height: 30px;
      padding: 4px 26px 4px 8px;
      border-radius: 8px;
      font-weight: 600;
    }

    body[data-view="week"] .date-strip,
    body[data-view="month"] .date-strip {
      display: none;
    }

    .view-nav {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 8px;
      margin-bottom: 14px;
      padding: 6px;
      border: 1px solid rgba(216, 226, 220, .82);
      border-radius: 8px;
      background: rgba(255,255,255,.58);
      box-shadow: var(--shadow-soft);
    }

    .view-tab {
      min-height: 46px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.78);
      color: #35433b;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 10px;
      box-shadow: none;
      white-space: nowrap;
      transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
    }

    .view-tab.active {
      background: var(--indigo-deep);
      color: #fff;
      border-color: var(--indigo-deep);
      box-shadow: 0 10px 20px rgba(38, 63, 143, .18);
    }

    .view-tab:hover,
    .text-btn:hover,
    .icon-btn:hover,
    .tiny-btn:hover {
      transform: translateY(-1px);
      border-color: rgba(63, 95, 186, .38);
    }

    .icon-btn,
    .text-btn {
      min-height: 40px;
      border-radius: 8px;
      background: var(--surface);
      color: var(--text);
      border: 1px solid var(--line);
      box-shadow: var(--shadow-soft);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 12px;
      white-space: nowrap;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease;
    }

    .view-tab:active,
    .text-btn:active,
    .icon-btn:active,
    .tiny-btn:active {
      transform: translateY(1px) scale(.99);
      box-shadow: 0 4px 12px rgba(32, 38, 49, .08);
    }

    .icon-btn {
      width: 40px;
      padding: 0;
    }

    .primary {
      color: white;
      background: var(--indigo);
      border-color: var(--indigo);
      box-shadow: 0 10px 22px rgba(63, 95, 186, .18);
    }

    #quickAddBtn,
    button[type="submit"] {
      background: var(--blue);
      border-color: var(--blue);
      color: #fff;
      box-shadow: 0 10px 22px rgba(52, 120, 199, .18);
    }

    #importBtn,
    #bulkBtn {
      background: var(--orange);
      border-color: var(--orange);
      color: #fff;
      box-shadow: 0 10px 22px rgba(200, 117, 24, .18);
    }

    #voiceBtn,
    #aiParseBtn,
    #aiApplyBtn {
      background: var(--violet);
      border-color: var(--violet);
      color: #fff;
      box-shadow: 0 10px 22px rgba(114, 87, 200, .18);
    }

    #jsonExportBtn,
    #jsonImportBtn,
    #icsBtn,
    #installBtn {
      background: var(--teal);
      border-color: var(--teal);
      color: #fff;
      box-shadow: 0 10px 22px rgba(22, 139, 143, .16);
    }

    #googleBtn,
    #appleBtn,
    #weekToggle,
    #aiCancelBtn,
    #cancelDeleteModeBtn {
      background: var(--gray-action);
      border-color: var(--gray-action);
      color: #fff;
    }

    #deleteSampleBtn {
      background: var(--orange-soft);
      border-color: #f1c981;
      color: #7a460b;
    }

    #deleteModeBtn.active-danger {
      background: #8f332f;
      border-color: #8f332f;
      color: #fff;
      box-shadow: 0 10px 22px rgba(197, 79, 74, .22);
    }

    .shell {
      display: grid;
      grid-template-columns: 310px minmax(0, 1fr) 350px;
      gap: 18px;
      align-items: start;
    }

    .panel,
    .event-card,
    .day-column,
    .quick-panel {
      background: rgba(255, 255, 255, .88);
      border: 1px solid rgba(220, 228, 221, .9);
      border-radius: 8px;
      box-shadow: var(--shadow-soft);
    }

    .panel {
      padding: 18px;
    }

    .panel-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    .panel-title h2 {
      font-size: 17px;
      margin: 0;
      letter-spacing: 0;
    }

    .date-strip {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 6px;
      margin-bottom: 14px;
      padding: 5px;
      border: 1px solid rgba(216, 226, 220, .78);
      border-radius: 8px;
      background: rgba(255,255,255,.62);
    }

    .day-tab {
      min-height: 58px;
      border-radius: 8px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--muted);
      display: grid;
      place-items: center;
      gap: 2px;
      padding: 6px 2px;
      transition: background .18s ease, color .18s ease, border-color .18s ease;
    }

    .day-tab strong {
      display: block;
      color: var(--text);
      font-size: 14px;
    }

    .day-tab span {
      font-size: 12px;
    }

    .day-tab.active {
      color: white;
      background: var(--indigo-deep);
      border-color: var(--indigo-deep);
    }

    .day-tab.active strong {
      color: white;
    }

    .focus-alert {
      margin-bottom: 14px;
      border-radius: 8px;
      overflow: hidden;
      border: 1px solid transparent;
      box-shadow: var(--shadow-soft);
    }

    .focus-alert.high {
      background: linear-gradient(135deg, #9f3f43, #c2604a);
      color: #fff;
      padding: 22px 24px;
      min-height: 116px;
      display: grid;
      align-content: center;
    }

    .focus-alert.medium {
      background: linear-gradient(135deg, #9a6416, #bf8a2d);
      color: #fff;
      padding: 22px 24px;
      min-height: 108px;
      display: grid;
      align-content: center;
    }

    .focus-alert.empty {
      background: linear-gradient(135deg, var(--indigo-soft), #f8faff);
      border-color: #cbd6f2;
      color: var(--indigo-deep);
      padding: 16px 18px;
    }

    .focus-alert h2 {
      margin: 0 0 7px;
      font-size: clamp(20px, 2.8vw, 28px);
      line-height: 1.18;
    }

    .focus-alert p {
      margin: 0;
      line-height: 1.45;
    }

    .timeline {
      position: relative;
      min-height: 820px;
      border-radius: 8px;
      border: 1px solid var(--line);
      overflow: hidden;
      background:
        repeating-linear-gradient(
          to bottom,
          #fff 0,
          #fff 55px,
          #edf2ee 56px
        );
    }

    .hour {
      position: absolute;
      left: 0;
      right: 0;
      height: 56px;
      border-top: 1px solid rgba(220, 228, 221, .7);
      color: var(--muted);
      font-size: 12px;
      padding-left: 12px;
      display: flex;
      align-items: flex-start;
      padding-top: 5px;
    }

    .now-line {
      position: absolute;
      left: 66px;
      right: 10px;
      height: 2px;
      background: #b94444;
      box-shadow: 0 0 0 3px rgba(185, 68, 68, .12);
      z-index: 3;
    }

    .event-card {
      --event-bg: #fff;
      --event-bg-rgb: 255,255,255;
      --event-border: var(--green);
      position: absolute;
      left: 74px;
      right: 12px;
      min-height: 58px;
      padding: 0;
      border-left: 0;
      overflow: hidden;
      background: var(--event-bg);
      display: grid;
      grid-template-columns: 54px minmax(0, 1fr);
      box-shadow: 0 10px 24px rgba(29, 38, 33, .07);
      animation: cardIn var(--motion-med) ease both;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, opacity var(--motion-fast) ease, filter var(--motion-fast) ease;
    }

    .event-card.class {
      --event-bg: var(--blue-soft);
      --event-bg-rgb: 224,236,247;
      --event-border: var(--blue);
    }

    .event-card.task {
      --event-bg: var(--orange-soft);
      --event-bg-rgb: 255,240,214;
      --event-border: var(--orange);
    }

    .event-card.alert {
      --event-bg: var(--orange-soft);
      --event-bg-rgb: 255,240,214;
      --event-border: var(--orange);
    }

    .event-card.personal {
      --event-bg: var(--violet-soft);
      --event-bg-rgb: 233,229,246;
      --event-border: var(--violet);
    }

    .event-card.exam,
    .week-pill.exam {
      --event-bg: #ffe1d8;
      --event-bg-rgb: 255,225,216;
      --event-border: #c14e2f;
    }

    .week-pill.exam {
      background: #ffe4dc;
      border-left-color: var(--rose);
    }

    .event-card.holiday,
    .week-pill.holiday {
      --event-bg: #dff2f4;
      --event-bg-rgb: 223,242,244;
      --event-border: #237a82;
    }

    .week-pill.holiday {
      background: #dff2f4;
      border-left-color: #237a82;
    }

    .event-card.homework,
    .week-pill.homework {
      --event-bg: #fde7ef;
      --event-bg-rgb: 253,231,239;
      --event-border: #b84575;
    }

    .week-pill.homework {
      background: #fde7ef;
      border-left-color: #b84575;
    }

    .event-card.fuzzy {
      background: linear-gradient(
        to bottom,
        rgba(var(--event-bg-rgb), 1) 0%,
        rgba(var(--event-bg-rgb), .96) var(--solid-end, 58%),
        rgba(var(--event-bg-rgb), .58) var(--fade-mid, 80%),
        rgba(var(--event-bg-rgb), .12) 100%
      );
    }

    .event-card.fuzzy::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 30%;
      border-bottom: 2px dashed rgba(29, 38, 33, .28);
      pointer-events: none;
    }

    .event-card.dragging {
      z-index: 8;
      box-shadow: 0 18px 42px rgba(29, 38, 33, .18);
      cursor: grabbing;
    }

    .drag-delete-card {
      z-index: 25;
      cursor: grabbing;
      opacity: .94;
      box-shadow: 0 24px 52px rgba(32, 38, 49, .22) !important;
      transition: box-shadow var(--motion-fast) ease, opacity var(--motion-fast) ease;
    }

    .drag-delete-card.over-delete-zone {
      opacity: .72;
      outline: 2px solid var(--rose);
      outline-offset: -2px;
    }

    .event-card.blocked {
      opacity: .74;
      filter: saturate(.78);
      box-shadow: inset 0 0 0 2px rgba(114, 87, 200, .22);
    }

    .event-card.blocked .tag,
    .stack .mini-card {
      border-color: rgba(114, 87, 200, .28);
      background: rgba(238, 232, 251, .78);
      color: #4d3d93;
    }

    .event-card.status-done,
    .agenda-row.status-done,
    .week-pill.status-done,
    .mobile-card.status-done {
      opacity: .78;
      background: var(--green-soft);
    }

    .event-card.status-done .event-title,
    .agenda-row.status-done strong,
    .week-pill.status-done strong {
      text-decoration: line-through;
      text-decoration-thickness: 2px;
      text-decoration-color: rgba(29, 38, 33, .34);
    }

    .event-card.status-in-progress {
      box-shadow: inset 0 0 0 2px rgba(47, 125, 92, .28), 0 10px 24px rgba(29, 38, 33, .07);
    }

    .event-card.status-cancelled,
    .agenda-row.status-cancelled,
    .week-pill.status-cancelled,
    .mobile-card.status-cancelled {
      opacity: .52;
      filter: grayscale(.35);
      background: var(--gray-soft);
    }

    .event-card.status-cancelled .event-title,
    .agenda-row.status-cancelled strong,
    .week-pill.status-cancelled strong {
      text-decoration: line-through;
    }

    .event-card.conflict {
      outline: 2px solid rgba(185, 75, 75, .86);
      outline-offset: -2px;
      background: linear-gradient(135deg, var(--rose-soft), rgba(255,255,255,.8));
      box-shadow: 0 0 0 4px rgba(197, 79, 74, .13), 0 10px 24px rgba(29, 38, 33, .08);
      animation: conflictNudge 320ms ease both;
    }

    .delete-selectable {
      position: relative;
    }

    .selected-delete {
      outline: 2px solid var(--rose);
      outline-offset: -2px;
      background: linear-gradient(135deg, var(--rose-soft), rgba(255,255,255,.86));
    }

    .select-dot {
      position: absolute;
      top: 8px;
      right: 8px;
      z-index: 6;
      width: 28px;
      height: 28px;
      min-height: 28px;
      border-radius: 999px;
      display: inline-grid;
      place-items: center;
      border: 2px solid rgba(79, 96, 117, .55);
      background: rgba(255,255,255,.92);
      color: transparent;
      box-shadow: 0 6px 14px rgba(32, 38, 49, .12);
      padding: 0;
    }

    .select-dot.selected {
      background: var(--rose);
      border-color: var(--rose);
      color: #fff;
    }

    .select-dot .icon-svg {
      width: 15px;
      height: 15px;
      stroke-width: 3;
    }

    .event-card:hover,
    .week-pill:hover,
    .agenda-row:hover,
    .mobile-card:hover,
    .big-tile:hover {
      transform: translateY(-2px);
      box-shadow: 0 14px 30px rgba(32, 38, 49, .11);
    }

    .drag-handle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      border-radius: 8px;
      background: rgba(255,255,255,.72);
      color: #47534c;
      cursor: grab;
      touch-action: none;
    }

    .event-spine {
      position: relative;
      min-height: 100%;
      padding: 10px 5px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      border-right: 1px solid rgba(255,255,255,.72);
      background: rgba(255,255,255,.38);
    }

    .event-spine::before {
      content: "";
      position: absolute;
      top: 24px;
      bottom: 24px;
      left: 50%;
      width: 3px;
      transform: translateX(-50%);
      border-radius: 99px;
      background: linear-gradient(to bottom, var(--event-border), rgba(255,255,255,.1));
    }

    .event-card:not(.fuzzy) .event-spine::before {
      background: var(--event-border);
    }

    .spine-mark {
      position: relative;
      z-index: 1;
      display: grid;
      place-items: center;
      gap: 3px;
      color: #314039;
      font-size: 11px;
      font-weight: 760;
      line-height: 1;
    }

    .spine-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--event-border);
      border: 2px solid rgba(255,255,255,.95);
      box-shadow: 0 2px 8px rgba(29, 38, 33, .16);
    }

    .event-body {
      min-width: 0;
      padding: 12px 13px;
      display: grid;
      align-content: start;
    }

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

    .event-title {
      font-weight: 760;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .event-time {
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      padding-top: 2px;
    }

    .meta-row {
      display: flex;
      gap: 7px;
      flex-wrap: wrap;
      margin-top: 8px;
    }

    .tag {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      min-height: 24px;
      border-radius: 8px;
      padding: 2px 7px;
      background: rgba(255,255,255,.72);
      color: #39453f;
      font-size: 12px;
      border: 1px solid rgba(255,255,255,.64);
    }

    .event-actions {
      display: flex;
      gap: 6px;
      margin-top: 10px;
      flex-wrap: wrap;
    }

    .tiny-btn {
      min-height: 30px;
      border-radius: 8px;
      padding: 0 9px;
      background: rgba(255,255,255,.76);
      color: #26332c;
      border: 1px solid rgba(255,255,255,.8);
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 12px;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease, color var(--motion-fast) ease;
    }

    .tiny-btn[data-action="done"] {
      background: var(--green);
      border-color: var(--green);
      color: #fff;
    }

    .tiny-btn[data-action="edit"] {
      background: var(--gray-action);
      border-color: var(--gray-action);
      color: #fff;
    }

    .tiny-btn[data-action="cancel"],
    .tiny-btn[data-action="delete"],
    #clearDataBtn {
      background: var(--rose);
      border-color: var(--rose);
      color: #fff;
    }

    .quick-panel {
      padding: 18px;
      position: sticky;
      top: 14px;
      transition: box-shadow var(--motion-med) ease, border-color var(--motion-med) ease, transform var(--motion-med) ease;
    }

    .quick-panel:focus-within {
      border-color: rgba(63, 95, 186, .34);
      box-shadow: 0 16px 34px rgba(63, 95, 186, .12);
    }

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

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

    .field.full {
      grid-column: 1 / -1;
    }

    label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }

    input,
    select,
    textarea {
      width: 100%;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #fff;
      color: var(--text);
      min-height: 42px;
      padding: 9px 10px;
      outline: none;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
      transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
    }

    textarea {
      min-height: 96px;
      resize: vertical;
      line-height: 1.45;
    }

    input:focus,
    select:focus,
    textarea:focus {
      border-color: var(--indigo);
      box-shadow: 0 0 0 3px rgba(63, 95, 186, .15);
    }

    .hint {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.5;
      margin: 8px 0 0;
    }

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

    .mini-card {
      border: 1px solid var(--line);
      background: #fff;
      border-radius: 8px;
      padding: 10px;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, border-color var(--motion-fast) ease;
    }

    .mini-card:hover {
      transform: translateY(-1px);
      border-color: rgba(114, 87, 200, .28);
      box-shadow: 0 8px 18px rgba(32, 38, 49, .07);
    }

    .mini-card strong {
      display: block;
      font-size: 14px;
      margin-bottom: 5px;
    }

    .mini-card p {
      margin: 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.45;
    }

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

    .status-item {
      display: grid;
      grid-template-columns: 24px 1fr;
      gap: 8px;
      align-items: start;
      padding: 9px;
      border-radius: 8px;
      background: #f4f7f4;
      color: #314039;
      font-size: 13px;
      border: 1px solid rgba(216, 226, 220, .78);
      border-left: 4px solid var(--green);
    }

    .status-item.warning {
      background: var(--amber-soft);
      color: #643f09;
      border-left-color: var(--amber);
    }

    .status-item.danger {
      background: var(--rose-soft);
      color: #772222;
      border-left-color: var(--rose);
    }

    .sync-actions {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      margin-top: 10px;
    }

    .backup-actions {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      margin-top: 10px;
    }

    .ai-output {
      margin-top: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      padding: 10px;
      display: none;
      gap: 10px;
    }

    .ai-output.open {
      display: grid;
      animation: panelOpen var(--motion-med) ease both;
    }

    .ai-output pre {
      margin: 0;
      max-height: 220px;
      overflow: auto;
      white-space: pre-wrap;
      word-break: break-word;
      border-radius: 8px;
      background: #f1f4f1;
      padding: 10px;
      font-size: 12px;
      line-height: 1.45;
    }

    .ai-confirm-row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .danger-btn {
      background: var(--rose);
      color: #fff;
      border-color: var(--rose);
    }

    .text-btn:disabled,
    .icon-btn:disabled,
    .tiny-btn:disabled {
      cursor: not-allowed;
      opacity: .55;
      transform: none;
      box-shadow: none;
    }

    .offline-badge {
      display: none;
      min-height: 30px;
      align-items: center;
      gap: 6px;
      border-radius: 8px;
      padding: 0 9px;
      background: var(--amber-soft);
      color: #653f08;
      font-size: 12px;
      font-weight: 700;
    }

    .offline-badge.show {
      display: inline-flex;
    }

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

    .today-board,
    .mobile-focus,
    .editor-board {
      display: grid;
      gap: 12px;
      animation: viewIn var(--motion-med) ease both;
    }

    .week-grid,
    .month-grid,
    .timeline {
      animation: viewIn var(--motion-med) ease both;
    }

    .today-hero {
      display: grid;
      grid-template-columns: minmax(0, 1.45fr) minmax(250px, .75fr);
      gap: 12px;
    }

    .big-tile {
      border-radius: 8px;
      padding: 18px;
      border: 1px solid var(--line);
      background: linear-gradient(135deg, #fff, #f7faf7);
      min-height: 148px;
      display: grid;
      align-content: start;
      gap: 8px;
      box-shadow: var(--shadow-soft);
      position: relative;
      overflow: hidden;
    }

    .big-tile.urgent {
      background: linear-gradient(135deg, #a84246, #c96b4f);
      color: #fff;
      border-color: transparent;
      animation: urgentBreath 2.8s ease-in-out infinite;
    }

    .big-tile.focus-tile:not(.urgent) {
      border-color: #c8dfd1;
      background: linear-gradient(135deg, #e5f3eb, #ffffff);
    }

    .big-tile.next-tile {
      border-left: 5px solid var(--green);
    }

    .big-tile.next-tile.warning {
      border-left-color: var(--amber);
      background: linear-gradient(135deg, #fff8ea, #fff);
    }

    .big-tile.next-tile.danger {
      border-left-color: var(--rose);
      background: linear-gradient(135deg, #fff0ee, #fff);
    }

    .big-tile h3 {
      margin: 0;
      font-size: clamp(20px, 2.2vw, 26px);
      line-height: 1.22;
    }

    .big-tile p {
      margin: 0;
      color: inherit;
      line-height: 1.48;
    }

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

    .agenda-row {
      display: grid;
      grid-template-columns: 74px 1fr auto;
      gap: 10px;
      align-items: center;
      border: 1px solid var(--line);
      background: rgba(255,255,255,.9);
      border-radius: 8px;
      padding: 11px;
      border-left: 4px solid #d8e2dc;
      box-shadow: 0 6px 16px rgba(29, 38, 33, .035);
      animation: cardIn var(--motion-med) ease both;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease, opacity var(--motion-fast) ease;
    }

    .agenda-row.status-in-progress {
      border-left-color: var(--green);
      background: #f3faf6;
    }

    .agenda-row.status-cancelled {
      border-left-color: #aeb8b1;
    }

    .agenda-row strong {
      overflow-wrap: anywhere;
    }

    .agenda-row small {
      color: var(--muted);
    }

    .status-tag {
      background: rgba(255,255,255,.72);
      font-weight: 800;
    }

    .month-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(96px, 1fr));
      gap: 8px;
      overflow-x: auto;
    }

    .month-cell {
      min-height: 104px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      padding: 8px;
      display: grid;
      align-content: start;
      gap: 6px;
    }

    .month-cell.muted {
      opacity: .45;
    }

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

    .month-chip {
      border-radius: 8px;
      padding: 5px 7px;
      background: var(--green-soft);
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .month-chip.exam {
      background: #ffe1d8;
      color: #7a2717;
    }

    .month-chip.holiday {
      background: #dff2f4;
      color: #195b61;
    }

    .month-chip.alert {
      background: var(--rose-soft);
      color: #772222;
    }

    .month-chip.homework {
      background: #f8e3ef;
      color: #75304f;
    }

    .mobile-card {
      border-radius: 8px;
      padding: 16px;
      background: #fff;
      border: 1px solid var(--line);
      display: grid;
      gap: 8px;
      box-shadow: var(--shadow-soft);
      animation: cardIn var(--motion-med) ease both;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
    }

    .mobile-card.primary-focus {
      background: linear-gradient(135deg, #1f5c45, #2f7d5c);
      color: #fff;
      border-color: #1f5c45;
    }

    .editor-table {
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: auto;
      background: #fff;
    }

    .editor-table table {
      width: 100%;
      border-collapse: collapse;
      min-width: 980px;
    }

    .editor-table th,
    .editor-table td {
      padding: 10px;
      border-bottom: 1px solid var(--line);
      text-align: left;
      font-size: 13px;
      vertical-align: top;
    }

    .editor-table th {
      background: var(--surface-2);
      color: #3c4841;
      font-weight: 750;
      position: sticky;
      top: 0;
    }

    .inline-input,
    .inline-select {
      min-height: 34px;
      padding: 6px 8px;
      border-radius: 8px;
      min-width: 110px;
    }

    .day-column {
      min-height: 250px;
      padding: 12px;
      background: rgba(255,255,255,.82);
    }

    .day-column h3 {
      margin: 0 0 9px;
      font-size: 14px;
      color: #2f3f36;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .day-column h3 small {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
    }

    .week-pill {
      border-radius: 8px;
      border-left: 4px solid var(--green);
      padding: 9px;
      background: #fff;
      margin-bottom: 8px;
      font-size: 12px;
      display: grid;
      gap: 4px;
      line-height: 1.35;
      box-shadow: 0 6px 14px rgba(29, 38, 33, .04);
      overflow-wrap: anywhere;
      animation: cardIn var(--motion-med) ease both;
      transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease, opacity var(--motion-fast) ease;
    }

    .week-pill strong {
      font-size: 13px;
      color: #1f2d26;
    }

    .week-pill.class {
      border-left-color: var(--blue);
      background: var(--blue-soft);
    }

    .week-pill.alert {
      border-left-color: var(--orange);
      background: var(--orange-soft);
    }

    .week-pill.personal {
      border-left-color: var(--violet);
      background: var(--violet-soft);
    }

    .drawer {
      position: fixed;
      inset: auto 22px 22px auto;
      width: min(420px, calc(100vw - 44px));
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #fff;
      box-shadow: var(--shadow);
      padding: 14px;
      display: none;
      z-index: 20;
    }

    .drawer.open {
      display: block;
    }

    .drawer-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
    }

    .drawer-head h2 {
      margin: 0;
      font-size: 17px;
    }

    .toast {
      position: fixed;
      left: 50%;
      bottom: 18px;
      transform: translateX(-50%);
      background: #1d2621;
      color: #fff;
      border-radius: 8px;
      padding: 10px 14px;
      box-shadow: var(--shadow);
      display: none;
      z-index: 30;
      font-size: 14px;
    }

    .toast.show {
      display: block;
    }

    .delete-drop-zone {
      position: fixed;
      top: max(92px, env(safe-area-inset-top));
      right: 12px;
      bottom: max(22px, env(safe-area-inset-bottom));
      width: 96px;
      z-index: 26;
      border-radius: 8px;
      background: linear-gradient(180deg, rgba(143, 51, 47, .94), rgba(197, 79, 74, .9));
      color: #fff;
      border: 1px solid rgba(255,255,255,.35);
      box-shadow: 0 18px 44px rgba(143, 51, 47, .26);
      display: grid;
      place-items: center;
      align-content: center;
      gap: 8px;
      text-align: center;
      padding: 14px 10px;
      opacity: 0;
      pointer-events: none;
      transform: translateX(114px);
      transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease, background var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
    }

    .delete-drop-zone.show {
      opacity: 1;
      transform: translateX(0);
    }

    .delete-drop-zone.over {
      background: linear-gradient(180deg, #b62f2a, #e35d4e);
      box-shadow: 0 22px 54px rgba(197, 79, 74, .36);
    }

    .delete-drop-zone strong {
      font-size: 13px;
      line-height: 1.25;
    }

    .delete-drop-zone span {
      font-size: 11px;
      opacity: .86;
      line-height: 1.3;
    }

    .empty {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
      padding: 10px;
      border: 1px dashed var(--line);
      border-radius: 8px;
      background: rgba(255,255,255,.5);
    }

    @keyframes viewIn {
      from {
        opacity: 0;
        transform: translateY(8px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes cardIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes panelOpen {
      from {
        opacity: 0;
        transform: translateY(-6px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes conflictNudge {
      0% {
        transform: translateY(0);
      }
      45% {
        transform: translateY(-2px);
      }
      100% {
        transform: translateY(0);
      }
    }

    @keyframes urgentBreath {
      0%, 100% {
        box-shadow: 0 10px 22px rgba(197, 79, 74, .18);
      }
      50% {
        box-shadow: 0 14px 30px rgba(197, 79, 74, .28);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
      }
    }

    @media (max-width: 1180px) {
      .shell {
        grid-template-columns: 300px minmax(0, 1fr);
      }

      .quick-panel {
        grid-column: 1 / -1;
        position: static;
      }
    }

    @media (max-width: 760px) {
      .app {
        padding: 8px 10px 12px;
      }

      .topbar {
        align-items: center;
        flex-direction: row;
        gap: 8px;
        padding: 8px;
        margin-bottom: 8px;
      }

      .brand {
        flex: 0 0 auto;
        gap: 8px;
      }

      .brand h1 {
        font-size: 18px;
      }

      .brand p {
        display: none;
      }

      .toolbar {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: end;
        display: grid;
        grid-template-columns: minmax(86px, 1fr) auto auto auto;
        gap: 6px;
      }

      .toolbar .text-btn,
      .toolbar .icon-btn,
      .language-picker {
        width: 100%;
        min-width: 0;
      }

      .toolbar .icon-btn {
        width: auto;
      }

      .language-picker {
        justify-content: center;
        padding: 0 7px;
        min-height: 36px;
        box-shadow: none;
      }

      .language-picker span {
        display: none;
      }

      .language-picker select {
        min-height: 30px;
        padding: 3px 20px 3px 6px;
        font-size: 12px;
      }

      .delete-tools {
        gap: 4px;
      }

      #quickAddBtn,
      #deleteModeBtn,
      .more-actions > summary {
        min-height: 36px;
        padding: 0 9px;
        box-shadow: none;
        font-size: 12px;
      }

      #confirmDeleteBtn {
        min-height: 36px;
        padding: 0 8px;
        font-size: 12px;
      }

      #cancelDeleteModeBtn {
        width: 36px;
        min-height: 36px;
        box-shadow: none;
      }

      .more-actions {
        display: block;
        position: relative;
      }

      .more-actions > summary {
        display: inline-flex;
      }

      .more-actions-menu {
        display: none;
      }

      .more-actions[open] .more-actions-menu {
        position: absolute;
        right: 0;
        top: calc(100% + 8px);
        width: min(230px, calc(100vw - 20px));
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255,255,255,.98);
        box-shadow: var(--shadow);
        display: grid;
        gap: 7px;
        z-index: 40;
      }

      .more-actions[open] .more-actions-menu .text-btn,
      .more-actions[open] .more-actions-menu .offline-badge {
        width: 100%;
      }

      .view-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        overflow-x: visible;
        gap: 5px;
        padding: 5px;
        margin-bottom: 8px;
      }

      .view-tab {
        min-width: 0;
        min-height: 36px;
        padding: 0 6px;
        gap: 5px;
        font-size: 12px;
      }

      .shell {
        grid-template-columns: 1fr;
        gap: 10px;
      }

      .main-panel {
        order: 1;
      }

      .side-panel {
        order: 2;
      }

      .quick-panel {
        order: 3;
      }

      .date-strip {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        overflow-x: visible;
        padding-bottom: 5px;
        margin-bottom: 8px;
      }

      .day-tab {
        min-width: 0;
        padding: 6px 1px;
      }

      .day-tab strong {
        font-size: 12px;
      }

      .day-tab span {
        font-size: 10px;
      }

      .focus-alert.high,
      .focus-alert.medium {
        padding: 13px 14px;
        min-height: 86px;
      }

      .focus-alert h2 {
        font-size: 20px;
      }

      .focus-alert {
        margin-bottom: 8px;
      }

      .focus-alert.empty {
        padding: 10px 12px;
      }

      .timeline {
        min-height: 760px;
      }

      .event-card {
        left: 54px;
        right: 8px;
        padding: 0;
        grid-template-columns: 48px minmax(0, 1fr);
        min-height: 72px;
      }

      .hour {
        padding-left: 8px;
        font-size: 11px;
      }

      .event-top {
        display: grid;
        gap: 5px;
      }

      .event-time {
        white-space: normal;
      }

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

      .field.full {
        grid-column: 1 / -1;
      }

      input,
      select,
      textarea,
      .text-btn,
      .icon-btn {
        min-height: 44px;
      }

      textarea {
        min-height: 78px;
      }

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

      .big-tile {
        min-height: 124px;
        padding: 16px;
      }

      .agenda-row {
        grid-template-columns: 64px 1fr;
        align-items: start;
      }

      .agenda-row .tiny-btn {
        grid-column: 1 / -1;
        width: 100%;
      }

      .month-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        overflow-x: visible;
        gap: 4px;
      }

      .month-cell {
        min-height: 92px;
        padding: 6px;
      }

      .brand-mark {
        width: 34px;
        height: 34px;
      }

      .quick-panel,
      .panel {
        padding: 12px;
      }

      .week-grid {
        grid-template-columns: 1fr;
        overflow-x: visible;
        gap: 10px;
      }

      .day-column {
        min-height: 0;
        padding: 12px;
      }

      .day-column.empty-week {
        display: none;
      }

      .day-column h3 {
        margin-bottom: 10px;
        font-size: 15px;
      }

      .week-pill {
        padding: 12px;
        margin-bottom: 9px;
        font-size: 13px;
      }

      .week-pill strong {
        font-size: 15px;
      }

      .select-dot {
        width: 32px;
        height: 32px;
        min-height: 32px;
      }

      .sync-actions,
      .backup-actions {
        grid-template-columns: 1fr;
      }

      .delete-drop-zone {
        top: auto;
        left: 10px;
        right: 10px;
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        min-height: 78px;
        grid-auto-flow: column;
        align-content: center;
        justify-content: center;
        transform: translateY(98px);
      }

      .delete-drop-zone.show {
        transform: translateY(0);
      }
    }
  
