   :root {
      /* Colors */
      --primary-color: #2563eb;       /* Royal Blue */
      --primary-hover: #1d4ed8;
      --accent-color: #0f172a;        /* Dark Slate */
      --danger-color: #ef4444;
      --success-color: #10b981;
      --warning-color: #f59e0b;
      --bg-color: #f3f4f6;
      --card-bg: #ffffff;
      --text-main: #1f2937;
      --text-sub: #6b7280;
      --border-color: #e2e8f0;
      --input-border: #cbd5e1;
      
      /* Spacing & Shadow */
      --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
      --radius: 6px;
    }

    /* Reset & Base */
    * { box-sizing: border-box; }
    body {
      font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
      background-color: var(--bg-color);
      color: var(--text-main);
      margin: 0;
      padding: 20px;
      line-height: 1.5;
    }

    /* Layout */
    .container {
      max-width: 960px;
      margin: 0 auto 3rem auto;
      background-color: var(--card-bg);
      border-radius: var(--radius);
      box-shadow: var(--shadow-md);
      overflow: hidden;
    }

    /* Header */
    header {
      background-color: var(--card-bg);
      padding: 1.25rem 2rem;
      border-bottom: 3px solid var(--primary-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .app-title { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--primary-color); }
    .app-title small { font-size: 0.8rem; color: var(--text-sub); font-weight: 400; margin-left: 0.5rem; }

    /* Toast */
    .toast-container {
      position: fixed;
      top: 1rem;
      right: 1rem;
      z-index: 100;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }
    .toast {
      background-color: var(--accent-color);
      color: white;
      padding: 0.75rem 1.25rem;
      border-radius: 4px;
      font-size: 0.85rem;
      box-shadow: var(--shadow-md);
      opacity: 0;
      transform: translateY(-10px);
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    .toast.show { opacity: 1; transform: translateY(0); }
    .toast-success { border-left: 4px solid var(--success-color); }
    .toast-info { border-left: 4px solid var(--primary-color); }

    /* Main Content */
    .main-content { padding: 2rem; }
    .section { margin-bottom: 2.5rem; }

    /* Step Indicators */
    .step-label {
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--text-sub);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.8rem;
      display: block;
      border-left: 3px solid var(--border-color);
      padding-left: 0.5rem;
    }
    .step-label.active { border-color: var(--primary-color); color: var(--primary-color); }

    /* Input Group - Revised Layout */
    .input-row {
      display: grid;
      /* PC: 3 columns for Top Row (CaseID, QuoteName, Date) */
      grid-template-columns: 1fr 2fr 1fr;
      gap: 1rem 1.5rem;
      align-items: start;
    }
    
    .form-group { margin-bottom: 0.5rem; }
    
    /* Layout specific placement */
    .group-case-id    { grid-column: 1; grid-row: 1; }
    .group-quote-name { grid-column: 2; grid-row: 1; }
    .group-date       { grid-column: 3; grid-row: 1; }
    
    /* Client Name takes full width on 2nd row */
    .group-client     { grid-column: 1 / -1; grid-row: 2; }
    
    label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.85rem; }
    input[type="text"], input[type="number"], input[type="date"], select {
      width: 100%;
      padding: 0.65rem;
      border: 1px solid var(--input-border);
      border-radius: 4px;
      font-size: 0.95rem;
      transition: border-color 0.2s;
    }
    input:focus, select:focus {
      outline: none;
      border-color: var(--primary-color);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }
    input.error { border-color: var(--danger-color); background-color: #fff1f2; }

    /* --- Configuration Area (Unified) --- */
    .config-panel {
      background-color: #f8fafc;
      border: 1px solid var(--border-color);
      border-radius: 6px;
      padding: 1.5rem;
    }
    .config-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2rem;
    }
    .config-title {
      font-size: 0.9rem;
      font-weight: 700;
      color: var(--text-main);
      margin-bottom: 0.75rem;
      border-bottom: 2px solid #e2e8f0;
      padding-bottom: 0.25rem;
    }

    .preset-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
    .tag {
      font-size: 0.75rem; padding: 4px 10px; border-radius: 12px;
      background-color: white; border: 1px solid var(--input-border);
      cursor: pointer; transition: all 0.2s;
    }
    .tag:hover, .tag.active { 
      border-color: var(--primary-color); color: var(--primary-color); 
      background-color: #eff6ff;
    }
    .tag.active { background-color: var(--primary-color); color: white; }

    .tax-inputs { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; }
    .tax-rate-wrap { position: relative; }
    .tax-rate-wrap input { padding-right: 2.2rem; }
    .tax-rate-wrap::after {
      content: "%"; position: absolute; right: 1.5rem; top: 50%;
      transform: translateY(-50%); color: var(--text-sub); font-size: 0.9rem;
      pointer-events: none;
    }

    /* Items Table */
    .table-responsive { overflow-x: auto; }
    .quote-table { width: 100%; border-collapse: collapse; min-width: 600px; }
    .quote-table th {
      text-align: left; padding: 0.75rem 0.5rem;
      border-bottom: 2px solid var(--border-color);
      font-size: 0.85rem; color: var(--text-sub);
    }
    .quote-table td {
      padding: 0.5rem; border-bottom: 1px solid var(--border-color); vertical-align: top;
    }
    .col-action { width: 40px; text-align: center; }
    .col-desc { width: auto; }
    .col-price { width: 130px; }
    .col-qty { width: 90px; }
    .col-total { width: 140px; text-align: right; font-weight: 700; font-family: monospace; }
    
    .input-num { text-align: right; }
    .placeholder-val { color: var(--input-border); font-weight: 400; }

    /* Summary & Stamp Area */
    .summary-section {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2rem;
      margin-top: 2rem;
    }
    
    /* Issuer/Stamp Settings */
    .issuer-settings {
      padding: 1rem;
      background-color: #f9fafb;
      border-radius: 6px;
      border: 1px dashed var(--border-color);
    }
    .stamp-preview {
      margin-top: 0.5rem;
      height: 80px;
      border: 1px solid #e5e7eb;
      background-color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      color: #9ca3af;
      font-size: 0.8rem;
    }
    .stamp-preview img { max-height: 100%; max-width: 100%; }

    /* Summary Card */
    .summary-card {
      background-color: #f8fafc;
      border-radius: 6px;
      padding: 1.5rem;
      text-align: right;
    }
    .summary-row {
      display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.95rem;
    }
    .summary-row.total-row {
      margin-top: 1rem; padding-top: 1rem; border-top: 2px solid var(--border-color);
      font-size: 1.4rem; font-weight: 700; color: var(--primary-color); align-items: baseline;
    }

    /* Archive/Footer Area */
    .archive-area {
      margin-top: 3rem;
      border-top: 1px solid var(--border-color);
      padding-top: 2rem;
    }
    .archive-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
    .archive-actions { display: flex; gap: 0.5rem; }

    .archive-list {
      max-height: 300px; overflow-y: auto;
      border: 1px solid var(--border-color); border-radius: 4px;
    }
    .archive-item {
      padding: 0.75rem; border-bottom: 1px solid var(--border-color);
      display: grid; grid-template-columns: 1fr 2fr 1fr 1fr 80px;
      gap: 1rem; align-items: center; font-size: 0.9rem;
      background: white;
    }
    .archive-item:hover { background-color: #f9fafb; }
    .archive-item:last-child { border-bottom: none; }

    /* Buttons */
    .btn {
      padding: 0.6rem 1.2rem; border: none; border-radius: 4px;
      cursor: pointer; font-weight: 600; font-size: 0.9rem;
      display: inline-flex; align-items: center; gap: 0.4rem;
      transition: all 0.2s;
    }
    .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
    .btn-primary { background-color: var(--primary-color); color: white; }
    .btn-primary:hover { background-color: var(--primary-hover); }
    .btn-primary:disabled { background-color: var(--input-border); cursor: not-allowed; }
    .btn-outline { background: white; border: 1px solid var(--border-color); color: var(--text-main); }
    .btn-outline:hover { background-color: #f1f5f9; }
    .btn-danger-icon { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1.2rem; }
    .btn-danger-icon:hover { color: var(--danger-color); }

    /* --- PRINT STYLES (Optimized) --- */
    @media print {
      @page { margin: 10mm; size: A4 portrait; }
      
      body { 
        background: white; padding: 0; font-size: 10.5pt; color: #000; 
        -webkit-print-color-adjust: exact; margin: 0;
      }
      .container { 
        box-shadow: none; max-width: 100%; width: 100%; margin: 0; padding: 0; overflow: visible; 
      }

      /* Force Hide unwanted elements */
      .no-print, .step-label, .add-row-container, .toast-container, .archive-area,
      header, .footer-actions, .config-panel, .issuer-settings, .print-notice { 
        display: none !important; 
      }

      /* Hide Step 1 (Input Form) to let Print Header take over */
      .main-content > .section:nth-of-type(1) { display: none !important; }

      .main-content { padding: 0; }
      .section { margin-bottom: 1rem; }
      
      input, select { 
        border: none; padding: 0; background: none; -webkit-appearance: none; 
        width: auto; font-size: inherit; color: #000;
      }
      
      /* --- Print Header Layout --- */
      .print-header {
        position: relative; margin-bottom: 2rem; padding-bottom: 0; width: 100%;
      }
      
      /* 1. Title (Centered) */
      .print-title { 
        font-size: 2rem; font-weight: bold; text-align: center; width: 100%;
        margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid #000; letter-spacing: 0.1em;
      }
      
      /* 2. Meta Info (Date & CaseID) - Top Right Compact */
      .print-meta {
        position: absolute; top: 0; right: 0; text-align: right; font-size: 0.85rem; line-height: 1.3;
      }
      .print-meta-item { display: block; }
      .print-meta-item span:first-child { margin-right: 0.5rem; }

      /* Wrapper for Client & Issuer */
      .print-info-grid {
        display: flex; justify-content: space-between; margin-top: 1.5rem; align-items: flex-start;
      }

      /* 3. Client Info (Left) */
      .print-client { width: 55%; margin-top: 0; }
      .print-client .label { font-size: 0.9rem; color: #333; display: block; margin-bottom: 0.2rem; }
      .print-client .value { 
        font-size: 1.3rem; font-weight: bold; display: block; border-bottom: 1px solid #ccc;
        padding-bottom: 0.2rem; margin-bottom: 0.5rem;
      }
      .print-client #printQuoteName {
        font-size: 1.1rem; font-weight: normal; border-bottom: none;
      }
      
      /* 4. Issuer Info (Right, shifted down) */
      .print-issuer { 
        width: 40%; text-align: right; margin-top: 2.5rem;
      }
      .print-issuer .company { font-size: 1.1rem; font-weight: bold; margin-bottom: 0.3rem;}
      .print-issuer .address { font-size: 0.9rem; white-space: pre-wrap; line-height: 1.4; }
      
      /* Stamp */
      .print-stamp-box {
        position: relative; display: inline-block; margin-top: 1rem;
        width: 70px; height: 70px;
      }
      .print-stamp-box img { width: 100%; height: 100%; object-fit: contain; opacity: 0.85; }

      /* --- Quote Table (Main Actor) --- */
      .quote-table { margin-top: 2rem; border-top: 2px solid #000; }
      .quote-table th { 
        background-color: #f0f0f0 !important; color: #000; border-bottom: 1px solid #000; 
        padding: 0.6rem 0.4rem; font-weight: bold;
      }
      .quote-table td { border-bottom: 1px solid #ccc; padding: 0.8rem 0.4rem; }
      .col-action { display: none; }
      
      /* --- Summary --- */
      .summary-section { display: block; margin-top: 0; page-break-inside: avoid; }
      .summary-card { 
        background: none; border: none; width: 40%; margin-left: auto; 
        padding: 1rem 0 0 0; margin-top: 1rem;
      }
      .summary-row { border-bottom: 1px dotted #ccc; margin-bottom: 0.5rem; padding-bottom: 0.2rem; }
      .summary-row.total-row { 
        border-top: 2px solid #000; border-bottom: none; font-size: 1.4rem; margin-top: 1rem; padding-top: 0.5rem;
      }
      
      /* Input fixes */
      .input-desc { width: 100%; font-weight: 500; }
      .input-num { text-align: right; }
    }

    /* Print Header (Hidden on Screen) */
    .print-only { display: none; }
    @media print { .print-only { display: block; } }

    /* Mobile */
    @media (max-width: 768px) {
      .input-row { grid-template-columns: 1fr; }
      .config-grid { grid-template-columns: 1fr; gap: 1rem; }
      .summary-section { grid-template-columns: 1fr; gap: 1rem; }
      .archive-item { grid-template-columns: 1fr; gap: 0.5rem; border-bottom: 2px solid #e5e7eb; }
      
      /* Reset grid placement for mobile stack */
      .group-case-id, .group-quote-name, .group-date, .group-client {
        grid-column: auto; grid-row: auto;
      }
    }
  