
        /* ============================================================
           CSS CUSTOM PROPERTIES (Design Tokens)
        ============================================================ */
        :root {
            /* Brand Colors */
            --green-dark:   #0a7a72;
            --green-mid:    #11998e;
            --green-light:  #38ef7d;
            --green-pale:   #d4f4e4;
            --green-faint:  #f0fff8;

            /* Neutrals */
            --white:        #ffffff;
            --gray-50:      #f8fafb;
            --gray-100:     #f1f5f4;
            --gray-200:     #e2e8e7;
            --gray-400:     #9ab0ac;
            --gray-600:     #5a7570;
            --gray-800:     #1e2e2c;
            --gray-900:     #111918;

            /* Accents */
            --red:          #ef4444;
            --red-light:    #fee2e2;
            --amber:        #f59e0b;
            --amber-light:  #fef3c7;
            --blue:         #3b82f6;

            /* Dark Mode */
            --bg:           var(--white);
            --surface:      var(--white);
            --surface-alt:  var(--gray-50);
            --border:       var(--gray-200);
            --text-primary: var(--gray-900);
            --text-secondary:var(--gray-600);
            --text-muted:   var(--gray-400);
            --row-hover:    var(--green-faint);

            /* Shadows */
            --shadow-sm:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
            --shadow-md:    0 4px 16px rgba(17,153,142,.12);
            --shadow-lg:    0 10px 40px rgba(17,153,142,.18);
            --shadow-card:  0 2px 12px rgba(0,0,0,.08);

            /* Radius */
            --radius-sm:    6px;
            --radius-md:    12px;
            --radius-lg:    18px;
            --radius-xl:    24px;

            /* Typography */
            --font-body:    'DM Sans', sans-serif;
            --font-mono:    'DM Mono', monospace;

            /* Transitions */
            --ease:         cubic-bezier(.4,0,.2,1);
            --dur-fast:     150ms;
            --dur-med:      250ms;
            --dur-slow:     400ms;
        }

        /* Dark Mode Overrides */
        [data-theme="dark"] {
            --bg:           #0d1f1e;
            --surface:      #162524;
            --surface-alt:  #1e3230;
            --border:       #2a4441;
            --text-primary: #e8f5f3;
            --text-secondary:#8ab5b0;
            --text-muted:   #4d7a75;
            --row-hover:    #1e3a37;
            --green-faint:  #1a3330;
            --green-pale:   #1e3d3a;
            --shadow-card:  0 2px 12px rgba(0,0,0,.4);
        }

        /* ============================================================
           RESET & BASE
        ============================================================ */
        *, *::before, *::after {
            margin: 0; padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        html {
            scroll-behavior: smooth;
            height: 100%;
        }

        body {
            font-family: var(--font-body);
            background: var(--bg);
            color: var(--text-primary);
            min-height: 100vh;
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
            transition: background var(--dur-med) var(--ease),
                        color var(--dur-med) var(--ease);
            /* Prevent bounce scroll on iOS but keep content scrollable */
            overscroll-behavior: none;
        }

        /* ============================================================
           LAYOUT
        ============================================================ */
        .app-shell {
            max-width: 680px;
            margin: 0 auto;
            padding: 0 0 80px; /* bottom padding for safe area */
        }

        /* ============================================================
           HEADER / TOPBAR
        ============================================================ */
        .topbar {
            position: sticky;
            top: 0;
            z-index: 100;
            background: var(--green-mid);
            padding: 14px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 12px rgba(17,153,142,.35);
        }

        .topbar-brand {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .topbar-icon {
            width: 36px; height: 36px;
            background: rgba(255,255,255,.2);
            border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            font-size: 18px;
            backdrop-filter: blur(4px);
        }

        .topbar-title {
            font-size: 17px;
            font-weight: 700;
            color: white;
            letter-spacing: -.3px;
        }

        .topbar-subtitle {
            font-size: 11px;
            color: rgba(255,255,255,.7);
            letter-spacing: .3px;
            text-transform: uppercase;
        }

        .topbar-actions {
            display: flex;
            gap: 8px;
        }

        .icon-btn {
            width: 38px; height: 38px;
            border: none;
            border-radius: 10px;
            background: rgba(255,255,255,.15);
            color: white;
            font-size: 17px;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: background var(--dur-fast) var(--ease),
                        transform var(--dur-fast) var(--ease);
            backdrop-filter: blur(4px);
        }

        .icon-btn:active { transform: scale(.92); background: rgba(255,255,255,.25); }

        /* ============================================================
           SECTIONS
        ============================================================ */
        .section {
            padding: 16px 16px 0;
        }

        .section-label {
            font-size: 11px;
            font-weight: 600;
            letter-spacing: .8px;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 8px;
            padding-left: 2px;
        }

        /* ============================================================
           CARD
        ============================================================ */
        .card {
            background: var(--surface);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-card);
            border: 1px solid var(--border);
            overflow: hidden;
            transition: background var(--dur-med) var(--ease),
                        border-color var(--dur-med) var(--ease);
        }

        .card-body { padding: 16px; }

        /* ============================================================
           INPUT AREA
        ============================================================ */
        .input-wrap {
            position: relative;
        }

        #numberInput {
            width: 100%;
            padding: 14px 14px;
            font-size: 15px;
            font-family: var(--font-mono);
            line-height: 1.7;
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--surface-alt);
            color: var(--text-primary);
            resize: vertical;
            min-height: 110px;
            outline: none;
            transition: border-color var(--dur-fast) var(--ease),
                        background var(--dur-fast) var(--ease);
        }

        #numberInput::placeholder { color: var(--text-muted); }

        #numberInput:focus {
            border-color: var(--green-mid);
            background: var(--surface);
            box-shadow: 0 0 0 4px rgba(17,153,142,.1);
        }

        .input-hint {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 6px;
            padding-left: 2px;
        }

        /* ============================================================
           BUTTONS
        ============================================================ */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 0 16px;
            height: 42px;
            font-size: 14px;
            font-weight: 600;
            font-family: var(--font-body);
            border: none;
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: transform var(--dur-fast) var(--ease),
                        box-shadow var(--dur-fast) var(--ease),
                        opacity var(--dur-fast) var(--ease);
            white-space: nowrap;
            user-select: none;
        }

        .btn:active { transform: scale(.95); }
        .btn:disabled { opacity: .5; pointer-events: none; }

        .btn-primary {
            background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-light) 100%);
            color: white;
            box-shadow: 0 3px 12px rgba(17,153,142,.35);
        }
        .btn-primary:hover { box-shadow: 0 5px 18px rgba(17,153,142,.45); }

        .btn-ghost {
            background: var(--surface-alt);
            color: var(--text-secondary);
            border: 1px solid var(--border);
        }
        .btn-ghost:hover { background: var(--green-faint); color: var(--green-mid); border-color: var(--green-mid); }

        .btn-danger {
            background: var(--red-light);
            color: var(--red);
        }
        [data-theme="dark"] .btn-danger {
            background: rgba(239,68,68,.15);
            color: #f87171;
        }
        .btn-danger:hover { background: var(--red); color: white; }

        .btn-sm {
            height: 32px;
            padding: 0 12px;
            font-size: 12px;
            border-radius: var(--radius-sm);
        }

        /* Add row */
        .add-row {
            display: flex;
            gap: 10px;
            margin-top: 12px;
            align-items: flex-start;
        }

        .add-row .btn-primary { flex-shrink: 0; height: 44px; font-size: 15px; padding: 0 20px; }

        /* Toolbar */
        .toolbar {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 12px;
        }
        .toolbar .btn { flex: 1; min-width: 100px; height: 40px; font-size: 13px; }

        /* ============================================================
           STATS GRID
        ============================================================ */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 8px;
        }

        @media (max-width: 480px) {
            .stats-grid { grid-template-columns: repeat(3, 1fr); }
            .stats-grid .stat-card:nth-child(4),
            .stats-grid .stat-card:nth-child(5) { grid-column: span 1; }
        }

        .stat-card {
            background: var(--surface-alt);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 12px 10px;
            text-align: center;
            transition: background var(--dur-med) var(--ease);
        }

        .stat-card.accent {
            background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-light) 100%);
            border-color: transparent;
        }

        .stat-label {
            font-size: 10px;
            font-weight: 600;
            letter-spacing: .5px;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 4px;
        }

        .stat-card.accent .stat-label { color: rgba(255,255,255,.75); }

        .stat-value {
            font-size: 18px;
            font-weight: 700;
            color: var(--text-primary);
            font-family: var(--font-mono);
            line-height: 1;
        }

        .stat-card.accent .stat-value { color: white; }

        /* ============================================================
           SEARCH
        ============================================================ */
        .search-wrap {
            position: relative;
        }

        .search-icon {
            position: absolute;
            left: 12px; top: 50%;
            transform: translateY(-50%);
            font-size: 15px;
            pointer-events: none;
        }

        #searchBox {
            width: 100%;
            padding: 11px 14px 11px 38px;
            font-size: 14px;
            font-family: var(--font-body);
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--surface-alt);
            color: var(--text-primary);
            outline: none;
            transition: border-color var(--dur-fast) var(--ease);
        }
        #searchBox::placeholder { color: var(--text-muted); }
        #searchBox:focus { border-color: var(--green-mid); background: var(--surface); }

        /* ============================================================
           TABLE
        ============================================================ */
        .table-wrap {
            overflow-y: auto;
            max-height: 420px;
            /* Smooth momentum scroll on iOS */
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        thead th {
            position: sticky;
            top: 0;
            z-index: 10;
            background: var(--surface-alt);
            color: var(--text-secondary);
            font-size: 11px;
            font-weight: 700;
            letter-spacing: .6px;
            text-transform: uppercase;
            padding: 10px 14px;
            border-bottom: 1px solid var(--border);
        }

        tbody tr {
            transition: background var(--dur-fast) var(--ease);
            animation: rowIn var(--dur-med) var(--ease) both;
        }

        @keyframes rowIn {
            from { opacity: 0; transform: translateY(-6px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        tbody tr:hover { background: var(--row-hover); }
        tbody tr:last-child td { border-bottom: none; }

        td {
            padding: 11px 14px;
            border-bottom: 1px solid var(--border);
            font-size: 14px;
            vertical-align: middle;
        }

        td.idx {
            color: var(--text-muted);
            font-size: 12px;
            font-family: var(--font-mono);
            width: 44px;
        }

        td.num-cell {
            font-family: var(--font-mono);
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            color: var(--text-primary);
        }

        td.num-cell:hover { color: var(--green-mid); }

        td.actions-cell {
            width: 100px;
            text-align: right;
        }

        .actions-cell .btn { margin-left: 4px; }

        /* Inline edit input */
        .edit-input {
            width: 100%;
            padding: 6px 10px;
            font-size: 14px;
            font-family: var(--font-mono);
            font-weight: 500;
            border: 2px solid var(--green-mid);
            border-radius: var(--radius-sm);
            background: var(--surface);
            color: var(--text-primary);
            outline: none;
            box-shadow: 0 0 0 3px rgba(17,153,142,.15);
        }

        /* ============================================================
           EMPTY STATE
        ============================================================ */
        .empty-state {
            text-align: center;
            padding: 48px 20px;
        }
        .empty-icon { font-size: 44px; margin-bottom: 12px; display: block; }
        .empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
        .empty-sub { font-size: 13px; color: var(--text-muted); }

        /* ============================================================
           TOAST NOTIFICATIONS
        ============================================================ */
        #toast-container {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999;
            display: flex;
            flex-direction: column;
            gap: 8px;
            align-items: center;
            pointer-events: none;
            width: calc(100% - 32px);
            max-width: 360px;
        }

        .toast {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 16px;
            border-radius: var(--radius-md);
            font-size: 14px;
            font-weight: 500;
            color: white;
            box-shadow: 0 6px 24px rgba(0,0,0,.25);
            pointer-events: auto;
            width: 100%;
            animation: toastIn var(--dur-med) var(--ease) both;
        }

        .toast.exit { animation: toastOut var(--dur-med) var(--ease) both; }

        @keyframes toastIn {
            from { opacity: 0; transform: translateY(16px) scale(.96); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }
        @keyframes toastOut {
            from { opacity: 1; transform: translateY(0) scale(1); }
            to   { opacity: 0; transform: translateY(8px) scale(.96); }
        }

        .toast-success { background: var(--green-mid); }
        .toast-error   { background: var(--red); }
        .toast-info    { background: var(--blue); }
        .toast-warning { background: var(--amber); color: #1a1a1a; }
        .toast-icon    { font-size: 18px; flex-shrink: 0; }
        .toast-msg     { flex: 1; }

        /* ============================================================
           MODAL (Confirmation + Export)
        ============================================================ */
        .modal-backdrop {
            position: fixed; inset: 0;
            background: rgba(0,0,0,.55);
            backdrop-filter: blur(4px);
            z-index: 500;
            display: flex;
            align-items: flex-end;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity var(--dur-med) var(--ease);
        }

        .modal-backdrop.open {
            opacity: 1;
            pointer-events: all;
        }

        .modal {
            background: var(--surface);
            border-radius: var(--radius-xl) var(--radius-xl) 0 0;
            width: 100%;
            max-width: 480px;
            padding: 8px 20px 32px;
            transform: translateY(100%);
            transition: transform var(--dur-slow) cubic-bezier(.32,1.15,.7,1);
        }

        .modal-backdrop.open .modal {
            transform: translateY(0);
        }

        .modal-handle {
            width: 40px; height: 4px;
            border-radius: 2px;
            background: var(--border);
            margin: 12px auto 20px;
        }

        .modal-title {
            font-size: 18px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 6px;
        }

        .modal-body {
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: 20px;
            line-height: 1.6;
        }

        .modal-field-label {
            font-size: 12px;
            font-weight: 600;
            letter-spacing: .4px;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 6px;
        }

        .modal-input {
            width: 100%;
            padding: 12px 14px;
            font-size: 15px;
            font-family: var(--font-body);
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--surface-alt);
            color: var(--text-primary);
            outline: none;
            margin-bottom: 16px;
            transition: border-color var(--dur-fast) var(--ease);
        }
        .modal-input:focus { border-color: var(--green-mid); }

        /* Export format toggle */
        .format-toggle {
            display: flex;
            gap: 8px;
            margin-bottom: 20px;
        }
        .fmt-btn {
            flex: 1;
            padding: 10px;
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--surface-alt);
            color: var(--text-secondary);
            font-size: 13px;
            font-weight: 600;
            font-family: var(--font-body);
            cursor: pointer;
            transition: all var(--dur-fast) var(--ease);
            text-align: center;
        }
        .fmt-btn.active {
            border-color: var(--green-mid);
            background: var(--green-faint);
            color: var(--green-mid);
        }

        .modal-actions {
            display: flex;
            gap: 10px;
        }
        .modal-actions .btn { flex: 1; height: 48px; font-size: 15px; }

        /* ============================================================
           INSTALL BANNER
        ============================================================ */
        #install-banner {
            display: none;
            margin: 0 16px;
            padding: 14px 16px;
            background: linear-gradient(135deg, var(--green-mid) 0%, #0d7a71 100%);
            border-radius: var(--radius-md);
            color: white;
            align-items: center;
            gap: 12px;
            box-shadow: var(--shadow-md);
            animation: bannerIn .4s var(--ease) both;
        }

        #install-banner.visible { display: flex; }

        @keyframes bannerIn {
            from { opacity: 0; transform: translateY(-10px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        .banner-text { flex: 1; }
        .banner-title { font-weight: 700; font-size: 14px; }
        .banner-sub { font-size: 12px; opacity: .8; }
        .banner-actions { display: flex; gap: 8px; }

        .btn-install {
            background: white;
            color: var(--green-mid);
            border: none;
            border-radius: 8px;
            padding: 7px 14px;
            font-size: 13px;
            font-weight: 700;
            font-family: var(--font-body);
            cursor: pointer;
            transition: transform var(--dur-fast) var(--ease);
        }
        .btn-install:active { transform: scale(.95); }

        .btn-dismiss {
            background: rgba(255,255,255,.2);
            color: white;
            border: none;
            border-radius: 8px;
            padding: 7px 10px;
            font-size: 13px;
            font-weight: 700;
            font-family: var(--font-body);
            cursor: pointer;
        }

        /* ============================================================
           OFFLINE BADGE
        ============================================================ */
        #offline-badge {
            display: none;
            text-align: center;
            padding: 6px 16px;
            background: var(--amber);
            color: #1a1a1a;
            font-size: 12px;
            font-weight: 600;
        }
        #offline-badge.visible { display: block; }

        /* ============================================================
           RESPONSIVE TWEAKS
        ============================================================ */
        @media (max-width: 400px) {
            .topbar-subtitle { display: none; }
            .toolbar .btn { font-size: 12px; padding: 0 10px; }
        }

        /* Safe area padding for notched phones */
        @supports (padding-bottom: env(safe-area-inset-bottom)) {
            .app-shell { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
            #toast-container { bottom: calc(24px + env(safe-area-inset-bottom)); }
            .modal { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
        }
   