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

body {
    margin: 0;
    padding: 30px 20px;
    font-family: Georgia, 'Times New Roman', Times, serif;
    background: #1a1410;
    color: #f0e8d8;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    animation: fadeIn 0.5s ease-out;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1a1410; }
::-webkit-scrollbar-thumb { background: #3a2a20; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #5a4a3a; }
::-webkit-scrollbar-corner { background: #1a1410; }
* { scrollbar-width: thin; scrollbar-color: #3a2a20 #1a1410; }

/* ===== LEGAL FILING DOCUMENT ===== */
.filing {
    width: 100%;
    max-width: 820px;
    background: #221c16;
    border: 1px solid #3a2a20;
    border-radius: 4px;
    padding: 48px 56px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* ===== CAPTION ===== */
.caption {
    text-align: center;
    margin-bottom: 0;
}

.caption-seal {
    color: #c9a84c;
    opacity: 0.6;
    margin-bottom: 16px;
}

.caption-title {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Playfair Display', Georgia, serif;
    letter-spacing: 0.03em;
    margin: 0 0 4px 0;
    color: #f0e8d8;
    text-transform: uppercase;
}

.caption-sub {
    font-size: 0.8rem;
    color: #7a6a5a;
    margin: 0 0 16px 0;
    font-style: italic;
    letter-spacing: 0.06em;
}

.caption-byline {
    font-size: 0.68rem;
    color: #6a5a4a;
    margin-bottom: 0;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.caption-byline a {
    color: #8a7a6a;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: #3a2a20;
}

.caption-byline a:hover {
    color: #c9a84c;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9a84c, transparent);
    margin: 32px 0;
    opacity: 0.5;
}

/* ===== IN THE MATTER OF ===== */
.matter-heading {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.15em;
    color: #7a6a5a;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.parties {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.party-row {
    display: flex;
    flex-direction: column;
}

.party {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.party label {
    font-size: 0.65rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
    color: #7a6a5a;
}

.party input {
    padding: 8px 0 6px;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: none;
    border-bottom: 1px solid #3a2a20;
    border-radius: 0;
    background: transparent;
    color: #f0e8d8;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.party input::placeholder {
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    color: #4a3a2a;
    font-style: italic;
    opacity: 1;
}

.party input:focus { border-bottom-color: #c9a84c; }

.party-vs {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 900;
    font-family: 'Playfair Display', Georgia, serif;
    color: #c9a84c;
    opacity: 0.4;
    letter-spacing: 0.06em;
    padding: 2px 0;
    line-height: 1;
}

/* ===== SCHEDULE ===== */
.schedule-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.schedule h2 {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Playfair Display', Georgia, serif;
    color: #f0e8d8;
    margin: 0;
    letter-spacing: 0.02em;
}

.schedule-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px 8px 20px;
    background: #1a1410;
    border: 1px solid #2a2018;
    border-left: 3px solid #3a2a20;
    border-radius: 3px;
    transition: border-left-color 0.3s;
}

.schedule-toggle--active {
    border-left-color: #c9a84c;
}

.schedule-toggle .toggle-label-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #7a6a5a;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    user-select: none;
}

.schedule-toggle .toggle-label-text svg {
    color: #c9a84c;
    flex-shrink: 0;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    color: #c9a84c;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
}

.info-icon:hover {
    color: #d4af37;
}

.badge-info-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: #c9a84c;
    cursor: pointer;
    transition: color 0.2s;
}

.badge-info-icon:hover {
    color: #d4af37;
}

/* toggle switch - court gavel style */
.toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2a2018;
    border-radius: 20px;
    border: 1px solid #3a2a20;
    transition: background 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: #5a4a3a;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: #c9a84c;
    border-color: #c9a84c;
}

.toggle-switch input:checked + .toggle-slider:before {
    background: #1a1410;
    transform: translateX(18px);
}

/* ===== EDIT PANEL ===== */
.edit-panel {
    background: #1a1410;
    padding: 24px;
    border-radius: 4px;
    border: 1px solid #3a2a20;
    border-left: 3px solid #c9a84c;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    animation: expandPanel 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.edit-panel h3 { margin: 0; font-size: 0.85rem; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #c9a84c; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.edit-panel.hidden { display: none; }

.edit-fields { display: flex; gap: 12px; flex-wrap: wrap; }

.edit-fields label {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #7a6a5a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.edit-fields input,
.edit-fields select {
    padding: 10px;
    background: #221c16;
    border: 1px solid #3a2a20;
    color: #f0e8d8;
    border-radius: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.edit-fields input:focus,
.edit-fields select:focus {
    border-color: #c9a84c;
}

.edit-fields select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a6a5a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 10px) center;
    padding-right: 32px;
}

.edit-actions { display: flex; gap: 8px; margin-top: 2px; }

#save-block-btn,
#cancel-edit-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #3a2a20;
    background: transparent;
}

#save-block-btn { color: #c9a84c; border-color: #c9a84c; }
#save-block-btn:hover { background: #c9a84c; color: #1a1410; }

#cancel-edit-btn { color: #7a6a5a; }
#cancel-edit-btn:hover { background: #3a2a20; color: #f0e8d8; }

#save-block-btn:active,
#cancel-edit-btn:active { transform: scale(0.97); }

/* ===== ADD BLOCK BUTTON ===== */
#add-block-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 4px;
    border: 1px dashed #4a3a2a;
    background: transparent;
    color: #7a6a5a;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 4px;
}

#add-block-btn:hover {
    border-color: #c9a84c;
    color: #c9a84c;
    background: rgba(201, 168, 76, 0.04);
}

#add-block-btn:active { transform: scale(0.98); }

/* ===== BLOCK CARDS ===== */
.block-list { width: 100%; display: flex; flex-direction: column; }

.block-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    padding: 12px 18px;
    border-bottom: 1px solid #2a2018;
    cursor: grab;
    transition:
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    animation: blockIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.block-card:first-child {
    border-top: 1px solid #2a2018;
}

@keyframes blockIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes blockOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

.block-card:hover {
    background: rgba(201, 168, 76, 0.03);
}

.block-card.removing {
    animation: blockOut 0.3s ease-in forwards;
    overflow: hidden;
    pointer-events: none;
}

.block-card.dragging {
    opacity: 0.6;
    background: rgba(201, 168, 76, 0.06);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
    z-index: 100;
}

.block-placeholder {
    border: none;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, transparent, #c9a84c, transparent);
    margin: 2px 0;
    pointer-events: none;
}

.block-main-content { display: flex; flex: 1; align-items: center; gap: 12px; }

.block-main-content::before {
    content: attr(data-index);
    font-size: 0.75rem;
    color: #5a4a3a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 500;
    min-width: 20px;
}

.link-icon { color: #c9a84c; display: inline-flex; align-items: center; opacity: 0.7; flex-shrink: 0; vertical-align: middle; }
.block-name { font-size: 0.9rem; font-weight: 500; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; display: flex; align-items: center; gap: 6px; flex: 1; }

.block-time {
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    width: 70px;
    text-align: right;
    flex-shrink: 0;
    color: #c9a84c;
    opacity: 0.8;
}

.block-linked-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #c9a84c;
    border: 1px solid #3a2a20;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.block-linked-badge svg {
    opacity: 0.7;
    width: 10px;
    height: 10px;
    margin-right: 0 !important;
    display: block;
}

.block-delete {
    background: transparent;
    border: none;
    color: #4a3a2a;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.block-delete:hover { color: #8b1a1a; background: rgba(139, 26, 26, 0.08); }
.block-delete:active { transform: scale(0.9); }

/* ===== COMMENCE TRIAL ===== */
.commence {
    text-align: center;
}

#start-trial-btn {
    padding: 16px 56px;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Playfair Display', Georgia, serif;
    border-radius: 4px;
    border: 2px solid #c9a84c;
    background: transparent;
    color: #c9a84c;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

#start-trial-btn:hover {
    background: #c9a84c;
    color: #1a1410;
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.3);
}

#start-trial-btn:active { transform: scale(0.97); }

#save-trial-btn {
    padding: 12px 32px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 4px;
    border: 1px solid #3a2a20;
    background: transparent;
    color: #7a6a5a;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 12px;
}

#save-trial-btn:hover {
    border-color: #5a4a3a;
    color: #f0e8d8;
    background: #2a2018;
}

#save-trial-btn:active { transform: scale(0.97); }

/* ===== SAVED TRIALS ===== */
.saved-trials-header h2 {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Playfair Display', Georgia, serif;
    color: #f0e8d8;
    margin: 0;
    letter-spacing: 0.02em;
}

.saved-trials-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.saved-trials-empty {
    text-align: center;
    font-size: 0.8rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #5a4a3a;
    font-style: italic;
    padding: 20px 0;
}

.saved-trial-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #1a1410;
    border: 1px solid #2a2018;
    border-left: 3px solid #3a2a20;
    border-radius: 3px;
    transition: border-left-color 0.2s;
}

.saved-trial-card:hover {
    border-left-color: #5a4a3a;
}

.saved-trial-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.saved-trial-name {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #f0e8d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-trial-date {
    font-size: 0.65rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #5a4a3a;
    margin-top: 2px;
}

.saved-trial-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.saved-trial-load {
    padding: 6px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid #c9a84c;
    background: transparent;
    color: #c9a84c;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

.saved-trial-load:hover {
    background: #c9a84c;
    color: #1a1410;
}

.saved-trial-edit {
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid transparent;
    background: transparent;
    color: #5a4a3a;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-trial-edit:hover {
    color: #c9a84c;
    border-color: #5a4a3a;
}

.saved-trial-delete {
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid transparent;
    background: transparent;
    color: #5a4a3a;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-trial-delete:hover {
    color: #8b1a1a;
    border-color: #6e1515;
}

.saved-trial-preset {
    border-left-color: #c9a84c;
    opacity: 0.85;
}

.saved-trial-preset:hover {
    border-left-color: #d4af37;
    opacity: 1;
}

.saved-trial-card[draggable] {
    cursor: grab;
}

.saved-trial-card[draggable]:active {
    cursor: grabbing;
}

.saved-trial-card.dragging {
    opacity: 0.5;
    background: rgba(201, 168, 76, 0.06);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
    z-index: 100;
}

.saved-trial-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #c9a84c;
    border: 1px solid #c9a84c;
    border-radius: 2px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.04em;
}

.tr-mode-badge {
    color: #c9a84c;
    border-color: #c9a84c;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    margin-left: 6px;
    font-size: 0.6rem;
    line-height: 1;
}

.tr-mode-badge svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

.tr-mode-badge .badge-info-icon {
    color: #c9a84c;
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    margin-left: 0;
    line-height: 0;
}

.tr-mode-badge .badge-info-icon:hover {
    opacity: 1;
}

.saved-trial-resume {
    padding: 6px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid #3a2a20;
    background: transparent;
    color: #f0e8d8;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

.saved-trial-resume:hover {
    background: #3a2a20;
    border-color: #5a4a3a;
}

.saved-trial-launch {
    padding: 6px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid #c9a84c;
    background: transparent;
    color: #c9a84c;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

.saved-trial-launch:hover {
    background: #c9a84c;
    color: #1a1410;
}

.saved-trial-autosave {
    border-left-color: #8b6914;
    background: #1e180e;
}

.saved-trial-autosave .saved-trial-badge {
    border-color: #8b6914;
    color: #d4a828;
}

.saved-trial-progress {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    color: #c9a84c;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-trial-desc {
    font-size: 0.72rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #8a7a6a;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.preset-block-info {
    font-size: 0.65rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #5a4a3a;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== PRESETS HEADER ===== */
.saved-trials-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

#save-preset-btn {
    padding: 8px 18px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid #3a2a20;
    background: transparent;
    color: #7a6a5a;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

#save-preset-btn:hover {
    border-color: #5a4a3a;
    color: #f0e8d8;
    background: #2a2018;
}

#save-preset-btn:active { transform: scale(0.97); }

#clear-trials-btn {
    padding: 8px 18px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 3px;
    border: 1px solid #5a2a2a;
    background: transparent;
    color: #a06060;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

#clear-trials-btn:hover {
    border-color: #8a3a3a;
    color: #f0d0d0;
    background: #2a1818;
}

#clear-trials-btn:active { transform: scale(0.97); }

/* ===== PRESET DIALOG ===== */
.preset-dialog {
    max-width: 420px;
}

.preset-dialog-fields {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.preset-dialog-fields label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preset-dialog-fields label span {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #8a7a6a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.preset-dialog-fields input,
.preset-dialog-fields textarea {
    padding: 10px 12px;
    font-size: 0.85rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 4px;
    border: 1px solid #3a2a20;
    background: #1a1410;
    color: #f0e8d8;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
}

.preset-dialog-fields input:focus,
.preset-dialog-fields textarea:focus {
    border-color: #c9a84c;
}

.preset-dialog-fields textarea {
    font-size: 0.8rem;
}

/* ===== CONFIRMATION OVERLAY (for index page) ===== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.confirm-overlay.hidden {
    display: none;
}

.confirm-dialog {
    background: #221c16;
    border: 1px solid #3a2a20;
    border-radius: 6px;
    padding: 36px 40px 28px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.confirm-seal {
    color: #c9a84c;
    opacity: 0.4;
    margin-bottom: 16px;
}

.confirm-dialog h3 {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Playfair Display', Georgia, serif;
    color: #f0e8d8;
    margin: 0 0 10px 0;
}

.confirm-dialog p {
    font-size: 0.8rem;
    color: #7a6a5a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-btn {
    padding: 10px 24px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.confirm-cancel {
    background: #2a2018;
    color: #7a6a5a;
    border: 1px solid #3a2a20;
}

.confirm-cancel:hover {
    background: #3a2a20;
    color: #f0e8d8;
}

.confirm-save {
    background: #c9a84c;
    color: #1a1410;
}

.confirm-save:hover {
    background: #d4af37;
    box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
}

.confirm-leave {
    background: #8b1a1a;
    color: #f0e8d8;
}

.confirm-leave:hover {
    background: #a32020;
    box-shadow: 0 4px 16px rgba(139, 26, 26, 0.3);
}

.confirm-btn:active {
    transform: scale(0.96);
}

/* ===== MOBILE (setup page) ===== */
@media (max-width: 768px) {
    body { padding: 20px 12px; }

    .filing { padding: 28px 24px; }

    .caption-title { font-size: 1.2rem; }

    .caption-sub { font-size: 0.7rem; }

    .schedule-top { 
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .schedule-toggle {
        gap: 10px;
        padding: 6px 12px 6px 16px;
        align-self: stretch;
    }

    .schedule-toggle .toggle-label-text {
        font-size: 0.65rem;
        white-space: normal;
        word-break: break-word;
    }

    #start-trial-btn {
        padding: 14px 32px;
        font-size: 0.85rem;
    }

    #save-trial-btn {
        padding: 10px 20px;
        margin-left: 8px;
    }

    .saved-trial-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .saved-trial-actions {
        align-self: flex-end;
    }

    .block-card {
        padding: 10px 12px;
    }

    .block-linked-badge {
        font-size: 0.5rem;
        padding: 1px 5px;
    }

    .confirm-dialog {
        padding: 24px 20px 20px;
        margin: 0 12px;
        width: calc(100% - 24px);
    }

    .preset-dialog {
        max-width: 100%;
    }

    .edit-fields label {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    body { padding: 12px 8px; }

    .filing { padding: 20px 14px; }

    .caption-title { font-size: 1rem; letter-spacing: 0.02em; }

    .caption-seal { margin-bottom: 10px; }
    .caption-seal svg { width: 28px; height: 28px; }

    .section-divider { margin: 20px 0; }

    .matter-heading { font-size: 0.6rem; margin-bottom: 14px; }

    .party label { font-size: 0.6rem; }

    .party input { padding: 6px 0 4px; }

    .schedule h2 { font-size: 0.85rem; }

    .schedule-toggle {
        gap: 8px;
        padding: 5px 10px 5px 12px;
    }

    .schedule-toggle .toggle-label-text {
        font-size: 0.6rem;
    }

    .toggle-switch { width: 34px; height: 18px; }
    .toggle-slider:before { width: 12px; height: 12px; }
    .toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

    .block-card { padding: 8px 10px; }
    .block-main-content { gap: 8px; }
    .block-main-content::before { min-width: 16px; font-size: 0.65rem; }
    .block-name { font-size: 0.8rem; }
    .block-time { font-size: 0.75rem; width: 56px; }
    .block-delete { width: 28px; height: 28px; }
    .block-linked-badge { font-size: 0.45rem; padding: 1px 4px; gap: 2px; }

    #add-block-btn { padding: 10px; font-size: 0.72rem; }

    .edit-panel { padding: 16px; }

    #start-trial-btn {
        padding: 12px 24px;
        font-size: 0.8rem;
        letter-spacing: 0.06em;
    }

    #save-trial-btn {
        padding: 8px 16px;
        font-size: 0.65rem;
        margin-left: 6px;
    }

    .saved-trial-name { font-size: 0.78rem; }
    .saved-trial-card { padding: 8px 10px; gap: 6px; }
    .saved-trial-actions { gap: 4px; }
    .saved-trial-actions button { padding: 5px 10px; font-size: 0.6rem; }

    .saved-trials-header { flex-direction: column; gap: 8px; align-items: flex-start; }

    #save-preset-btn, #clear-trials-btn { padding: 6px 14px; font-size: 0.6rem; }

    .saved-trial-badge { font-size: 0.5rem; padding: 0 4px; }
    .tr-mode-badge { padding: 2px 4px; font-size: 0.5rem; gap: 2px; }
    .tr-mode-badge svg { width: 9px; height: 9px; }

    .confirm-dialog { padding: 20px 16px 18px; }
    .confirm-dialog h3 { font-size: 1rem; }
    .confirm-dialog p { font-size: 0.75rem; }
    .confirm-btn { padding: 8px 18px; font-size: 0.72rem; }
    .confirm-actions { flex-direction: column; gap: 6px; }
    .confirm-actions .confirm-btn { width: 100%; }

    .preset-dialog-fields { gap: 10px; }
    .preset-dialog-fields input,
    .preset-dialog-fields textarea { padding: 8px 10px; font-size: 0.8rem; }
}

/* ===== FOOTER ===== */
footer {
    width: 100%;
    max-width: 820px;
    text-align: center;
    padding: 16px 0 8px;
    color: #6a5a4a;
    font-size: 0.72rem;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

footer a {
    color: #8a7a6a;
    text-decoration: underline;
}

footer a:hover {
    color: #c9a84c;
}

.version-footer {
    margin-left: 10px;
    font-size: 0.6rem;
    color: #4a3a2a;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}
