/* ==========================================================================
   Apple-Design MaterialTracker Theme (Chill & Litematica-Aligned)
   Minimalist, calm, dark mode aesthetic inspired by Litematica HUD
   with Apple precision, frosted glass, and tabular numbers.
   ========================================================================== */

:root {
    --bg-base: #090a0d;
    --bg-surface: rgba(18, 20, 27, 0.65);
    --bg-surface-elevated: rgba(24, 27, 36, 0.85);
    --bg-surface-modal: #14161f;
    --bg-pill: rgba(255, 255, 255, 0.05);
    --bg-pill-hover: rgba(255, 255, 255, 0.1);
    --bg-pill-active: rgba(255, 255, 255, 0.16);

    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-card: rgba(255, 255, 255, 0.07);
    --border-card-highlight: rgba(255, 255, 255, 0.13);

    --text-primary: #f5f5f7;
    --text-secondary: rgba(245, 245, 247, 0.62);
    --text-tertiary: rgba(245, 245, 247, 0.38);

    --accent-blue: #0a84ff;
    --accent-blue-hover: #0071e3;
    --accent-blue-glow: rgba(10, 132, 255, 0.25);
    --accent-green: #30d158;
    --accent-green-glow: rgba(48, 209, 88, 0.22);
    --accent-red: #ff453a; /* Litematica Missing Red */
    --accent-amber: #ffd60a;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 9999px;

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --blur-glass: blur(24px) saturate(180%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.45;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.02) 0%, transparent 70%),
        linear-gradient(180deg, #0b0c10 0%, #07080a 100%);
    background-attachment: fixed;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

.app-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 20px 18px 80px 18px;
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   Top Apple Sticky Navigation Bar
   -------------------------------------------------------------------------- */
.top-nav {
    position: sticky;
    top: 14px;
    z-index: 100;
    margin-bottom: 20px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.brand-text h1 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.pulsing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
    animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

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

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    padding: 7px 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.16s ease;
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-secondary {
    background: var(--bg-pill);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-pill-hover);
    border-color: var(--border-card-highlight);
}

.btn-primary {
    background: var(--accent-blue);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--accent-blue-glow);
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
}

.btn-deposit-main {
    background: linear-gradient(135deg, #0a84ff, #0066cc);
    color: #ffffff;
    font-weight: 600;
    padding: 7px 16px;
    box-shadow: 0 2px 12px var(--accent-blue-glow);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-deposit-main:hover {
    box-shadow: 0 4px 18px var(--accent-blue-glow);
    filter: brightness(1.08);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
}

.btn-sm {
    padding: 5px 11px;
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   Calm Project Status Summary (Litematica Footer style, at top)
   -------------------------------------------------------------------------- */
.summary-bar {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.summary-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.summary-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.summary-progress-wrapper {
    flex: 1 1 200px;
    max-width: 300px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.summary-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border-radius: var(--radius-pill);
    transition: width 0.6s ease;
}

/* --------------------------------------------------------------------------
   Space-Saving Compact Toolbar (Search, Filter, Litematica Toggles)
   -------------------------------------------------------------------------- */
.toolbar-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding: 2px 4px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

/* Expandable Minimalist Search */
.search-expandable {
    display: flex;
    align-items: center;
    position: relative;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-expandable.is-open {
    flex: 1 1 260px;
    max-width: 360px;
}

.search-expand-input {
    width: 0;
    opacity: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-expandable.is-open .search-expand-input {
    width: 100%;
    opacity: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-card-highlight);
    border-radius: var(--radius-pill);
    padding: 6px 14px 6px 34px;
}

.search-icon-btn {
    position: absolute;
    left: 4px;
    z-index: 2;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: color 0.15s ease;
}

.search-icon-btn:hover {
    color: var(--text-primary);
}

.search-expandable:not(.is-open) .search-icon-btn {
    position: static;
    background: var(--bg-pill);
    border: 1px solid var(--border-subtle);
}

/* Litematica "Hide available" Toggle Button */
.btn-litematica-toggle,
.compact-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--bg-pill);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    outline: none;
    font-family: inherit;
    line-height: 1;
}

.btn-litematica-toggle:hover,
.compact-toggle-btn:hover {
    background: var(--bg-pill-hover);
    color: var(--text-primary);
    border-color: var(--border-card-highlight);
}

.btn-litematica-toggle.is-active,
.compact-toggle-btn.is-active {
    background: rgba(10, 132, 255, 0.15);
    border-color: rgba(10, 132, 255, 0.4);
    color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(10, 132, 255, 0.2);
}

.toggle-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.compact-toggle-btn.is-active .toggle-indicator,
.btn-litematica-toggle.is-active .toggle-indicator {
    background: var(--accent-blue);
    box-shadow: 0 0 6px var(--accent-blue);
}

.toggle-status {
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-tertiary);
}

.compact-toggle-btn.is-active .toggle-status,
.btn-litematica-toggle.is-active .toggle-status {
    background: rgba(10, 132, 255, 0.25);
    color: #ffffff;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Compact Dropdown Selects */
.compact-select {
    background: var(--bg-pill);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 5px 12px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.compact-select:hover {
    color: var(--text-primary);
    border-color: var(--border-card-highlight);
}

.compact-select option {
    background: #14161f;
    color: #fff;
}

/* --------------------------------------------------------------------------
   Litematica-Aligned Material Table (Clean, Continuous, Chill)
   -------------------------------------------------------------------------- */
.mc-table-container {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.35);
}

.mc-table-header {
    display: grid;
    grid-template-columns: 2.2fr 100px 110px 100px 1.4fr;
    align-items: center;
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.mc-table-body {
    display: flex;
    flex-direction: column;
}

.mc-table-row {
    display: grid;
    grid-template-columns: 2.2fr 100px 110px 100px 1.4fr;
    align-items: center;
    padding: 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.035);
    transition: background 0.12s ease;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.mc-table-row:last-child {
    border-bottom: none;
}

.mc-table-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.mc-table-row.is-completed {
    opacity: 0.7;
}

.mc-table-row.is-completed:hover {
    opacity: 0.95;
}

/* Columns */
.col-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.item-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
}

.item-name-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.item-name-text {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-cat-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

.col-num {
    font-family: var(--font-mono);
    font-size: 14px;
    text-align: right;
    padding-right: 14px;
}

.col-total {
    color: #e5e5ea;
    font-weight: 500;
}

/* Litematica Red for Missing! */
.col-missing {
    color: var(--accent-red);
    font-weight: 600;
}

.col-missing.is-done {
    color: var(--accent-green);
    font-weight: 500;
}

.col-available {
    color: var(--text-tertiary);
}

.col-available.has-val {
    color: #f5f5f7;
    font-weight: 500;
}

.col-breakdown {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.shulker-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Hover Formula Tooltip */
.litematica-formula-badge {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Modals & Sheets
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(4, 5, 8, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    overflow-y: auto;
}

.modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-sheet {
    position: relative;
    z-index: 10;
    background: #12141c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06);
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    transform: scale(0.94) translateY(15px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.is-active .modal-sheet {
    transform: scale(1) translateY(0);
}

.sheet-header {
    padding: 20px 22px 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.sheet-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.btn-close {
    background: var(--bg-pill);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-close:hover {
    background: var(--bg-pill-hover);
    color: var(--text-primary);
}

.sheet-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --------------------------------------------------------------------------
   Searchable Item Picker / Combobox
   -------------------------------------------------------------------------- */
.item-picker-container,
.item-picker-dropdown-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-picker-selected,
.item-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.item-picker-selected:hover,
.item-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-card-highlight);
}

.selected-item-info,
.picker-selected-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selected-item-icon,
.item-icon-sm {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
}

.selected-item-text,
.picker-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.selected-item-missing,
.picker-sub {
    font-size: 12px;
    color: var(--accent-red);
    font-family: var(--font-mono);
}

.item-picker-dropdown,
.item-picker-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 6px;
    background: #181b26;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    max-height: 280px;
    overflow: hidden;
}

.item-picker-dropdown.is-open,
.item-picker-menu.is-open {
    display: flex;
}

.item-picker-search-input {
    background: rgba(0, 0, 0, 0.35);
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
}

.item-picker-list {
    overflow-y: auto;
    max-height: 230px;
}

.item-picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.item-picker-option:hover, .item-picker-option.is-focused {
    background: rgba(255, 255, 255, 0.08);
}

.picker-opt-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.picker-opt-icon {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.picker-opt-name {
    font-size: 13.5px;
    color: #fff;
}

.picker-opt-badge {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--accent-red);
}

/* Smart Input Group */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.form-label .helper {
    color: var(--text-tertiary);
    font-size: 11.5px;
}

.smart-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.smart-input:focus {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

/* --------------------------------------------------------------------------
   Simple 3-Row Synchronized Quantity Inputs
   -------------------------------------------------------------------------- */
.quantity-input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
}

.form-row-simple {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-row-simple .form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit .smart-input {
    padding-right: 58px;
    font-family: var(--font-mono);
    font-size: 15px;
}

.unit-tag {
    position: absolute;
    right: 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    pointer-events: none;
    user-select: none;
}

.stacks-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.stacks-input-group .smart-input {
    flex: 1;
    min-width: 0;
    padding-right: 56px;
    font-family: var(--font-mono);
    font-size: 15px;
}

.unit-plus {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-tertiary);
    user-select: none;
}

.shulker-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.shulker-input-group .smart-input {
    padding-right: 48px;
    font-family: var(--font-mono);
    font-size: 15px;
}

/* Deposit Active User Indicator */
.deposit-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
}

.deposit-user-badge strong {
    color: #ffffff;
    font-weight: 600;
    font-family: var(--font-mono);
}

.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.5);
    display: inline-block;
    flex-shrink: 0;
}

.pin-allowed-players code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Schematic & Placement Coordinates Dialog
   -------------------------------------------------------------------------- */
.schematic-dialog {
    max-width: 450px;
}

.schematic-header-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(10, 132, 255, 0.15);
    border: 1px solid rgba(10, 132, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.placement-origin-card {
    background: rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.placement-origin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.placement-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.coords-display-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.coord-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coord-axis {
    font-size: 11px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--accent-blue);
}

.coord-val {
    font-size: 14.5px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #ffffff;
    letter-spacing: -0.02em;
}

.placement-hint {
    font-size: 11.5px;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.45;
}

.schematic-file-card {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schematic-file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.schematic-badge-icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px;
    border: 1px solid var(--border-subtle);
}

.schematic-meta-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.schematic-meta-text strong {
    font-size: 14px;
    color: #ffffff;
}

.schematic-meta-text span {
    font-size: 12px;
    color: var(--text-tertiary);
}

.btn-download-schematic {
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.schematic-instructions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-top: 4px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.step-num {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    font-size: 10.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
}

.step-item code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 11px;
}

.btn-xs {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   iOS PIN Keypad Sheet
   -------------------------------------------------------------------------- */
.pin-dialog {
    max-width: 360px;
    text-align: center;
}

.pin-dialog .sheet-body {
    align-items: center;
}

.pin-lock-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.15);
    border: 1px solid rgba(10, 132, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    margin: 4px auto 6px auto;
}

.pin-dots {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin: 14px 0 20px 0;
}

.pin-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-dot.filled {
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    transform: scale(1.15);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 68px);
    gap: 12px 16px;
    justify-content: center;
    margin-bottom: 6px;
}

.pin-key {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.pin-key:hover {
    background: rgba(255, 255, 255, 0.15);
}

.pin-key:active {
    transform: scale(0.92);
}

.pin-key.key-action {
    background: transparent;
    border-color: transparent;
    font-size: 14px;
    color: var(--text-secondary);
}

.shake-animation {
    animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(5px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* --------------------------------------------------------------------------
   Activity Drawer
   -------------------------------------------------------------------------- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.history-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    z-index: 1100;
    background: #141620;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: -15px 0 45px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-overlay.is-active .history-drawer {
    transform: translateX(0);
}

.drawer-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.history-card.is-undone {
    opacity: 0.5;
    text-decoration: line-through;
}

.history-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-title {
    font-size: 13.5px;
    font-weight: 600;
}

.history-meta {
    font-size: 11.5px;
    color: var(--text-tertiary);
}

.history-amount {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--accent-green);
    white-space: nowrap;
}

.history-amount.negative {
    color: var(--accent-red);
}

/* --------------------------------------------------------------------------
   Dynamic Island Toasts
   -------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.apple-toast {
    background: rgba(28, 30, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: var(--blur-glass);
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideDown {
    from { opacity: 0; transform: translateY(-15px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------------------------
   Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 800px) {
    .app-container {
        padding: 12px 10px 60px 10px;
    }

    .top-nav {
        padding: 10px 14px;
    }

    .mc-table-header {
        grid-template-columns: 2fr 80px 80px 0;
    }

    .mc-table-header div:nth-child(4),
    .mc-table-header div:nth-child(5) {
        display: none;
    }

    .mc-table-row {
        grid-template-columns: 2fr 80px 80px;
        padding: 8px 12px;
    }

    .mc-table-row .col-available,
    .mc-table-row .col-breakdown {
        display: none;
    }
}
