/* ==========================================================================
   EXECUTIVE DAILY PLANNER - AUTHENTIC RULED NOTEBOOK WITH HIGHLIGHTERS
   STRICT BASELINE GRID (NO OVERWRITE) | NO BADGES | VIBRANT HIGHLIGHTER MARKS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@600;700&family=Kalam:wght@700&display=swap');

#todaysDiaryModal .tdm-modal-dialog {
    max-width: 580px;
    width: 95%;
    margin: 1.5rem auto;
    transition: max-width 0.85s cubic-bezier(0.25, 1, 0.35, 1);
}

#todaysDiaryModal .tdm-modal-dialog.tdm-spread-open {
    max-width: 1120px;
}

#todaysDiaryModal .tdm-modal-content {
    background: transparent !important;
}

/* 1. Authentic Executive Leather Outer Cover (Balanced Cognac & Saddle Border) */
#todaysDiaryModal .tdm-leather-cover {
    background: linear-gradient(135deg, #b87333 0%, #9c5c24 50%, #7d4517 100%);
    border-radius: 20px;
    padding: 20px 18px 16px 18px;
    position: relative;
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #4a220b;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* A brief warm glint follows the single hard-cover turn in either direction. */
#todaysDiaryModal .tdm-leather-cover {
    position: relative;
}

#todaysDiaryModal[data-cover-state="opening"] .tdm-leather-cover::after,
#todaysDiaryModal[data-cover-state="closing"] .tdm-leather-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 30;
    border-radius: inherit;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 48%, rgba(255, 227, 124, .25), transparent 38%),
        radial-gradient(circle at 50% 18%, rgba(255, 236, 164, .85) 0 1px, transparent 4px),
        radial-gradient(circle at 52% 31%, rgba(255, 205, 74, .75) 0 1px, transparent 5px),
        radial-gradient(circle at 48% 63%, rgba(255, 236, 164, .8) 0 1px, transparent 4px),
        radial-gradient(circle at 51% 82%, rgba(255, 205, 74, .7) 0 1px, transparent 5px);
    mix-blend-mode: screen;
    animation: tdm-cover-gold-glint .65s ease-out both;
}

@keyframes tdm-cover-gold-glint {
    0% {
        opacity: 0;
        filter: brightness(1);
    }

    35% {
        opacity: .9;
        filter: brightness(1.25);
    }

    100% {
        opacity: 0;
        filter: brightness(1);
    }
}

/* 2. Gold Metal Corners */
#todaysDiaryModal .tdm-corner {
    position: absolute;
    width: 32px;
    height: 32px;
    z-index: 10;
    pointer-events: none;
    border-color: #d4af37;
    border-style: solid;
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

#todaysDiaryModal .tdm-corner-tl {
    top: 6px;
    left: 6px;
    border-width: 4px 0 0 4px;
    border-top-left-radius: 12px;
}

#todaysDiaryModal .tdm-corner-tr {
    top: 6px;
    right: 6px;
    border-width: 4px 4px 0 0;
    border-top-right-radius: 12px;
}

#todaysDiaryModal .tdm-corner-bl {
    bottom: 6px;
    left: 6px;
    border-width: 0 0 4px 4px;
    border-bottom-left-radius: 12px;
}

#todaysDiaryModal .tdm-corner-br {
    bottom: 6px;
    right: 6px;
    border-width: 0 4px 4px 0;
    border-bottom-right-radius: 12px;
}

/* 3. Silk Red Bookmark Ribbon - Glides from Spine to Center Crease */
#todaysDiaryModal .tdm-bookmark-ribbon {
    position: absolute;
    top: -8px;
    left: 48px;
    width: 24px;
    height: 64px;
    background: linear-gradient(180deg, #991b1b 0%, #dc2626 70%, #b91c1c 100%);
    box-shadow: 1px 3px 6px rgba(0, 0, 0, 0.25);
    z-index: 25;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
    pointer-events: none;
    transition: left 0.85s cubic-bezier(0.25, 1, 0.35, 1), transform 0.85s ease;
}

#todaysDiaryModal .tdm-modal-dialog.tdm-spread-open .tdm-bookmark-ribbon {
    left: 50%;
    transform: translateX(-50%);
}

/* 4. Close Button (Top-Right of Leather Cover) */
#todaysDiaryModal .tdm-book-close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(254, 240, 138, 0.55);
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 25;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

#todaysDiaryModal .tdm-book-close-btn:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    transform: scale(1.08);
}

/* 5. 3D Viewport & Book Container (Expands from Closed 530px to 2-Page 1060px Spread) */
#todaysDiaryModal .tdm-book-viewport {
    position: relative;
    border-radius: 10px;
    overflow: visible;
    min-height: 630px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
}

#todaysDiaryModal .tdm-book-container {
    position: relative;
    width: 530px;
    height: 630px;
    margin: 0 auto;
    border-radius: 8px;
    perspective: 2600px;
    transform-style: preserve-3d;
    transition: width 0.85s cubic-bezier(0.25, 1, 0.35, 1);
}

#todaysDiaryModal .tdm-book-container.tdm-spread-open {
    width: 1060px;
}

/* Static Front Cover (Shown when book is closed, fills 530px container) */
#todaysDiaryModal .tdm-front-cover {
    position: absolute;
    left: 0;
    top: 0;
    width: 530px;
    height: 630px;
    display: flex;
    flex-direction: row;
    border-radius: 8px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
    z-index: 20;
    overflow: visible;
    background: #874614;
}

/* 7. Authentic Ruled Paper Pages (Left Page & Right Page) */
#todaysDiaryModal .tdm-page {
    width: 530px;
    height: 630px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: #fbf9f4;
    padding: 16px 20px 12px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
}

#todaysDiaryModal .tdm-page-left {
    box-shadow: inset -16px 0 20px -10px rgba(0, 0, 0, 0.08);
}

#todaysDiaryModal .tdm-page-right {
    box-shadow: inset 16px 0 20px -10px rgba(0, 0, 0, 0.08);
}

/* Custom Smooth Golden Scrollbar for Ruled Container */
#todaysDiaryModal .tdm-scroll-ruled {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d4af37 rgba(0, 0, 0, 0.05);
    padding-right: 4px;
}

#todaysDiaryModal .tdm-scroll-ruled::-webkit-scrollbar {
    width: 6px;
}

#todaysDiaryModal .tdm-scroll-ruled::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 3px;
}

#todaysDiaryModal .tdm-scroll-ruled::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
}

#todaysDiaryModal .tdm-scroll-ruled::-webkit-scrollbar-thumb:hover {
    background: #b8860b;
}

/* Bottom Clasp Bar & Buttons */
#todaysDiaryModal .tdm-clasp-bar {
    width: 100%;
    max-width: 530px;
    margin: 0 auto;
    transition: max-width 0.85s cubic-bezier(0.25, 1, 0.35, 1);
}

#todaysDiaryModal .tdm-spread-open .tdm-clasp-bar {
    max-width: 1060px;
}

#todaysDiaryModal .tdm-spread-badge {
    background: rgba(0, 0, 0, 0.45);
    color: #fef08a;
    border: 1px solid rgba(254, 240, 138, 0.4);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 4px 14px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    user-select: none;
}

#todaysDiaryModal .tdm-clasp-nav-btn {
    background: rgba(0, 0, 0, 0.4);
    color: #fef08a;
    border: 1px solid rgba(254, 240, 138, 0.4);
    font-weight: 700;
    border-radius: 6px;
    padding: 6px 14px;
    transition: all 0.2s ease;
}

#todaysDiaryModal .tdm-clasp-nav-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border-color: #fef08a;
    transform: translateY(-1px);
}

#todaysDiaryModal .tdm-page-left {
    box-shadow: inset -16px 0 20px -10px rgba(0, 0, 0, 0.08);
}

#todaysDiaryModal .tdm-page-right {
    box-shadow: inset 16px 0 20px -10px rgba(0, 0, 0, 0.08);
}

#todaysDiaryModal .tdm-sheet-front {
    z-index: 2;
}

#todaysDiaryModal .tdm-sheet-back {
    transform: rotateY(180deg);
    z-index: 1;
    box-shadow: inset -16px 0 20px -10px rgba(0, 0, 0, 0.1);
}

/* 9. Turn Page Dog-Ear Hints */
#todaysDiaryModal .tdm-turn-hint-right {
    position: absolute;
    bottom: 10px;
    right: 16px;
    padding: 4px 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #f8fafc;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    z-index: 12;
}

#todaysDiaryModal .tdm-turn-hint-right:hover {
    background: #0f172a;
    color: #60a5fa;
    border-color: #60a5fa;
    transform: translateX(3px);
}

#todaysDiaryModal .tdm-turn-hint-left {
    position: absolute;
    bottom: 10px;
    left: 16px;
    padding: 4px 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #f8fafc;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    z-index: 12;
}

#todaysDiaryModal .tdm-turn-hint-left:hover {
    background: #0f172a;
    color: #60a5fa;
    border-color: #60a5fa;
    transform: translateX(-3px);
}

/* ==========================================================================
   10. STRICT BASELINE GRID & RULED ROWS (TEXT INSIDE LINES, NEVER OVERWRITING)
   ========================================================================== */

#todaysDiaryModal .tdm-page-header {
    height: 52px;
    min-height: 52px;
    margin-bottom: 2px;
    padding-bottom: 4px;
    border-bottom: 2px solid #94a3b8;
    box-sizing: border-box;
}

#todaysDiaryModal .tdm-ruled-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Ruled Row (Exact 32px height, with bottom ruling line) */
#todaysDiaryModal .tdm-ruled-row {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.38);
    box-sizing: border-box;
    font-size: 0.85rem;
    color: #0f172a;
    line-height: 32px;
}

/* Margin Column (Left of Red Line) */
#todaysDiaryModal .tdm-row-margin {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: #64748b;
    font-size: 0.82rem;
}

/* Body Column (Right of Red Line) */
#todaysDiaryModal .tdm-row-body {
    flex: 1;
    padding-left: 10px;
    padding-right: 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
}

#todaysDiaryModal .tdm-ruled-meta {
    font-size: 0.78rem;
    color: #475569;
}

#todaysDiaryModal .tdm-task-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

/* Production Task 3-Line Structure */
#todaysDiaryModal .tdm-prod-line-1 {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

#todaysDiaryModal .tdm-prod-line-2 {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

#todaysDiaryModal .tdm-prod-line-3 {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    border-bottom: 1.5px solid rgba(148, 163, 184, 0.55);
}

#todaysDiaryModal .tdm-task-date {
    font-size: 0.76rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.2px;
}

/* Ruled Section Headings */
#todaysDiaryModal .tdm-ruled-heading {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #94a3b8;
    box-sizing: border-box;
    padding-left: 46px;
    padding-right: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #1e293b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
}

#todaysDiaryModal .tdm-ruled-heading>span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

#todaysDiaryModal .tdm-ruled-heading>div {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Empty Ruled Lines (Preserves Notebook Look on Blank Areas) */
#todaysDiaryModal .tdm-ruled-empty {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.38);
}

/* Checkbox in Margin */
#todaysDiaryModal .tdm-checkbox-square {
    width: 15px;
    height: 15px;
    border: 1.5px solid #475569;
    border-radius: 3px;
    background: #ffffff;
    display: inline-block;
}

/* ==========================================================================
   11. AUTHENTIC STATIONERY HIGHLIGHTERS (NO BADGES, NO CAPSULES)
   ========================================================================== */

#todaysDiaryModal .tdm-hl {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    margin: 0 2px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.35;
    border: none !important;
    border-radius: 2px;
    box-shadow: none !important;
    vertical-align: middle;
    letter-spacing: 0.2px;
}

/* 1. Fluorescent Yellow (Projects, Weekday & Labels) */
#todaysDiaryModal .tdm-hl-yellow {
    background-color: rgba(254, 240, 138, 0.9);
    color: #713f12;
}

/* 2. Soft Coral / Pink (Overdue & High Priority) */
#todaysDiaryModal .tdm-hl-pink {
    background-color: rgba(254, 202, 202, 0.92);
    color: #991b1b;
}

/* 3. Mint Green (On-Time & Due Dates) */
#todaysDiaryModal .tdm-hl-green {
    background-color: rgba(187, 247, 208, 0.9);
    color: #065f46;
}

/* 4. Sky Blue (Codes, Stages & Counts) */
#todaysDiaryModal .tdm-hl-blue {
    background-color: rgba(186, 230, 253, 0.9);
    color: #075985;
}

/* 5. Warm Orange (Notes & Reminders) */
#todaysDiaryModal .tdm-hl-orange {
    background-color: rgba(254, 215, 170, 0.92);
    color: #9a3412;
}

/* 6. Soft Lavender (Meetings & Assigners) */
#todaysDiaryModal .tdm-hl-purple {
    background-color: rgba(233, 213, 255, 0.9);
    color: #581c87;
}

/* ==========================================================================
   12. DATE STAMP & MASTHEAD
   ========================================================================== */

#todaysDiaryModal .tdm-date-stamp {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 4px;
}

#todaysDiaryModal .tdm-date-picker-input {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

#todaysDiaryModal .tdm-date-picker-input:focus-visible {
    outline: 2px solid #b7791f;
    outline-offset: 3px;
    border-radius: 3px;
}

#todaysDiaryModal .tdm-empty-date-trigger {
    position: relative;
    display: inline-block;
    margin-top: 12px;
    color: #243247;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#todaysDiaryModal .tdm-empty-agenda {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 160px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

#todaysDiaryModal .tdm-empty-agenda h3 {
    margin: 0 0 14px;
    color: #243247;
    font-family: 'Kalam', cursive;
    font-size: 1.45rem;
}

#todaysDiaryModal .tdm-empty-agenda p {
    margin: 0;
    color: #667085;
}

#todaysDiaryModal .tdm-empty-date-trigger:focus-within {
    outline: 2px solid #b7791f;
    outline-offset: 3px;
    border-radius: 3px;
}

#todaysDiaryModal .tdm-view-all-tasks {
    display: block;
    margin: 16px auto;
    font-family: 'Kalam', cursive;
    font-weight: 700;
}

#todaysDiaryModal .tdm-project-group-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 16px 0 0;
    padding: 8px 4px 0;
    border-top: 1px solid rgba(112, 126, 148, 0.2);
    color: #243247;
    text-align: center;
    overflow-wrap: anywhere;
}

#todaysDiaryModal .tdm-project-group-heading:first-of-type {
    margin-top: 16px;
}

#todaysDiaryModal .tdm-project-group-heading .tdm-view-all-tasks {
    margin: 4px auto 8px;
}

#todaysDiaryModal .tdm-project-task-count {
    white-space: nowrap;
}

#todaysDiaryModal .tdm-view-all-tasks.tdm-project-toggle-after-items {
    margin-top: 64px;
}

#todaysDiaryModal .tdm-view-all-tasks:focus-visible {
    outline: 2px solid #b7791f;
    outline-offset: 2px;
}

#todaysDiaryModal .tdm-stamp-day {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Caveat', 'Georgia', serif;
    color: #0f172a;
    line-height: 1;
}

#todaysDiaryModal .tdm-stamp-my-wrap {
    display: flex;
    flex-direction: column;
    border-left: 2px solid #ef4444;
    padding-left: 6px;
}

#todaysDiaryModal .tdm-stamp-month {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #dc2626;
    line-height: 1.1;
}

#todaysDiaryModal .tdm-stamp-year {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

#todaysDiaryModal .tdm-page-title-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #64748b;
    margin-top: 1px;
}

/* ==========================================================================
   13. COMPLETION SEAL & FOOTER
   ========================================================================== */

#todaysDiaryModal .tdm-agenda-seal {
    border: 2px dashed #059669;
    color: #059669;
    padding: 3px 12px;
    border-radius: 6px;
    background: rgba(236, 253, 245, 0.85);
    font-weight: 700;
    font-size: 0.8rem;
    font-family: 'Kalam', cursive;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#todaysDiaryModal .tdm-page-footer {
    height: 22px;
    font-size: 0.78rem;
    font-family: 'Kalam', cursive;
    color: #94a3b8;
    margin-top: auto;
    display: flex;
    align-items: center;
}

#todaysDiaryModal .tdm-page-left .tdm-page-footer {
    justify-content: flex-end;
    padding-right: 24px;
}

#todaysDiaryModal .tdm-page-right .tdm-page-footer {
    justify-content: flex-start;
    padding-left: 24px;
}

/* 14. Clasp Bar */
#todaysDiaryModal .tdm-clasp-bar {
    border-top: 1px dashed rgba(254, 240, 138, 0.4);
    margin-top: 8px;
}

/* Hide Clasp Bar & Bottom Close Button on Front Cover */
#todaysDiaryModal .tdm-modal-dialog.tdm-closed-state .tdm-clasp-bar,
#todaysDiaryModal .tdm-modal-dialog.tdm-closed-state #tdmCloseDiaryStartDayBtn {
    display: none !important;
}

#todaysDiaryModal .tdm-page-indicator {
    background: rgba(45, 20, 5, 0.6);
    color: #fef08a;
    border: 1px solid rgba(254, 240, 138, 0.35);
    padding: 4px 9px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 700;
}

#todaysDiaryModal .tdm-clasp-nav-btn {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(254, 240, 138, 0.4);
    color: #fef08a;
    padding: 3px 9px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#todaysDiaryModal .tdm-clasp-nav-btn:hover:not(:disabled) {
    background: rgba(254, 240, 138, 0.35);
    color: #ffffff;
    border-color: #fef08a;
    transform: translateY(-1px);
}

#todaysDiaryModal .tdm-clasp-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#todaysDiaryModal .tdm-spread-select {
    background: #4a220b;
    color: #fef08a;
    border: 1px solid rgba(254, 240, 138, 0.45);
    font-size: 0.76rem;
    font-family: monospace;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    max-width: 150px;
}

#todaysDiaryModal .tdm-spread-select option {
    background: #3b1805;
    color: #fef08a;
}

#todaysDiaryModal .tdm-leather-btn {
    background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
    border: 1.5px solid #fef08a;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.5px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(45, 20, 5, 0.4);
    transition: all 0.2s ease;
}

#todaysDiaryModal .tdm-leather-btn:hover {
    background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(45, 20, 5, 0.55);
    transform: translateY(-2px);
}

/* 15. Book Overlay */
#todaysDiaryModal .tdm-book-overlay {
    position: absolute;
    inset: 0;
    background: rgba(251, 249, 244, 0.96);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    font-family: 'Kalam', cursive;
    border-radius: 8px;
}

#todaysDiaryModal .tdm-front-cover {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    border-radius: 8px;
    background: #874614;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    overflow: visible;
}

#todaysDiaryModal .tdm-diary-spine-back {
    width: 44px;
    height: 100%;
    position: relative;
    background: linear-gradient(to left, #401b07 0%, #5e280c 40%, #7d3711 75%, #351505 100%);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: inset 2px 0 6px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

/* 1. Bound Leather Spine Hinge (Left Edge) */
#todaysDiaryModal .tdm-diary-spine {
    width: 44px;
    height: 100%;
    position: relative;
    background: linear-gradient(to right, #401b07 0%, #5e280c 40%, #7d3711 75%, #351505 100%);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    box-shadow: inset -2px 0 6px rgba(0, 0, 0, 0.6), inset 2px 0 4px rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
}

#todaysDiaryModal .tdm-spine-stitching-left {
    position: absolute;
    left: 4px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    border-left: 2px dashed rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal .tdm-spine-stitching-right {
    position: absolute;
    right: 4px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    border-right: 2px dashed rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal .tdm-spine-crease {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(255, 255, 255, 0.1) 100%);
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.4);
}

/* 3 Horizontal Debossed Raised Binding Ribs */
#todaysDiaryModal .tdm-spine-rib {
    width: 100%;
    height: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.7) 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 -1px 2px rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-bottom: 1px solid rgba(0, 0, 0, 0.6);
}

/* 2. Main Leather Cover Face */
#todaysDiaryModal .tdm-diary-face {
    flex: 1;
    position: relative;
    padding: 16px 20px 14px 16px;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 35%, #b36427 0%, #8c4715 55%, #66320d 100%);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.15);
}

/* Brass Ornamental Corner Brackets */
#todaysDiaryModal .tdm-brass-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    z-index: 10;
    pointer-events: none;
    border-color: #d4af37;
    border-style: solid;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

#todaysDiaryModal .tdm-brass-corner::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fef08a 40%, #854d0e 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

#todaysDiaryModal .tdm-brass-corner-tl {
    top: 8px;
    left: 8px;
    border-width: 3px 0 0 3px;
    border-top-left-radius: 6px;
}

#todaysDiaryModal .tdm-brass-corner-tl::after {
    top: 3px;
    left: 3px;
}

#todaysDiaryModal .tdm-brass-corner-tr {
    top: 8px;
    right: 8px;
    border-width: 3px 3px 0 0;
    border-top-right-radius: 6px;
}

#todaysDiaryModal .tdm-brass-corner-tr::after {
    top: 3px;
    right: 3px;
}

#todaysDiaryModal .tdm-brass-corner-bl {
    bottom: 8px;
    left: 8px;
    border-width: 0 0 3px 3px;
    border-bottom-left-radius: 6px;
}

#todaysDiaryModal .tdm-brass-corner-bl::after {
    bottom: 3px;
    left: 3px;
}

#todaysDiaryModal .tdm-brass-corner-br {
    bottom: 8px;
    right: 8px;
    border-width: 0 3px 3px 0;
    border-bottom-right-radius: 6px;
}

#todaysDiaryModal .tdm-brass-corner-br::after {
    bottom: 3px;
    right: 3px;
}

/* Saddle Stitching Frame */
#todaysDiaryModal .tdm-face-stitch-frame {
    flex: 1;
    border: 2px dashed rgba(254, 240, 138, 0.45);
    outline: 3px solid rgba(50, 20, 5, 0.6);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    position: relative;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
}

/* Debossed Hot-Foil Gold Stamping */
#todaysDiaryModal .tdm-foil-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2px;
}

#todaysDiaryModal .tdm-foil-emblem {
    margin-bottom: 4px;
    transition: transform 0.25s ease;
}

#todaysDiaryModal .tdm-foil-emblem:hover {
    transform: scale(1.05);
}

#todaysDiaryModal .tdm-cover-logo-embossed {
    max-width: 88px;
    max-height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

#todaysDiaryModal .tdm-foil-year {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 4px;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 0%, #fef3c7 30%, #fbbf24 65%, #b45309 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 3px rgba(30, 10, 2, 0.85));
    user-select: none;
}

#todaysDiaryModal .tdm-foil-subhead {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #fef08a;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 -1px 0 rgba(255, 255, 255, 0.2);
    margin-top: 2px;
    opacity: 0.95;
}

/* Handcrafted Stitched Owner Property Plaque (Center) */
#todaysDiaryModal .tdm-owner-plaque {
    width: 100%;
    max-width: 380px;
    margin: 10px 0;
    padding: 12px 18px;
    border: 1.5px dashed rgba(254, 240, 138, 0.5);
    background: radial-gradient(circle at 50% 50%, rgba(60, 25, 8, 0.85) 0%, rgba(35, 12, 3, 0.95) 100%);
    border-radius: 6px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 3px 8px rgba(0, 0, 0, 0.35);
    position: relative;
    text-align: center;
}

/* 4 Antique Brass Screw Rivets on Plaque */
#todaysDiaryModal .tdm-plaque-rivet {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fef08a 45%, #92400e 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

#todaysDiaryModal .tdm-rivet-tl {
    top: 5px;
    left: 6px;
}

#todaysDiaryModal .tdm-rivet-tr {
    top: 5px;
    right: 6px;
}

#todaysDiaryModal .tdm-rivet-bl {
    bottom: 5px;
    left: 6px;
}

#todaysDiaryModal .tdm-rivet-br {
    bottom: 5px;
    right: 6px;
}

#todaysDiaryModal .tdm-plaque-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    color: #fde68a;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    margin-bottom: 3px;
}

#todaysDiaryModal .tdm-plaque-name {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 0%, #fef08a 40%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.9));
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#todaysDiaryModal .tdm-plaque-dept {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fef3c7;
    letter-spacing: 0.5px;
    margin-top: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Leather Finish Swatch Selector Tray (Bottom) */
#todaysDiaryModal .tdm-leather-swatch-tray {
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    z-index: 15;
    margin-top: auto;
    padding-top: 4px;
}

#todaysDiaryModal .tdm-swatch-tray-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1.8px;
    color: #fef08a;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    margin-bottom: 4px;
}

#todaysDiaryModal .tdm-swatch-pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(254, 240, 138, 0.35);
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

#todaysDiaryModal .tdm-swatch-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.35);
    position: relative;
}

#todaysDiaryModal .tdm-swatch-btn:hover {
    transform: scale(1.22);
    box-shadow: 0 0 10px rgba(254, 240, 138, 0.9);
    z-index: 2;
}

#todaysDiaryModal .tdm-swatch-btn.active {
    border: 2px solid #ffffff;
    outline: 2.5px solid #fef08a;
    outline-offset: 1px;
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(254, 240, 138, 1), 0 3px 6px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

/* 6 Dual-Tone Swatch Fills (Center: Body / Outer Ring: Border) */
#todaysDiaryModal .tdm-swatch-cognac {
    background: radial-gradient(circle at 50% 50%, #c47d3c 0%, #a26027 60%, #4a220b 61%, #4a220b 100%);
}

#todaysDiaryModal .tdm-swatch-sapphire {
    background: radial-gradient(circle at 50% 50%, #255d99 0%, #1e4a7a 60%, #0b1d30 61%, #0b1d30 100%);
}

#todaysDiaryModal .tdm-swatch-racing-green {
    background: radial-gradient(circle at 50% 50%, #2d6a50 0%, #23533e 60%, #0c2218 61%, #0c2218 100%);
}

#todaysDiaryModal .tdm-swatch-terracotta {
    background: radial-gradient(circle at 50% 50%, #cd6e45 0%, #ba5d38 60%, #3d180a 61%, #3d180a 100%);
}

#todaysDiaryModal .tdm-swatch-burgundy {
    background: radial-gradient(circle at 50% 50%, #8e3240 0%, #782835 60%, #2b080e 61%, #2b080e 100%);
}

#todaysDiaryModal .tdm-swatch-slate {
    background: radial-gradient(circle at 50% 50%, #565f6b 0%, #474f59 60%, #181b20 61%, #181b20 100%);
}

/* 3. Wrap-Around Brass Clasp Strap (Right Edge Protrusion) */
#todaysDiaryModal .tdm-clasp-strap-wrapper {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 35;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    filter: drop-shadow(-3px 5px 12px rgba(0, 0, 0, 0.45));
    background: transparent;
    border: none;
    padding: 0;
}

#todaysDiaryModal .tdm-clasp-strap-wrapper:hover {
    transform: translateY(-50%) translateX(-6px);
}

#todaysDiaryModal .tdm-clasp-strap-wrapper.tdm-clasp-unlatching {
    transform: translateY(-50%) translateX(16px) rotate(3deg) scale(0.96) !important;
    filter: drop-shadow(-1px 3px 6px rgba(0, 0, 0, 0.6)) !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

#todaysDiaryModal .tdm-clasp-strap-wrapper.tdm-clasp-unlatching .tdm-brass-snap-medallion {
    box-shadow: 0 0 20px rgba(254, 240, 138, 1), 0 2px 6px rgba(0, 0, 0, 0.7) !important;
    transform: scale(1.15) !important;
}

#todaysDiaryModal .tdm-strap-leather-tongue {
    width: 136px;
    height: 64px;
    background: linear-gradient(90deg, #964d18 0%, #6f340d 70%, #4a2007 100%);
    border-radius: 32px 0 0 32px;
    border: 2px solid rgba(254, 240, 138, 0.6);
    border-right: none;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25), inset 0 -2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 8px;
    padding-right: 14px;
    gap: 8px;
}

#todaysDiaryModal .tdm-strap-stitch {
    position: absolute;
    inset: 3px 0 3px 3px;
    border-radius: 29px 0 0 29px;
    border: 1.5px dashed rgba(254, 240, 138, 0.4);
    border-right: none;
    pointer-events: none;
}

#todaysDiaryModal .tdm-brass-snap-medallion {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fef08a 35%, #d97706 70%, #78350f 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#todaysDiaryModal .tdm-clasp-strap-wrapper:hover .tdm-brass-snap-medallion {
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(254, 240, 138, 0.8), 0 2px 6px rgba(0, 0, 0, 0.6);
}

#todaysDiaryModal .tdm-brass-snap-rim {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #92400e;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 50%, #fbbf24 0%, #b45309 100%);
}

#todaysDiaryModal .tdm-brass-snap-core {
    font-size: 1.05rem;
    color: #451a03;
    filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.5));
}

#todaysDiaryModal .tdm-strap-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    user-select: none;
}

/* ==========================================================================
   17. 6 BALANCED DUAL-TONE THEME FINISHES
   ========================================================================== */

/* Smooth transitions */
#todaysDiaryModal .tdm-leather-cover,
#todaysDiaryModal .tdm-front-cover,
#todaysDiaryModal .tdm-diary-spine,
#todaysDiaryModal .tdm-diary-face,
#todaysDiaryModal .tdm-strap-leather-tongue,
#todaysDiaryModal .tdm-owner-plaque,
#todaysDiaryModal .tdm-face-stitch-frame,
#todaysDiaryModal .tdm-clasp-bar,
#todaysDiaryModal .tdm-leather-btn {
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, outline-color 0.4s ease !important;
}

/* 1. Honey Cognac & Saddle Brown (Default or [data-tdm-theme="cognac"]) */
#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-leather-cover,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-leather-cover {
    background: linear-gradient(135deg, #b87333 0%, #9c5c24 50%, #7d4517 100%);
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #4a220b;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.12);
}

#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-front-cover,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-front-cover {
    background: #7d3711;
}

#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-diary-spine,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-diary-spine {
    background: linear-gradient(to right, #401b07 0%, #5e280c 40%, #7d3711 75%, #351505 100%);
}

#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-diary-face,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-diary-face {
    background: radial-gradient(circle at 50% 35%, #b36427 0%, #8c4715 55%, #66320d 100%);
}

#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-strap-leather-tongue,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-strap-leather-tongue {
    background: linear-gradient(90deg, #964d18 0%, #6f340d 70%, #4a2007 100%);
}

#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-owner-plaque,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-owner-plaque {
    background: radial-gradient(circle at 50% 50%, rgba(60, 25, 8, 0.85) 0%, rgba(35, 12, 3, 0.95) 100%);
}

#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-spread-select,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-spread-select {
    background: #4a220b;
    border-color: rgba(254, 240, 138, 0.45);
}

/* 2. Oxford Navy & Indigo ([data-tdm-theme="sapphire"]) */
#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-leather-cover {
    background: linear-gradient(135deg, #205081 0%, #194069 50%, #12304f 100%);
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #0b1d30;
    box-shadow: 0 14px 32px rgba(11, 29, 48, 0.3), 0 4px 10px rgba(11, 29, 48, 0.15);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-front-cover {
    background: #14375b;
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-diary-spine {
    background: linear-gradient(to right, #091726 0%, #0e233b 40%, #16365c 75%, #071321 100%);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-diary-face {
    background: radial-gradient(circle at 50% 35%, #255d99 0%, #1a4878 55%, #102e4d 100%);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-strap-leather-tongue {
    background: linear-gradient(90deg, #205081 0%, #163a5e 70%, #0d233a 100%);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-owner-plaque {
    background: radial-gradient(circle at 50% 50%, rgba(14, 37, 63, 0.85) 0%, rgba(8, 20, 35, 0.95) 100%);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-spread-select {
    background: #0b1d30;
    border-color: rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-leather-btn {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(14, 43, 92, 0.45);
}

/* 3. British Racing Green & Hunter Pine ([data-tdm-theme="racing-green"]) */
#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-leather-cover {
    background: linear-gradient(135deg, #265a44 0%, #1d4635 50%, #143326 100%);
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #0c2218;
    box-shadow: 0 14px 32px rgba(12, 34, 24, 0.3), 0 4px 10px rgba(12, 34, 24, 0.15);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-front-cover {
    background: #163c2c;
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-diary-spine {
    background: linear-gradient(to right, #081a12 0%, #102d20 40%, #184230 75%, #06150e 100%);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-diary-face {
    background: radial-gradient(circle at 50% 35%, #2d6a50 0%, #20523d 55%, #143526 100%);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-strap-leather-tongue {
    background: linear-gradient(90deg, #235841 0%, #18402f 70%, #0d241a 100%);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-owner-plaque {
    background: radial-gradient(circle at 50% 50%, rgba(16, 46, 33, 0.85) 0%, rgba(8, 25, 18, 0.95) 100%);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-spread-select {
    background: #0c2218;
    border-color: rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-leather-btn {
    background: linear-gradient(180deg, #15803d 0%, #14532d 100%);
    border-color: #86efac;
    box-shadow: 0 4px 12px rgba(15, 60, 30, 0.45);
}

/* 4. Warm Terracotta & Espresso Mocha ([data-tdm-theme="terracotta"]) */
#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-leather-cover {
    background: linear-gradient(135deg, #bf5e3b 0%, #a44d2d 50%, #853b1e 100%);
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #3d180a;
    box-shadow: 0 14px 32px rgba(61, 24, 10, 0.3), 0 4px 10px rgba(61, 24, 10, 0.15);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-front-cover {
    background: #8c3f20;
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-diary-spine {
    background: linear-gradient(to right, #2a0e05 0%, #4a1c0d 40%, #6e2a14 75%, #200a03 100%);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-diary-face {
    background: radial-gradient(circle at 50% 35%, #cd6e45 0%, #a8512d 55%, #7a3518 100%);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-strap-leather-tongue {
    background: linear-gradient(90deg, #b85b34 0%, #8c4222 70%, #562410 100%);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-owner-plaque {
    background: radial-gradient(circle at 50% 50%, rgba(95, 38, 16, 0.85) 0%, rgba(50, 18, 6, 0.95) 100%);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-spread-select {
    background: #3d180a;
    border-color: rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-leather-btn {
    background: linear-gradient(180deg, #c2410c 0%, #9a3412 100%);
    border-color: #fed7aa;
    box-shadow: 0 4px 12px rgba(194, 65, 12, 0.45);
}

/* 5. Vintage Tuscan Burgundy & Black Cherry ([data-tdm-theme="burgundy"]) */
#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-leather-cover {
    background: linear-gradient(135deg, #802b37 0%, #681f2a 50%, #4e121b 100%);
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #2b080e;
    box-shadow: 0 14px 32px rgba(43, 8, 14, 0.3), 0 4px 10px rgba(43, 8, 14, 0.15);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-front-cover {
    background: #581620;
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-diary-spine {
    background: linear-gradient(to right, #20050a 0%, #3a0d14 40%, #591621 75%, #180307 100%);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-diary-face {
    background: radial-gradient(circle at 50% 35%, #8e3240 0%, #702431 55%, #4e141f 100%);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-strap-leather-tongue {
    background: linear-gradient(90deg, #7a2634 0%, #5a1924 70%, #360a12 100%);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-owner-plaque {
    background: radial-gradient(circle at 50% 50%, rgba(68, 16, 25, 0.85) 0%, rgba(38, 8, 13, 0.95) 100%);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-spread-select {
    background: #2b080e;
    border-color: rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-leather-btn {
    background: linear-gradient(180deg, #991b1b 0%, #7f1d1d 100%);
    border-color: #fca5a5;
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.45);
}

/* 6. Graphite Slate & Onyx Jet ([data-tdm-theme="slate"]) */
#todaysDiaryModal[data-tdm-theme="slate"] .tdm-leather-cover {
    background: linear-gradient(135deg, #4d5663 0%, #3d4550 50%, #2f3640 100%);
    border: 2px dashed rgba(254, 240, 138, 0.65);
    outline: 6px solid #181b20;
    box-shadow: 0 14px 32px rgba(24, 27, 32, 0.3), 0 4px 10px rgba(24, 27, 32, 0.15);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-front-cover {
    background: #313842;
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-diary-spine {
    background: linear-gradient(to right, #101216 0%, #1e2229 40%, #2f3540 75%, #0c0e11 100%);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-diary-face {
    background: radial-gradient(circle at 50% 35%, #565f6b 0%, #434a54 55%, #2c323a 100%);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-strap-leather-tongue {
    background: linear-gradient(90deg, #48505a 0%, #363c45 70%, #20242a 100%);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-owner-plaque {
    background: radial-gradient(circle at 50% 50%, rgba(38, 44, 53, 0.85) 0%, rgba(20, 23, 28, 0.95) 100%);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-spread-select {
    background: #181b20;
    border-color: rgba(254, 240, 138, 0.45);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-leather-btn {
    background: linear-gradient(180deg, #4b5563 0%, #1f2937 100%);
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.45);
}

/* Responsive measured flipbook. One source of dimensions for every leaf and slot. */
#todaysDiaryModal {
    --tdm-page-width: min(530px, calc(100vw - 72px));
    --tdm-page-height: min(630px, calc(100dvh - 180px));
}

#todaysDiaryModal .tdm-modal-dialog {
    width: calc(var(--tdm-page-width) + 40px);
    max-width: calc(100vw - 32px);
    margin: 16px auto;
    min-height: calc(100% - 32px);
    transition: width 0.65s ease;
}

#todaysDiaryModal .tdm-modal-dialog.tdm-spread-open {
    width: calc(var(--tdm-page-width) * 2 + 40px);
    max-width: calc(100vw - 32px);
}

#todaysDiaryModal .tdm-modal-dialog.tdm-single-page,
#todaysDiaryModal .tdm-modal-dialog.tdm-single-page.tdm-spread-open {
    width: calc(var(--tdm-page-width) + 40px);
}

#todaysDiaryModal .tdm-modal-content {
    /* Host screens style generic .modal-content (90% width, padding, scrolling).
       The measured book must receive the entire dialog's content width. */
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    flex: none;
    box-shadow: none;
    animation: none;
}

#todaysDiaryModal .tdm-leather-cover {
    padding: 40px 18px 12px;
    min-width: 0;
}

#todaysDiaryModal .tdm-book-viewport {
    min-height: 0;
    height: var(--tdm-page-height);
    overflow: clip;
}

#todaysDiaryModal .tdm-book-container {
    width: var(--tdm-page-width);
    height: var(--tdm-page-height);
    flex: none;
    transition: width 0.65s ease;
    touch-action: pan-y pinch-zoom;
}

#todaysDiaryModal .tdm-book-container.tdm-spread-open {
    width: calc(var(--tdm-page-width) * 2);
}

#todaysDiaryModal .tdm-single-page .tdm-book-container.tdm-spread-open {
    width: var(--tdm-page-width);
}

#todaysDiaryModal .tdm-page,
#todaysDiaryModal .tdm-front-cover {
    width: var(--tdm-page-width);
    height: var(--tdm-page-height);
}

#todaysDiaryModal .tdm-page {
    padding: 12px 16px 10px;
    min-width: 0;
    font-size: 13px;
}

#todaysDiaryModal .tdm-page-header {
    flex: none;
    height: 48px;
    min-height: 48px;
}

#todaysDiaryModal .tdm-ruled-heading {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    align-items: center;
    height: auto;
    min-height: 32px;
    max-height: none;
    line-height: 1.35;
    font-size: 12px;
    white-space: normal;
    flex: none;
    padding: 5px 0;
    margin: 0;
}

#todaysDiaryModal .tdm-page-items {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: repeating-linear-gradient(transparent 0 31px, rgba(148, 163, 184, 0.28) 31px 32px);
}

#todaysDiaryModal .tdm-flow-heading {
    height: 32px;
    min-height: 32px;
    padding: 0;
    line-height: 1.2;
    box-sizing: border-box;
}

#todaysDiaryModal .tdm-page-items>.tdm-flow-heading:not(:first-child) {
    margin-top: 64px;
}

#todaysDiaryModal .tdm-agenda-item {
    padding: 9px 0;
    border-bottom: 1px solid #cbd5e1;
    font: 13px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

#todaysDiaryModal .tdm-item-heading {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 5px;
}

#todaysDiaryModal .tdm-item-heading strong {
    min-width: 0;
}

#todaysDiaryModal .tdm-item-number {
    flex: none;
    color: #1670e9;
    font-weight: 700;
}

#todaysDiaryModal .tdm-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

#todaysDiaryModal .tdm-agenda-item .tdm-hl {
    display: inline-block;
    white-space: normal;
    max-width: 100%;
    line-height: 1.4;
    margin: 2px 0;
    box-sizing: border-box;
    font-size: 12px;
}

#todaysDiaryModal .tdm-item-meta {
    color: #64748b;
    margin: 4px 0;
}

/* Task entries consume whole ruled lines, so every next item starts on the grid. */
#todaysDiaryModal .tdm-page {
    container: tdm-paper / inline-size;
}

#todaysDiaryModal .tdm-project-item,
#todaysDiaryModal .tdm-direct-item,
#todaysDiaryModal .tdm-reminder-item {
    padding: 0;
    border: 0;
    line-height: 32px;
    box-shadow: inset 0 -1px 0 #cbd5e1;
}

#todaysDiaryModal .tdm-page-items>.tdm-project-item+.tdm-project-item,
#todaysDiaryModal .tdm-page-items>.tdm-direct-item+.tdm-direct-item,
#todaysDiaryModal .tdm-page-items>.tdm-reminder-item+.tdm-reminder-item,
#todaysDiaryModal .tdm-page-items>.tdm-reminder-item+.tdm-reminder-editor {
    margin-top: 32px;
}

#todaysDiaryModal .tdm-project-header {
    display: grid;
    grid-template-columns: 20px minmax(0, max-content) auto;
    gap: 0;
    align-items: start;
    margin: 0;
    min-height: 32px;
    line-height: 32px;
}

#todaysDiaryModal .tdm-project-title {
    display: block;
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 6px 0 0;
    margin: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: #0f172a;
    font: inherit;
    font-weight: 700;
    line-height: 32px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

#todaysDiaryModal .tdm-project-title:focus-visible {
    outline: 2px solid #1670e9;
    outline-offset: -2px;
}

#todaysDiaryModal .tdm-project-metadata {
    display: flex;
    min-width: 0;
    max-width: 100%;
    column-gap: 4px;
    line-height: 32px;
    font-size: 12px;
    white-space: nowrap;
}

#todaysDiaryModal .tdm-project-code,
#todaysDiaryModal .tdm-project-deadline {
    flex: none;
    height: 32px;
    line-height: 32px;
}

#todaysDiaryModal .tdm-project-deadline {
    margin-left: auto;
}

#todaysDiaryModal .tdm-project-metadata .tdm-hl {
    white-space: nowrap;
}

#todaysDiaryModal .tdm-project-line {
    padding-left: 20px;
    min-height: 32px;
    line-height: 32px;
}

#todaysDiaryModal .tdm-project-item .tdm-hl,
#todaysDiaryModal .tdm-direct-item .tdm-hl {
    display: inline;
    padding: 2px 4px;
    margin: 0;
    line-height: normal;
    vertical-align: baseline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

@container tdm-paper (max-width: 400px) {
    #todaysDiaryModal .tdm-project-header {
        grid-template-columns: 20px minmax(0, 1fr);
    }

    #todaysDiaryModal .tdm-project-metadata {
        grid-column: 2;
        flex-wrap: wrap;
        white-space: normal;
    }
}

#todaysDiaryModal #tdmItemReader .tdm-project-header {
    display: block;
}

#todaysDiaryModal #tdmItemReader .tdm-project-metadata {
    flex-wrap: wrap;
    white-space: normal;
}

#todaysDiaryModal #tdmItemReader .tdm-project-full-title {
    display: block;
    white-space: normal;
    line-height: 1.5;
}

#todaysDiaryModal #tdmItemReader .tdm-project-line {
    padding-left: 0;
}

#todaysDiaryModal .tdm-direct-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 6px;
    padding-left: 20px;
    min-height: 32px;
    line-height: 32px;
    font-size: 12px;
}

#todaysDiaryModal .tdm-direct-assigned {
    min-width: 0;
    color: #64748b;
}

#todaysDiaryModal .tdm-direct-priority {
    height: 32px;
    line-height: 32px;
    white-space: nowrap;
}

#todaysDiaryModal #tdmItemReader .tdm-direct-meta {
    padding-left: 0;
}

/* Reminders in Notes & Reminders list */
#todaysDiaryModal .tdm-reminder-header {
    display: block;
    min-height: 32px;
    line-height: 32px;
    margin: 0;
    clear: both;
}

#todaysDiaryModal .tdm-reminder-header::after {
    content: "";
    display: block;
    clear: both;
}

#todaysDiaryModal .tdm-reminder-title-text {
    display: inline;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 32px;
    word-break: break-word;
}

#todaysDiaryModal .tdm-reminder-item .tdm-item-number {
    display: inline;
    margin-right: 4px;
    line-height: 32px;
}

#todaysDiaryModal .tdm-reminder-tags {
    float: right;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    line-height: 32px;
    margin-left: 8px;
    white-space: nowrap;
    flex-direction: row-reverse;
}

#todaysDiaryModal .tdm-reminder-item .tdm-hl {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    margin: 0;
    line-height: normal;
    vertical-align: baseline;
    font-size: 11.5px;
    border-radius: 4px;
    white-space: nowrap;
}

#todaysDiaryModal .tdm-reminder-item .tdm-hl.tdm-reminder-dt-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.15;
    padding: 2px 7px;
}

#todaysDiaryModal .tdm-reminder-dt-stack .tdm-dt-date {
    display: block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
}

#todaysDiaryModal .tdm-reminder-dt-stack .tdm-dt-time {
    display: block;
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1.15;
    opacity: 0.88;
}

#todaysDiaryModal .tdm-page-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    height: 32px;
    min-height: 32px;
    flex: none;
    font: 11px/1.35 'Segoe UI', sans-serif;
    padding: 6px 0 0;
    margin: 0;
}

#todaysDiaryModal .tdm-page-footer span:last-child {
    text-align: right;
}

#todaysDiaryModal .tdm-page-left .tdm-page-footer,
#todaysDiaryModal .tdm-page-right .tdm-page-footer {
    justify-content: space-between;
    padding-left: 0;
    padding-right: 0;
}

#todaysDiaryModal .tdm-end-page {
    justify-content: center;
    align-items: center;
    color: #64748b;
}

#todaysDiaryModal .tdm-page-measure {
    position: fixed;
    left: -20000px;
    top: 0;
    visibility: hidden;
    pointer-events: none;
}

#todaysDiaryModal .tdm-clasp-bar,
#todaysDiaryModal .tdm-spread-open .tdm-clasp-bar {
    width: 100%;
    max-width: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center !important;
    gap: 8px;
    padding: 12px 0 0 !important;
    min-width: 0;
}

#todaysDiaryModal .tdm-controls-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#todaysDiaryModal .tdm-clasp-bar {
    box-sizing: border-box;
    height: var(--tdm-toolbar-height, 44px);
    overflow: hidden;
    transition: height 0.65s cubic-bezier(0.25, 1, 0.35, 1), margin-top 0.65s cubic-bezier(0.25, 1, 0.35, 1), padding-top 0.65s cubic-bezier(0.25, 1, 0.35, 1), opacity 0.2s ease;
}

#todaysDiaryModal[data-cover-state="closed"] .tdm-clasp-bar {
    height: 0;
    margin-top: 0;
    padding-top: 0 !important;
    border-top: 0;
}

#todaysDiaryModal .tdm-clasp-bar.tdm-measuring {
    position: absolute;
    height: auto !important;
    margin-top: 8px !important;
    padding-top: 12px !important;
    border-top: 1px dashed rgba(254, 240, 138, 0.4);
    transition: none !important;
}

#todaysDiaryModal .tdm-page-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

#todaysDiaryModal .tdm-spread-badge {
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
}

#todaysDiaryModal #tdmCloseDiaryStartDayBtn {
    margin: 0 !important;
    padding: 6px 10px !important;
    font-size: 12px;
}

#todaysDiaryModal .tdm-clasp-nav-btn {
    font-size: 12px;
    white-space: nowrap;
}

#todaysDiaryModal .tdm-book-close-btn {
    top: 4px;
    right: 4px;
    z-index: 50;
}

#todaysDiaryModal .tdm-bookmark-ribbon {
    pointer-events: none;
    height: 38px;
    z-index: 16;
}

#todaysDiaryModal .tdm-bookmark-ribbon .tdm-ribbon-tail {
    display: none;
}

/* Open pages scatter into warm gold flecks as the hardcover swings shut. */
#todaysDiaryModal .tdm-shatter-3d-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1060;
    display: block;
}

#todaysDiaryModal.tdm-shattering {
    pointer-events: none !important;
    user-select: none !important;
}

#todaysDiaryModal.tdm-shattering * {
    cursor: default !important;
}

#todaysDiaryModal .tdm-shatter-layer {
    position: absolute;
    inset: 0;
    z-index: 60;
    overflow: hidden;
    pointer-events: none;
    mix-blend-mode: screen;
}

#todaysDiaryModal .tdm-shatter-layer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 52%, rgba(255, 175, 45, .52), rgba(255, 95, 15, .28) 35%, transparent 70%);
    animation: tdm-shatter-flash .72s ease-out both;
}

#todaysDiaryModal #todaysDiaryBook[data-cover-state="closing"] .tdm-library-page[data-visible="true"]>.tdm-page {
    animation: tdm-page-shatter-dissolve .7s ease-in forwards;
    will-change: opacity, filter, clip-path, transform;
}

#todaysDiaryModal #todaysDiaryBook[data-cover-state="closing"] .tdm-library-page[data-visible="true"] {
    filter: sepia(.6) saturate(2) brightness(1.2);
}

#todaysDiaryModal .tdm-library-page[data-visible="true"]>.tdm-page {
    transform-origin: center;
}

@keyframes tdm-page-shatter-dissolve {
    0% {
        opacity: 1;
        filter: blur(0) brightness(1);
        transform: scale(1);
        clip-path: polygon(0 0, 33% 0, 66% 0, 100% 0, 100% 33%, 100% 66%, 100% 100%, 66% 100%, 33% 100%, 0 100%, 0 66%, 0 33%);
    }

    35% {
        opacity: .75;
        filter: blur(1px) brightness(1.4) drop-shadow(0 0 12px rgba(255, 140, 0, 0.8));
        transform: scale(1.01) translateY(-4px);
        clip-path: polygon(0 0, 30% 6%, 67% 0, 100% 12%, 92% 34%, 100% 65%, 84% 100%, 63% 92%, 35% 100%, 0 86%, 9% 61%, 0 33%);
    }

    70% {
        opacity: .25;
        filter: blur(4px) brightness(1.7) drop-shadow(0 0 20px rgba(255, 100, 0, 0.9));
        transform: scale(.98) translateY(-14px);
        clip-path: polygon(17% 22%, 36% 15%, 57% 24%, 76% 19%, 84% 40%, 77% 59%, 71% 80%, 54% 74%, 36% 83%, 23% 66%, 15% 50%, 18% 35%);
    }

    100% {
        opacity: 0;
        filter: blur(8px) brightness(2.0);
        transform: scale(.92) translateY(-28px);
        clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%);
    }
}

#todaysDiaryModal .tdm-shatter-particle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    clip-path: none;
    background: radial-gradient(circle at 30% 25%, #ffffff, #ffb700 45%, #e63900 100%);
    box-shadow: 0 0 10px 3px rgba(255, 140, 20, 0.85);
    opacity: 0;
    animation: tdm-shatter-burst .76s cubic-bezier(.12, .62, .24, 1) var(--delay) both;
}

@keyframes tdm-shatter-flash {
    0% {
        opacity: 0;
    }

    22% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes tdm-shatter-burst {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(.25) rotate(0);
    }

    18% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1.25) rotate(28deg);
    }

    100% {
        opacity: 0;
        transform: translate3d(var(--dx), var(--dy), 0) scale(.12) rotate(var(--spin));
    }
}

/* StPageFlip renders one hard cover and the measured soft HTML pages. */
#todaysDiaryModal .tdm-book-container,
#todaysDiaryModal .tdm-modal-dialog {
    transition: width 0.65s cubic-bezier(0.25, 1, 0.35, 1);
}

#todaysDiaryModal .tdm-library-host {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--tdm-page-width) * 2);
    height: var(--tdm-page-height);
    min-width: 0 !important;
    min-height: 0 !important;
    transition: left 0.65s cubic-bezier(0.25, 1, 0.35, 1);
}

#todaysDiaryModal .tdm-cover-closed .tdm-library-host {
    left: calc(-1 * var(--tdm-page-width));
}

#todaysDiaryModal .tdm-single-page .tdm-library-host {
    width: var(--tdm-page-width);
    left: 0;
}

#todaysDiaryModal .tdm-library-host>.stf__wrapper {
    height: 100%;
}

#todaysDiaryModal .tdm-library-page>.tdm-page {
    width: 100%;
    height: 100%;
}

#todaysDiaryModal .tdm-library-page.--left>.tdm-page {
    box-shadow: inset -16px 0 20px -10px rgba(0, 0, 0, .08);
}

#todaysDiaryModal .tdm-library-page.--right>.tdm-page {
    box-shadow: inset 16px 0 20px -10px rgba(0, 0, 0, .08);
}

#todaysDiaryModal .tdm-library-cover>.tdm-front-cover {
    width: 100%;
    height: 100%;
}

#todaysDiaryModal .tdm-diary-face,
#todaysDiaryModal .tdm-face-stitch-frame {
    min-width: 0;
}

#todaysDiaryModal .tdm-face-stitch-frame {
    min-height: 0;
}

#todaysDiaryModal .tdm-clasp-strap-wrapper {
    right: 0;
}

#todaysDiaryModal .tdm-clasp-strap-wrapper:hover {
    transform: translateY(-50%);
}

/* Only pathological items use a separate full-text reader, never a scrolling page. */
#todaysDiaryModal .tdm-item-large {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
    overflow: hidden;
}

#todaysDiaryModal .tdm-item-large> :not(.tdm-read-item) {
    display: none;
}

#todaysDiaryModal .tdm-item-large .tdm-item-heading {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    margin: 0;
}

#todaysDiaryModal .tdm-read-item {
    align-self: flex-start;
    margin: 0;
    padding: 2px 6px;
    font-size: 12px;
    flex: none;
}

#todaysDiaryModal #tdmItemReader {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    background: #fbf9f4;
    color: #1e293b;
}

#todaysDiaryModal #tdmItemReader::backdrop {
    background: rgba(0, 0, 0, .5);
}

#todaysDiaryModal #tdmItemReader form {
    text-align: right;
}

#todaysDiaryModal #tdmProjectTasksDialog {
    position: fixed;
    inset: 0;
    width: min(920px, calc(100vw - 32px));
    height: min(82dvh, 760px);
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid #c5a15d;
    border-radius: 12px;
    background: #fbf9f4;
    color: #1e293b;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .38);
}

#todaysDiaryModal #tdmProjectTasksDialog::backdrop {
    background: rgba(15, 23, 42, .58);
}

#todaysDiaryModal .tdm-project-task-dialog {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#todaysDiaryModal .tdm-project-task-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: none;
    padding: 16px 20px;
    border-bottom: 1px solid #e3d8c1;
    background: #fffdf8;
}

#todaysDiaryModal .tdm-project-task-dialog-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

#todaysDiaryModal .tdm-project-task-dialog-heading h2 {
    margin: 0;
    color: #243247;
    font: 700 20px/1.25 'Segoe UI', sans-serif;
}

#todaysDiaryModal .tdm-project-task-dialog-count {
    flex: none;
    padding: 3px 9px;
    border-radius: 999px;
    background: #d9efff;
    color: #145780;
    font: 700 12px/1.4 'Segoe UI', sans-serif;
}

#todaysDiaryModal .tdm-project-task-dialog-list {
    display: grid;
    align-content: start;
    gap: 10px;
    flex: 1;
    min-height: 0;
    padding: 16px 20px 20px;
    overflow: auto;
    overscroll-behavior: contain;
}

#todaysDiaryModal .tdm-project-task-group {
    min-width: 0;
    border: 1px solid #b8d2ff;
    border-radius: 10px;
    /* overflow: hidden; */
}

#todaysDiaryModal .tdm-project-task-group-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    background: linear-gradient(100deg, #eef5ff, #dce9ff);
    color: #142447;
    text-align: left;
    font: 700 17px/1.35 'Segoe UI', sans-serif;
    border-radius: 10px 10px 0 0;
}

#todaysDiaryModal .tdm-project-task-folder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    line-height: 1;
    color: #3478ed;
    font-size: 22px;
}

#todaysDiaryModal .tdm-project-task-group-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

#todaysDiaryModal .tdm-project-task-group-count {
    padding: 5px 10px;
    border-radius: 999px;
    background: #c9defe;
    color: #173d7a;
    white-space: nowrap;
    font: 700 12px/1.3 'Segoe UI', sans-serif;
}

#todaysDiaryModal .tdm-project-task-group-chevron {
    width: 20px;
    color: #142447;
    text-align: center;
    font-size: 22px;
    transform: rotate(0deg);
    transition: transform .15s ease;
}

#todaysDiaryModal .tdm-project-task-group-heading[aria-expanded="true"] .tdm-project-task-group-chevron {
    transform: rotate(180deg);
}

#todaysDiaryModal .tdm-project-task-group-panel {
    display: grid;
    gap: 0;
    padding: 8px 10px 10px;
    background: #fff;
}

#todaysDiaryModal .tdm-project-task-group-panel[hidden] {
    display: none;
}

#todaysDiaryModal .tdm-project-task-card {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.35fr) minmax(112px, .8fr) auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #e0e7f2;
    /* border-radius: 8px; */
    background: #fff;
}

#todaysDiaryModal .tdm-project-task-card+.tdm-project-task-card {
    margin-top: -1px;
}

#todaysDiaryModal .tdm-project-task-card-title {
    min-width: 0;
    color: #142447;
    font: 700 14px/1.4 'Segoe UI', sans-serif;
    overflow-wrap: anywhere;
}

#todaysDiaryModal .tdm-project-task-card-stage {
    padding: 5px 9px;
    border-radius: 8px;
    background: #e6efff;
    color: #214888;
    font: 600 12px/1.35 'Segoe UI', sans-serif;
    overflow-wrap: anywhere;
}

#todaysDiaryModal .tdm-project-task-card-due {
    display: flex;
    flex-direction: column;
    color: #24734d;
    font: 500 12px/1.35 'Segoe UI', sans-serif;
}

#todaysDiaryModal .tdm-project-task-card-due strong {
    font-size: 10px;
    font-weight: 800;
}

#todaysDiaryModal .tdm-project-task-card-due.is-overdue {
    color: #c62828;
}

#todaysDiaryModal .tdm-project-task-card-code {
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 7px;
    background: #d9ebff;
    color: #154a90;
    text-align: center;
    white-space: nowrap;
    font: 700 12px/1.35 'Segoe UI', sans-serif;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    #todaysDiaryModal #tdmProjectTasksDialog {
        width: calc(100vw - 20px);
        height: 88dvh;
        max-height: calc(100dvh - 20px);
        border-radius: 10px;
    }

    #todaysDiaryModal .tdm-project-task-dialog-header {
        gap: 8px;
        padding: 12px;
    }

    #todaysDiaryModal .tdm-project-task-dialog-heading {
        flex-wrap: wrap;
        gap: 6px 9px;
    }

    #todaysDiaryModal .tdm-project-task-dialog-heading h2 {
        font-size: 18px;
    }

    #todaysDiaryModal .tdm-project-task-dialog-list {
        gap: 8px;
        padding: 10px 12px 14px;
    }

    #todaysDiaryModal .tdm-project-task-group-heading {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        gap: 7px;
        padding: 9px;
        font-size: 13px;
    }

    #todaysDiaryModal .tdm-project-task-group-count {
        padding: 4px 6px;
        font-size: 10px;
    }

    #todaysDiaryModal .tdm-project-task-card {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px;
        padding: 8px;
    }

    #todaysDiaryModal .tdm-project-task-card-stage {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    #todaysDiaryModal .tdm-project-task-card-due {
        grid-column: 1;
        grid-row: 3;
    }

    #todaysDiaryModal .tdm-project-task-card-code {
        grid-column: 2;
        grid-row: 3;
    }
}

@media (max-width: 991px) {
    #todaysDiaryModal .tdm-page {
        padding: 10px 12px;
    }

    #todaysDiaryModal .tdm-clasp-bar {
        gap: 6px;
    }

    #todaysDiaryModal .tdm-page-navigation {
        order: -1;
        width: 100%;
    }

    #todaysDiaryModal .tdm-face-stitch-frame {
        padding: 10px;
    }

    #todaysDiaryModal .tdm-diary-spine {
        width: 28px;
    }

    #todaysDiaryModal .tdm-owner-plaque {
        padding: 8px;
        margin: 6px 0;
    }

    #todaysDiaryModal .tdm-plaque-name {
        font-size: 1.1rem;
    }

    #todaysDiaryModal .tdm-foil-subhead {
        letter-spacing: 1px;
    }

    #todaysDiaryModal .tdm-leather-swatch-tray {
        padding: 6px;
    }
}

@media (max-height: 650px) {
    #todaysDiaryModal .tdm-cover-logo-embossed {
        max-height: 28px;
    }

    #todaysDiaryModal .tdm-foil-year {
        font-size: 1.35rem;
    }

    #todaysDiaryModal .tdm-owner-plaque {
        padding: 6px;
        margin: 4px 0;
    }

    #todaysDiaryModal .tdm-plaque-label,
    #todaysDiaryModal .tdm-swatch-tray-label,
    #todaysDiaryModal .tdm-plaque-dept {
        display: none;
    }

    #todaysDiaryModal .tdm-leather-swatch-tray {
        padding: 4px;
    }

    #todaysDiaryModal .tdm-face-stitch-frame {
        padding: 6px;
    }

    #todaysDiaryModal .tdm-swatch-btn {
        width: 20px;
        height: 20px;
    }

    #todaysDiaryModal .tdm-page-header {
        height: 38px;
        min-height: 38px;
    }

    #todaysDiaryModal .tdm-stamp-day {
        font-size: 26px;
    }
}

@media (prefers-reduced-motion: reduce) {

    #todaysDiaryModal *,
    #todaysDiaryModal.fade {
        transition: none !important;
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTHENTIC EXECUTIVE DIARY PEN (TOP-RIGHT, OUTSIDE PAGE ON LEATHER COVER)
   Horizontal luxury ballpoint pen resting on the top leather cover above
   the right page, secured with an authentic stitched leather strap loop.
   ═══════════════════════════════════════════════════════════════════════════ */

#todaysDiaryModal .tdm-pen-top-dock {
    position: absolute;
    top: 7px;
    right: 70px;
    z-index: 26;
    display: flex;
    align-items: center;
    transition: opacity 0.35s ease, transform 0.4s ease;
}

/* Hidden when diary cover is closed or closing */
#todaysDiaryModal[data-cover-state="closed"] .tdm-pen-top-dock,
#todaysDiaryModal[data-cover-state="closing"] .tdm-pen-top-dock {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Entrance animation when cover opens */
@keyframes tdm-pen-top-in {
    0% {
        opacity: 0;
        transform: translateY(-16px);
    }

    60% {
        opacity: 1;
        transform: translateY(2px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

#todaysDiaryModal[data-cover-state="opened"] .tdm-pen-top-dock,
#todaysDiaryModal[data-cover-state="opening"] .tdm-pen-top-dock {
    animation: tdm-pen-top-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.28s both;
}

/* ── 1. Clickable Executive Luxury Pen ── */
#todaysDiaryModal .tdm-reminder-pen {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    height: 28px;
    transform-origin: center right;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.25s ease;
    filter: drop-shadow(0 3px 5px rgba(20, 10, 5, 0.45));
}

/* ── 2. Stitched Leather Loop Strap (holding pen to the diary cover) ── */
#todaysDiaryModal .tdm-pen-strap {
    position: absolute;
    right: 180px;
    top: -2px;
    width: 28px;
    height: 30px;
    border-radius: 4px;
    background: linear-gradient(180deg, #9c5c24 0%, #6f340d 70%, #4a2007 100%);
    border-top: 1.5px dashed rgba(254, 240, 138, 0.75);
    border-bottom: 1.5px dashed rgba(254, 240, 138, 0.75);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 5;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
}

#todaysDiaryModal .tdm-pen-strap-slot {
    position: absolute;
    left: 4px;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    background: rgba(0, 0, 0, 0.38);
    border-radius: 2px;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* Theme support for the leather strap */
#todaysDiaryModal[data-tdm-theme="cognac"] .tdm-pen-strap,
#todaysDiaryModal:not([data-tdm-theme]) .tdm-pen-strap {
    background: linear-gradient(180deg, #9c5c24 0%, #6f340d 70%, #4a2007 100%);
}

#todaysDiaryModal[data-tdm-theme="sapphire"] .tdm-pen-strap {
    background: linear-gradient(180deg, #205081 0%, #163a5e 70%, #0d233a 100%);
}

#todaysDiaryModal[data-tdm-theme="racing-green"] .tdm-pen-strap {
    background: linear-gradient(180deg, #165b33 0%, #0f3d22 70%, #071f11 100%);
}

#todaysDiaryModal[data-tdm-theme="terracotta"] .tdm-pen-strap {
    background: linear-gradient(180deg, #b84c20 0%, #873310 70%, #571f07 100%);
}

#todaysDiaryModal[data-tdm-theme="burgundy"] .tdm-pen-strap {
    background: linear-gradient(180deg, #781d34 0%, #521021 70%, #300611 100%);
}

#todaysDiaryModal[data-tdm-theme="slate"] .tdm-pen-strap {
    background: linear-gradient(180deg, #374151 0%, #1f2937 70%, #111827 100%);
}

/* ── 3. Chrome Push Button / Clicker Dome (Left end) ── */
#todaysDiaryModal .tdm-pen-clicker {
    width: 10px;
    height: 12px;
    border-radius: 4px 1px 1px 4px;
    background: linear-gradient(180deg, #8a8a8a 0%, #d8d8d8 25%, #ffffff 50%, #b8b8b8 75%, #666666 100%);
    box-shadow: -1px 0 2px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.9);
    margin-right: -1px;
    z-index: 3;
    flex-shrink: 0;
}

/* ── 4. Upper Cap with Polished Silver Pocket Clip ── */
#todaysDiaryModal .tdm-pen-cap {
    width: 85px;
    height: 18px;
    border-radius: 2px 0 0 2px;
    background: linear-gradient(180deg, #111418 0%, #28303a 20%, #4a5563 45%, #222933 70%, #0e1217 100%);
    position: relative;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), inset 0 -1px 1px rgba(0, 0, 0, 0.6);
    z-index: 2;
    flex-shrink: 0;
}

#todaysDiaryModal .tdm-pen-clip {
    position: absolute;
    top: -3px;
    left: 8px;
    width: 70px;
    height: 5px;
    border-radius: 2px 3px 3px 2px;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 35%, #94a3b8 70%, #64748b 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 1px 0.5px rgba(255, 255, 255, 0.9);
    z-index: 5;
}

#todaysDiaryModal .tdm-pen-clip-ridge {
    position: absolute;
    inset: 1px 4px 1px 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(180, 185, 195, 0.3) 100%);
    border-radius: 1px;
}

#todaysDiaryModal .tdm-pen-clip-ball {
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #d1d5db 50%, #6b7280 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ── 5. Gold & Chrome Trim Rings ── */
#todaysDiaryModal .tdm-pen-ring {
    width: 3px;
    height: 18px;
    background: linear-gradient(180deg, #fef08a 0%, #d4af37 40%, #aa8010 80%, #6a4e05 100%);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    z-index: 4;
    flex-shrink: 0;
}

/* ── 6. Pen Barrel with Laser-Engraved Personal Name ── */
#todaysDiaryModal .tdm-pen-barrel {
    width: 175px;
    height: 18px;
    position: relative;
    background: linear-gradient(180deg, #111418 0%, #28303a 20%, #4a5563 45%, #222933 70%, #0e1217 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), inset 0 -1px 1px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
    flex-shrink: 0;
}

#todaysDiaryModal .tdm-pen-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 25%, rgba(255, 255, 255, 0.16) 45%, transparent 65%);
    pointer-events: none;
}

#todaysDiaryModal .tdm-pen-engraving {
    font-family: 'Cinzel', 'Trajan Pro', 'Georgia', serif;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(254, 240, 138, 0.9);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.9), 0 0 4px rgba(254, 240, 138, 0.35);
    user-select: none;
    pointer-events: none;
    padding-left: 10px;
}

/* ── 7. Tapered Conical Tip & Fine Ballpoint Nib ── */
#todaysDiaryModal .tdm-pen-cone {
    width: 30px;
    height: 18px;
    position: relative;
    clip-path: polygon(0 0, 0 100%, 82% 64%, 96% 56%, 100% 50%, 96% 44%, 82% 36%);
    background: linear-gradient(180deg, #d4af37 0%, #fef08a 35%, #aa8010 70%, #553b02 100%);
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.3);
    z-index: 2;
    flex-shrink: 0;
}

#todaysDiaryModal .tdm-pen-nib {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 2px;
    background: #111827;
    border-radius: 0 1px 1px 0;
}

/* ── 8. Tactile Floating Tooltip Callout ── */
#todaysDiaryModal .tdm-pen-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    white-space: nowrap;
    background: rgba(24, 15, 8, 0.94);
    color: #fef08a;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 5px 11px;
    border-radius: 6px;
    border: 1px solid rgba(254, 240, 138, 0.45);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 40;
}

#todaysDiaryModal .tdm-pen-tooltip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 5px 5px 5px;
    border-style: solid;
    border-color: transparent transparent rgba(24, 15, 8, 0.94) transparent;
}

#todaysDiaryModal .tdm-reminder-pen:hover .tdm-pen-tooltip,
#todaysDiaryModal .tdm-reminder-pen:focus-visible .tdm-pen-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── 9. Hover & Active Writing Interaction ── */
#todaysDiaryModal .tdm-reminder-pen:hover,
#todaysDiaryModal .tdm-reminder-pen:focus-visible {
    transform: translateY(-2px);
    filter: drop-shadow(0 5px 8px rgba(20, 10, 5, 0.55)) drop-shadow(0 0 10px rgba(254, 240, 138, 0.4));
    outline: none;
}

/* When editor is active (aria-expanded="true"):
   Top pen un-docks and glides down into the page, leaving the empty leather strap visible! */
#todaysDiaryModal .tdm-reminder-pen[aria-expanded="true"] {
    opacity: 0;
    pointer-events: none;
    transform: translateY(28px) scale(0.9);
    transition: opacity 0.22s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Realistic Writing Pen inside the text field ── */
#todaysDiaryModal .tdm-reminder-field-wrap {
    position: relative;
    width: 100%;
    overflow: visible !important;
}

#todaysDiaryModal .tdm-reminder-editor {
    position: relative;
    overflow: visible !important;
}

#todaysDiaryModal .tdm-page-items:has(.tdm-reminder-editor),
#todaysDiaryModal .tdm-page-items.tdm-has-reminder-editor {
    overflow: visible !important;
}

#todaysDiaryModal .tdm-field-pen {
    position: absolute;
    bottom: 16px;
    left: 0;
    pointer-events: none;
    z-index: 100 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateX(var(--pen-x, 8px)) translateY(0) rotate(40deg);
    transform-origin: 50% 100%;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Shown when input field is active and focused (native :focus-within or .tdm-pen-visible) */
#todaysDiaryModal .tdm-reminder-field-wrap:focus-within .tdm-field-pen,
#todaysDiaryModal .tdm-field-pen.tdm-pen-visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(var(--pen-x, 8px)) translateY(0) rotate(40deg);
}

/* Flying entrance animation from top-right down to text line */
#todaysDiaryModal .tdm-field-pen.tdm-pen-flying-in {
    animation: tdm-field-pen-fly-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tdm-field-pen-fly-in {
    0% {
        opacity: 0;
        visibility: hidden;
        transform: translateX(calc(var(--pen-x, 8px) + 80px)) translateY(-50px) rotate(15deg) scale(1.1);
    }

    60% {
        opacity: 1;
        visibility: visible;
        transform: translateX(calc(var(--pen-x, 8px) + 2px)) translateY(1.5px) rotate(43deg) scale(0.98);
    }

    100% {
        opacity: 1;
        visibility: visible;
        transform: translateX(var(--pen-x, 8px)) translateY(0) rotate(40deg) scale(1);
    }
}

/* Handwriting stroke scribble animation on keystroke (slanted to the right) */
@keyframes tdm-writing-scribble {
    0% {
        transform: translateX(var(--pen-x, 8px)) translateY(0) rotate(40deg);
    }

    25% {
        transform: translateX(var(--pen-x, 8px)) translateY(-1.5px) rotate(37deg);
    }

    50% {
        transform: translateX(var(--pen-x, 8px)) translateY(1px) rotate(43deg);
    }

    75% {
        transform: translateX(var(--pen-x, 8px)) translateY(-0.8px) rotate(39deg);
    }

    100% {
        transform: translateX(var(--pen-x, 8px)) translateY(0) rotate(40deg);
    }
}

#todaysDiaryModal .tdm-field-pen.tdm-pen-scribbling {
    animation: tdm-writing-scribble 0.13s ease-in-out;
}

/* Substantial, realistic luxury pen body in the field */
#todaysDiaryModal .tdm-field-pen-shaft {
    position: relative;
    width: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.4));
}

#todaysDiaryModal .tdm-field-pen-clicker {
    width: 5px;
    height: 6px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, #94a3b8 0%, #ffffff 40%, #cbd5e1 70%, #64748b 100%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
    margin-bottom: -1px;
    z-index: 4;
}

#todaysDiaryModal .tdm-field-pen-cap {
    width: 9px;
    height: 22px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, #181d24 0%, #374151 25%, #606f7b 45%, #252d37 70%, #111827 100%);
    position: relative;
    box-shadow: inset 1px 0 1px rgba(255, 255, 255, 0.3), inset -1px 0 1px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

#todaysDiaryModal .tdm-field-pen-clip {
    position: absolute;
    top: 2px;
    left: -2px;
    width: 2.5px;
    height: 18px;
    border-radius: 1px 1px 2px 2px;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 35%, #94a3b8 70%, #64748b 100%);
    box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

#todaysDiaryModal .tdm-field-pen-ring {
    width: 9.5px;
    height: 2.5px;
    background: linear-gradient(90deg, #b48316 0%, #fef08a 35%, #d4af37 65%, #785307 100%);
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
    z-index: 4;
}

#todaysDiaryModal .tdm-field-pen-barrel {
    width: 9px;
    height: 26px;
    position: relative;
    background: linear-gradient(90deg, #181d24 0%, #374151 25%, #606f7b 45%, #252d37 70%, #111827 100%);
    box-shadow: inset 1px 0 1px rgba(255, 255, 255, 0.3), inset -1px 0 1px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

#todaysDiaryModal .tdm-field-pen-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 20%, rgba(255, 255, 255, 0.22) 40%, transparent 60%);
    pointer-events: none;
}

#todaysDiaryModal .tdm-field-pen-cone {
    width: 8.5px;
    height: 11px;
    clip-path: polygon(0 0, 100% 0, 65% 100%, 35% 100%);
    background: linear-gradient(90deg, #b48316 0%, #fef08a 35%, #d4af37 65%, #785307 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

#todaysDiaryModal .tdm-field-pen-nib {
    width: 2px;
    height: 3px;
    background: #090d16;
    border-radius: 0 0 1px 1px;
    z-index: 4;
}

/* ── 10. Responsive Scaling ── */
@media (max-width: 991.98px) {
    #todaysDiaryModal .tdm-pen-top-dock {
        right: 56px;
        top: 6px;
        transform: scale(0.85);
        transform-origin: right center;
    }
}

@media (max-width: 575.98px) {
    #todaysDiaryModal .tdm-pen-top-dock {
        right: 48px;
        top: 6px;
        transform: scale(0.72);
        transform-origin: right center;
    }
}

#todaysDiaryModal .tdm-reminder-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 10px 0;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: #334155;
    position: relative;
    overflow: visible !important;
}

#todaysDiaryModal .tdm-reminder-editor-heading {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 24px;
    color: #7c4a22;
    font-size: 13px;
}

#todaysDiaryModal .tdm-reminder-title-input {
    width: 100%;
    height: 32px;
    padding: 2px 4px;
    border: 0;
    border-bottom: 1.5px solid rgba(138, 85, 38, 0.65);
    background: transparent !important;
    color: #0f172a;
    font-size: 14px;
    font-weight: 500;
    line-height: 28px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

#todaysDiaryModal .tdm-reminder-title-input::placeholder {
    color: #94a3b8;
    font-style: italic;
    font-weight: 400;
    font-size: 13.5px;
}

#todaysDiaryModal .tdm-reminder-title-input:focus {
    outline: none !important;
    border-bottom: 2px solid #8a5526 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#todaysDiaryModal .tdm-reminder-editor-datetime {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.95fr);
    gap: 12px;
    align-items: center;
    margin-top: 2px;
}

#todaysDiaryModal .tdm-reminder-dt-col {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    flex-direction: row;
    justify-content: flex-start;
}

#todaysDiaryModal .tdm-reminder-dt-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: #7c4a22;
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
    line-height: 1;
}

#todaysDiaryModal .tdm-reminder-dt-label i {
    font-size: 12px;
    color: #8a5526;
}

#todaysDiaryModal .tdm-reminder-dt-input {
    flex: 1;
    min-width: 0;
    height: 28px;
    padding: 2px 4px;
    border: 0;
    border-bottom: 1.5px solid rgba(138, 85, 38, 0.45);
    background: transparent !important;
    color: #1e293b;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;

}

#todaysDiaryModal .tdm-reminder-dt-input:focus {
    outline: none !important;
    border-bottom: 2px solid #8a5526 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#todaysDiaryModal .tdm-reminder-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 27px;
    padding-top: 2px;
}

#todaysDiaryModal .tdm-reminder-editor-error {
    flex: 1;
    color: #b91c1c;
    font-size: 11px;
    line-height: 1.25;
}

#todaysDiaryModal .tdm-reminder-save {
    border: 1px solid #7c451a;
    background: linear-gradient(180deg, #8a5526 0%, #6f3f1d 100%);
    color: #fff;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: filter 0.15s ease, transform 0.15s ease;
}

#todaysDiaryModal .tdm-reminder-save:hover:not(:disabled) {
    background: linear-gradient(180deg, #7a471e 0%, #5d3315 100%);
    color: #fff;
    filter: brightness(1.05);
}

@media (max-height: 450px) {
    #todaysDiaryModal .tdm-diary-face {
        padding: 6px 10px;
    }

    #todaysDiaryModal .tdm-foil-header {
        flex-direction: row;
        gap: 10px;
        margin: 0;
    }

    #todaysDiaryModal .tdm-foil-emblem {
        margin: 0;
    }

    #todaysDiaryModal .tdm-cover-logo-embossed {
        max-height: 20px;
    }

    #todaysDiaryModal .tdm-foil-year {
        font-size: 1.1rem;
    }

    #todaysDiaryModal .tdm-foil-subhead {
        display: none;
    }

    #todaysDiaryModal .tdm-owner-plaque {
        padding: 4px;
        margin: 4px 0;
    }

    #todaysDiaryModal .tdm-leather-swatch-tray {
        padding: 2px;
    }
}