/* === RESET & BASE === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--layout-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif);
  background: #f5f5f7;
  color: #1d1d1f;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:root {
  --layout-glass-control-bg: rgba(255, 255, 255, 0.2);
  --layout-glass-control-hover-bg: rgba(255, 255, 255, 0.24);
  --layout-liquid-glass-shadow:
    rgba(242, 242, 242, 0.8) 2px 2px 3px -3px inset,
    rgba(242, 242, 242, 0.8) -2px -2px 3px -3px inset,
    rgba(255, 255, 255, 0.8) -3px -3px 0.8px -3.5px inset,
    rgba(255, 255, 255, 0.8) 3px 3px 0.8px -3.5px inset,
    rgba(0, 0, 0, 0.1) 0 0 8px 0;
}

.footer {
  margin-top: 34px;
}

        .container {
            width: min(100%, 1060px);
            max-width: 1060px;
            margin: 42px auto 56px;
            padding: 0 clamp(14px, 3vw, 24px);
            overflow-x: clip;
        }

        .grid {
            display: grid;
            grid-template-columns: minmax(320px, 440px) minmax(380px, 480px);
            gap: clamp(28px, 4vw, 48px);
            align-items: start;
            justify-content: center;
        }

        @media (max-width: 768px) {
            .container {
              width: 100%;
              margin: 8px auto 24px;
              padding: 0 22px;
          }
        }

        /* Form Section */
        .form-section {
            background: #fff;
            border-radius: 32px;
            padding: clamp(28px, 3vw, 36px) clamp(22px, 3vw, 30px) clamp(24px, 3vw, 34px);
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
            position: relative;
            top: auto;
            min-width: 0;
            width: 100%;
        }

        .form-title {
            font-size: 40px;
            font-weight: 600;
            background: linear-gradient(90deg, #0084ff 30%, #ff6600 60%);
 			-webkit-background-clip: text;
			-webkit-text-fill-color: transparent;
  			text-shadow: 0 0 70px rgba(255, 159, 64, 0.9);
            margin: 0 0 10px;
            letter-spacing: 0;
            line-height: 1.24;
            text-align: center;
        }

        .form-subtitle {
            font-size: 17px;
            color: #86868b;
            margin: 0 0 42px;
            text-align: center;
            line-height: 1.45;
        }

        .input-group {
            margin-bottom: 24px;
        }

        .input-label {
            display: block;
            font-size: 15px;
            font-weight: 600;
            color: #1d1d1f;
            margin-bottom: 12px;
            text-align: center;
        }

        .input-with-icon {
            position: relative;
            width: 100%;
            border-radius: 999px;
            overflow: hidden;
            transition: transform 0.24s ease;
        }

        .input-with-icon::before {
            content: "";
            position: absolute;
            inset: 0;
            z-index: 1;
            border-radius: inherit;
            background:
                linear-gradient(180deg, rgba(247,248,250,0.72), rgba(232,234,238,0.46) 48%, rgba(220,223,229,0.34)),
                linear-gradient(180deg, rgba(255,255,255,0.16), transparent 22%);
            box-shadow:
                0 12px 24px rgba(120, 128, 140, 0.14),
                0 3px 8px rgba(120, 128, 140, 0.1),
                inset 0 -8px 14px rgba(136, 143, 155, 0.1),
                inset 0 1px 10px rgba(255,255,255,0.16);
            backdrop-filter: blur(18px) saturate(145%);
            -webkit-backdrop-filter: blur(18px) saturate(145%);
            pointer-events: none;
            transition: background 0.24s ease, box-shadow 0.24s ease, transform 0.24s ease;
        }

        .input-with-icon:focus-within::before {
            background:
                linear-gradient(180deg, rgba(248,249,251,0.78), rgba(236,238,242,0.58) 52%, rgba(226,229,235,0.44)),
                linear-gradient(180deg, rgba(255,255,255,0.24), transparent 24%);
            box-shadow:
                0 18px 38px rgba(120, 128, 140, 0.18),
                0 6px 14px rgba(120, 128, 140, 0.14),
                inset 0 -8px 14px rgba(136, 143, 155, 0.05),
                inset 0 1px 14px rgba(255,255,255,0.62);
            backdrop-filter: blur(22px) saturate(170%);
            -webkit-backdrop-filter: blur(22px) saturate(170%);
            transform: translateY(-1px);
        }

        .input-with-icon:hover {
            transform: translateY(-1px);
        }

        .input-field {
            position: relative;
            z-index: 2;
            width: 100%;
            min-height: 58px;
            padding: 16px 18px;
            font-size: 17px;
            border: 0;
            border-radius: 999px;
            background: transparent;
            color: #1d1d1f;
            transition: color 0.2s ease;
            outline: none;
            -webkit-appearance: none;
            appearance: none;
        }

        .input-field::placeholder {
            color: rgba(29, 29, 31, 0.52);
        }

        .input-field:focus {
            color: #111113;
        }

        .btn-primary {
            width: 100%;
            padding: 16px;
            font-size: 17px;
            font-weight: 600;
            color: #fff;
            background:
                linear-gradient(180deg, rgba(0, 122, 255, 0.9), rgba(0, 113, 227, 0.78)),
                var(--layout-glass-control-bg);
            border: none;
            border-radius: 999px;
            cursor: pointer;
            box-shadow: var(--layout-liquid-glass-shadow);
            backdrop-filter: blur(8px) saturate(160%);
            -webkit-backdrop-filter: blur(8px) saturate(160%);
            transition: all 0.2s ease;
            min-height: 54px;
        }

        .btn-primary:hover {
            background:
                linear-gradient(180deg, rgba(0, 128, 255, 0.96), rgba(0, 119, 237, 0.88)),
                var(--layout-glass-control-hover-bg);
            transform: translateY(-1px);
        }

        .btn-primary:active {
            transform: translateY(0);
        }

        /* Results Section */
        .results-section {
            position: relative;
            display: grid;
            place-items: center;
            min-height: 220px;
            min-width: 0;
            isolation: isolate;
        }

        #result {
            width: 100%;
            min-width: 0;
        }

        .loading {
            display: none;
            justify-content: center;
            align-items: center;
            padding: 60px 20px;
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 3px solid #d2d2d7;
            border-top-color: #0071e3;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .empty-state {
            width: 100%;
            text-align: center;
            padding: 48px 20px;
            color: #86868b;
        }

        .empty-state svg {
            width: 80px;
            height: 80px;
            margin-bottom: 24px;
            opacity: 0.5;
        }

        .empty-state h3 {
            font-size: 24px;
            font-weight: 600;
            color: #1d1d1f;
            margin-bottom: 8px;
        }

        .empty-state p {
            font-size: 17px;
        }

        .order-card {
            background: #fff;
            border-radius: 32px;
            padding: clamp(22px, 3vw, 30px);
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
            margin-bottom: 20px;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            min-width: 0;
        }

        .order-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 16px rgba(0,0,0,0.08);
        }

        .status-badge {
            display: inline-block;
            padding: 5px 12px;
            font-size: 14px;
            font-weight: 650;
            border-radius: 999px;
            margin-bottom: 20px;
        }

        .order-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: nowrap;
            margin-bottom: 20px;
        }

        .order-card-header .status-badge {
            margin-bottom: 0;
            white-space: nowrap;
        }

        .order-card-header .status-badge:first-child {
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .order-code-badge {
            margin-left: auto;
            font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
            background: #f2f4f7 !important;
            color: #1d2939 !important;
        }

        .status-success {
            background: #e8f5e9;
            color: #2e7d32;
        }

        .status-pending {
            background: #e3f2fd;
            color: #1976d2;
        }

        .status-warning {
            background: #fff3e0;
            color: #f57c00;
        }

        .status-danger {
            background: #ffebee;
            color: #d32f2f;
        }

        .order-details {
            display: grid;
            gap: 20px;
        }

        .detail-row {
            display: flex;
            justify-content: space-between;
            padding-bottom: 16px;
            border-bottom: 1px solid #f5f5f7;
        }

        .detail-row:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

        .detail-label {
            font-size: 15px;
            color: #86868b;
            font-weight: 500;
        }

        .detail-value {
            font-size: 15px;
            color: #1d1d1f;
            font-weight: 500;
            text-align: right;
            max-width: 60%;
            word-break: break-word;
        }

        .detail-value.udid-value {
            max-width: none;
            white-space: nowrap;
            font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
            font-size: 15px;
            letter-spacing: -0.02em;
        }

        .detail-value.udid-value--long {
            max-width: calc(100% - 72px);
            margin-left: 20px;
            white-space: normal;
            overflow-wrap: anywhere;
        }

        .order-note-card {
            margin-top: 20px;
            padding: 14px 16px;
            background: #f5f5f7;
            border: 0;
            border-radius: 18px;
            text-align: center;
        }

        .order-note-text {
            display: block;
            color: #1d1d1f;
            font-size: 15px;
            font-weight: 600;
            line-height: 1.45;
            word-break: break-word;
        }

        .order-note-card.note-pending .order-note-text {
            color: #0071e3;
        }

        .order-note-card.note-warning .order-note-text {
            color: #f57c00;
        }

        .order-note-card.note-danger .order-note-text {
            color: #d32f2f;
        }

        .order-note-card.note-success .order-note-text {
            color: #34c759;
        }

        .cert-actions {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
            margin-top: 24px;
        }

        .btn-download,
        .btn-install-esign {
            min-height: 48px;
            padding: 12px 18px;
            font-size: 15px;
            font-weight: 600;
            color: #1d1d1f;
            border: none;
            border-radius: 999px;
            text-decoration: none;
            transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: var(--layout-liquid-glass-shadow);
            backdrop-filter: blur(8px) saturate(160%);
            -webkit-backdrop-filter: blur(8px) saturate(160%);
        }

        .btn-download {
            background: var(--layout-glass-control-bg);
            color: #1d1d1f;
        }

        .btn-download:hover {
            background: var(--layout-glass-control-hover-bg);
            color: #007aff;
            transform: translateY(-1px);
        }

        .btn-install-esign {
            background:
                linear-gradient(180deg, rgba(0, 122, 255, 0.9), rgba(0, 113, 227, 0.78)),
                var(--layout-glass-control-bg);
            color: #fff;
            letter-spacing: 0;
            font-weight: 600;
            font-size: 15px;
        }

        .btn-install-esign:hover {
            background:
                linear-gradient(180deg, rgba(0, 128, 255, 0.96), rgba(0, 119, 237, 0.88)),
                var(--layout-glass-control-hover-bg);
            transform: translateY(-1px);
        }

        .btn-download:active,
        .btn-install-esign:active {
            transform: scale(0.98);
        }

        .btn-install-esign.show-progress {
            gap: 10px;
            background: #0071e3;
        }

        .btn-install-esign.show-progress::before {
            content: "";
            width: 16px;
            height: 16px;
            border: 2px solid rgba(255, 255, 255, 0.35);
            border-top-color: #fff;
            border-radius: 50%;
            animation: spin 0.6s linear infinite;
            flex: 0 0 16px;
        }

        .btn-install-esign.show-progress.error {
            background: #ff3b30;
        }

        .btn-install-esign.disabled {
            cursor: not-allowed;
        }

        .notfound {
            text-align: center;
            width: 100%;
            padding: clamp(22px, 3vw, 30px);
            background: #fff;
            border-radius: 32px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        }

        .notfound h2 {
            font-size: 24px;
            color: #86868b;
            font-weight: 500;
        }

        @media (max-width: 1023px) {
            .grid {
                grid-template-columns: minmax(0, 1fr);
                gap: 18px;
            }

            .form-section,
            .order-card {
                border-radius: 32px;
            }
        }

        @media (max-width: 640px) {
            .container {
                padding: 0 18px;
            }

            .form-section {
                padding: 30px 16px 16px;
            }

            .order-card {
                padding: 16px;
            }

            .form-title {
                font-size: 36px;
            }

            .cert-actions {
                grid-template-columns: 1fr;
            }

        }

        /* Certificate actions and check modal — matched to profile orders. */
        .button-group { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: auto; padding-top: 24px; }
        .download-btn, .install-esign-btn, .check-cert-btn { flex: 1; min-width: 150px; min-height: 44px; padding: 11px 18px; font-size: 15px; font-weight: 600; color: #1d1d1f; background: var(--layout-glass-control-bg, rgba(255,255,255,.2)); border: 0; border-radius: 999px; cursor: pointer; transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--layout-liquid-glass-shadow, 0 0 8px rgba(0,0,0,.1)); backdrop-filter: blur(8px) saturate(180%); -webkit-backdrop-filter: blur(8px) saturate(180%); -webkit-tap-highlight-color: transparent; }
        a.download-btn { text-decoration: none; }
        .download-btn:focus-visible, .install-esign-btn:focus-visible, .check-cert-btn:focus-visible { outline: 2px solid #0071e3; outline-offset: 3px; }
        .download-btn svg, .install-esign-btn svg, .check-cert-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; flex: 0 0 17px; }
        .download-btn, .check-cert-btn { background: var(--layout-glass-control-bg, rgba(255,255,255,.2)); color: #1d1d1f; }
        .install-esign-btn { width: 100%; background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0)), #0071e3; color: #fff; font-weight: 700; line-height: normal; }
        .check-cert-btn { width: auto; line-height: normal; }
        .certificate-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
        .certificate-actions .download-btn, .certificate-actions .check-cert-btn { width: 100%; }
        .check-cert-btn:hover { background: var(--layout-glass-control-hover-bg, rgba(255,255,255,.24)); color: #007aff; box-shadow: var(--layout-liquid-glass-shadow, 0 0 8px rgba(0,0,0,.1)), 0 12px 28px rgba(0,0,0,.1); transform: translateY(-1px); }
        .download-btn:hover { background: var(--layout-glass-control-hover-bg, rgba(255,255,255,.24)); color: #007aff; box-shadow: var(--layout-liquid-glass-shadow, 0 0 8px rgba(0,0,0,.1)), 0 12px 28px rgba(0,0,0,.1); transform: translateY(-2px); }
        .install-esign-btn:hover { background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,0)), #0077ed; color: #fff; box-shadow: var(--layout-liquid-glass-shadow, 0 0 8px rgba(0,0,0,.1)), 0 10px 24px rgba(0,113,227,.26); transform: translateY(-2px); }
        .download-btn:active, .check-cert-btn:active, .install-esign-btn:active { transform: scale(.98); }
        .install-esign-btn.show-progress { background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0)), #0071e3; color: #fff; font-size: 15px; line-height: 1.35; padding: 12px 24px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 5px; }
        .install-esign-btn.show-progress.error { background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0)), rgba(255,59,48,.9); }
        .install-progress-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; flex: 0 0 16px; }
        .install-progress-percent { min-width: 34px; padding: 0; background: transparent; color: #fff; font-size: 14px; font-weight: 700; line-height: 1.3; text-align: center; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
        .install-progress-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .download-btn.disabled, .install-esign-btn.disabled, .check-cert-btn.disabled { background: #d1d1d6; color: #fff; cursor: not-allowed; transform: none; box-shadow: var(--layout-liquid-glass-shadow, 0 0 8px rgba(0,0,0,.1)); }
        .install-esign-btn.show-progress.disabled, .install-esign-btn.show-progress.disabled:hover { background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0)), #0071e3; color: #fff; cursor: default; box-shadow: none; transform: none; }
        .install-esign-btn.show-progress.error.disabled, .install-esign-btn.show-progress.error.disabled:hover { background: #ff3b30; border-color: #ff3b30; cursor: not-allowed; }
        .cert-check-modal { position: fixed; inset: 0; z-index: 10000; display: block; visibility: hidden; pointer-events: none; transition: visibility 0s linear .34s; }
        .cert-check-modal.active, .cert-check-modal.closing { display: flex; align-items: center; justify-content: center; padding: 18px; }
        .cert-check-modal.active { visibility: visible; pointer-events: auto; transition-delay: 0s; }
        .cert-check-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.32); opacity: 0; transition: opacity .28s ease; }
        .cert-check-dialog { position: relative; width: min(92vw,560px); max-height: min(86vh,760px); margin: 0; overflow: hidden; display: flex; flex-direction: column; border-radius: 28px; background: var(--layout-header-bg, rgba(255,255,255,.94)); border: 1px solid var(--layout-mobile-menu-border, rgba(255,255,255,.34)); box-shadow: var(--layout-liquid-glass-shadow), 0 24px 70px rgba(15,23,42,.18); backdrop-filter: blur(var(--layout-header-blur,18px)); -webkit-backdrop-filter: blur(var(--layout-header-blur,18px)); opacity: 0; transform: translateY(12px) scale(.94); transition: opacity .26s ease, transform .3s cubic-bezier(.22,1,.36,1); }
        .cert-check-modal.active .cert-check-overlay { opacity: 1; }
        .cert-check-modal.active .cert-check-dialog { opacity: 1; transform: translateY(0) scale(1); }
        .cert-check-modal.closing { visibility: visible; pointer-events: none; transition-delay: 0s; }
        .cert-check-modal.closing .cert-check-overlay { opacity: 0; }
        .cert-check-modal.closing .cert-check-dialog { opacity: 0; transform: translateY(14px) scale(.985); }
        .cert-check-close { position: absolute; top: 14px; right: 14px; z-index: 1; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--layout-glass-control-bg); color: #1d1d1f; font-size: 26px; cursor: pointer; box-shadow: var(--layout-liquid-glass-shadow); }
        .cert-check-header { padding: 28px 28px 18px; border-bottom: 1px solid rgba(255,255,255,.36); }
        .cert-check-header h3 { margin: 0; font-size: 24px; color: #1d1d1f; }
        .cert-check-header p { margin: 8px 36px 0 0; color: #6e6e73; font-size: 14px; }
        .cert-check-body { padding: 22px 28px 28px; overflow-y: auto; }
        .cert-check-result { display: grid; gap: 12px; }
        .cert-result-row, .cert-skeleton-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.44); border-radius: 16px; background: rgba(255,255,255,.34); box-shadow: var(--layout-liquid-glass-shadow); }
        .cert-result-label { color: #6e6e73; font-size: 14px; font-weight: 500; }
        .cert-result-value { color: #1d1d1f; font-size: 15px; font-weight: 600; text-align: right; word-break: break-word; }
        .cert-status-badge { display: inline-flex; min-width: 86px; justify-content: center; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
        .cert-status-badge.status-valid { color: #1f7a37; background: #e8f5e9; }.cert-status-badge.status-revoked { color: #c62828; background: #ffebee; }.cert-status-badge.status-expired { color: #b26a00; background: #fff4df; }
        .cert-check-message { padding: 14px 16px; border-radius: 16px; background: #ffebee; color: #c62828; font-size: 14px; font-weight: 500; line-height: 1.5; }
        .cert-skeleton-line { position: relative; overflow: hidden; height: 14px; border-radius: 999px; background: rgba(210,210,215,.72); }.cert-skeleton-line.label { width: 120px; }.cert-skeleton-line.value { width: 140px; }
        .cert-skeleton-line::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.82), transparent); animation: cert-skeleton 1.2s ease-in-out infinite; }
        @keyframes cert-skeleton { 100% { transform: translateX(100%); } }
        @media (max-width: 640px) { .cert-check-dialog { width: min(94vw,560px); }.cert-check-header, .cert-check-body { padding-left: 18px; padding-right: 18px; } }
