/* <style> */
:root {
    --gp-bg: #f0f2f5;
    --gp-surface: #ffffff;
    --gp-text: #1f2937;
    --gp-muted: #6b7280;
    --gp-border: #e5e7eb;
    --gp-header: #1f2937;
    --gp-gold: #b8860b;
    --gp-gold-bg: #fff8dc;
    --gp-silver: #5c5c5c;
    --gp-silver-bg: #f3f4f6;
    --gp-radius: 10px;
    --gp-gap: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 12px;
    background-color: var(--gp-bg);
    color: var(--gp-text);
    line-height: 1.35;
    -webkit-text-size-adjust: 100%;
}

h1.price-title,
.price-title {
    text-align: center;
    font-size: clamp(1.15rem, 4.2vw, 1.75rem);
    font-weight: 700;
    color: #ffffff;
    background-color: rgb(53, 51, 51);
    padding: 12px 14px;
    border-radius: var(--gp-radius);
    margin: 0 0 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    position: relative;
}

.logout-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}
.logout-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.feed-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -4px 0 12px;
    padding: 8px 12px;
    border-radius: var(--gp-radius);
    background: #eef2f7;
    color: var(--gp-text);
    font-size: 0.9rem;
    font-weight: 600;
}
.feed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}
.feed-status.is-live {
    background: #ecfdf5;
    color: #065f46;
}
.feed-status.is-live .feed-dot {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}
.feed-status.is-stale {
    background: #fffbeb;
    color: #92400e;
}
.feed-status.is-stale .feed-dot {
    background: #f59e0b;
}
.feed-status.is-down {
    background: #fef2f2;
    color: #991b1b;
}
.feed-status.is-down .feed-dot {
    background: #ef4444;
}

h2 {
    text-align: left;
    font-size: clamp(1rem, 3.6vw, 1.35rem);
    margin: 22px 0 8px;
    color: var(--gp-text);
}

table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    margin-top: 0;
    background: var(--gp-surface);
}

th,
td {
    border: 1px solid #ddd;
    padding: 8px 6px;
    text-align: center;
    font-size: 13px;
    word-break: break-word;
}

/* Location + numeric rate tables (Kaka, Safari, Aarav live, etc.) */
table.rates-table {
    table-layout: fixed;
    width: 100%;
}

table.rates-table th.col-product {
    text-align: left;
    white-space: nowrap;
}

table.rates-table td.col-product {
    text-align: left;
    vertical-align: top;
    padding: 6px 5px;
}

table.rates-table .location-scroll {
    display: block;
    max-height: 3.25rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    font-size: 12px;
    padding-right: 3px;
}

table.rates-table td.col-num,
table.rates-table th.col-num {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
    overflow: hidden;
}

/* Location + Sell + Premium + P2 (sell-only rate tables) */
table.rates-table col.col-w-product {
    width: 34%;
}

table.rates-table col.col-w-num {
    width: 22%;
}

#kakaSilverPremiumTable col.col-w-product {
    width: 55%;
}

#kakaSilverPremiumTable col.col-w-num {
    width: 45%;
}

th {
    background-color: var(--gp-header);
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

td:first-child,
th:first-child {
    text-align: left;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 4px;
    background: var(--gp-surface);
}

.table-scroll table {
    margin: 0;
}

.price-container {
    display: flex;
    justify-content: center;
    gap: var(--gp-gap);
    font-size: clamp(0.95rem, 3.4vw, 1.15rem);
    font-weight: 700;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.gold-text,
.silver-text {
    margin: 0;
    flex: 1 1 160px;
    text-align: center;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.gold-text {
    color: var(--gp-gold);
    background: var(--gp-gold-bg);
}

.silver-text {
    color: var(--gp-silver);
    background: var(--gp-silver-bg);
}

.token-settings {
    max-width: 720px;
    margin: 12px auto 8px;
    padding: 12px 14px;
    background: var(--gp-surface);
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.token-settings-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    text-align: left;
}

.token-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: flex-end;
}

.token-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 140px;
    flex: 1;
}

.token-field label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.token-field input {
    padding: 10px 11px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px; /* avoids iOS zoom on focus */
    outline: none;
    width: 100%;
}

.token-field input:focus {
    border-color: #111827;
}

.token-save-btn {
    border: 1px solid #111827;
    background: #111827;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    height: 42px;
    width: 100%;
    max-width: 160px;
}

.token-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.token-save-msg {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 600;
    min-height: 18px;
}

.token-save-msg.success {
    color: #15803d;
}

.token-save-msg.error {
    color: #b91c1c;
}

.token-save-btn.secondary {
    background: #ffffff;
    color: #111827;
}

.alert-steps {
    margin: 0 0 14px;
    padding-left: 20px;
    color: var(--gp-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-steps code {
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
}

.alert-toggle-field .alert-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    font-size: 14px;
    font-weight: 600;
}

.alert-toggle-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.telegram-connect-box {
    margin: 12px 0 4px;
    padding: 12px;
    border: 1px solid var(--gp-border);
    border-radius: 8px;
    background: #f9fafb;
}

.telegram-connect-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.telegram-status {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
    color: #6b7280;
}

.telegram-status.connected {
    color: #15803d;
}

.telegram-status.pending {
    color: #b45309;
}

.users-panel {
    max-width: 720px;
    margin: 0 auto 16px;
    padding: 14px 16px;
    background: var(--gp-surface);
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.users-panel h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
}

.users-hint {
    margin: 0 0 12px;
    color: var(--gp-muted);
    font-size: 0.9rem;
}

.users-create-title {
    margin: 18px 0 10px;
    font-size: 1rem;
}

.users-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.user-action-btn {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.user-action-btn:hover {
    background: #eef2f7;
}

.user-action-btn.danger {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.metal-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: stretch;
    gap: 8px;
    padding: 8px 0;
    margin: 0 0 10px;
    background: rgba(240, 242, 245, 0.96);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--gp-border);
}

.metal-btn {
    flex: 1;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.metal-btn.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.metal-page {
    display: none;
}

.metal-page.active {
    display: block;
}

.spot-error {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 13px;
}

#output h2 {
    margin-top: 20px;
}

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

    .price-title {
        margin-bottom: 8px;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .price-container {
        gap: 8px;
    }

    .gold-text,
    .silver-text {
        flex: 1 1 100%;
        padding: 9px 12px;
        font-size: 0.95rem;
    }

    .token-settings {
        margin: 8px 0;
        padding: 10px;
    }

    .token-fields {
        flex-direction: column;
        align-items: stretch;
    }

    .token-field {
        min-width: 0;
        width: 100%;
    }

    .token-save-btn {
        max-width: none;
        width: 100%;
        margin-top: 2px;
    }

    .metal-header {
        padding: 6px 0;
        gap: 6px;
    }

    .metal-btn {
        padding: 11px 8px;
        font-size: 13px;
    }

    h2 {
        margin: 16px 0 6px;
        padding: 0 2px;
    }

    table {
        min-width: 480px;
    }

    th,
    td {
        padding: 7px 5px;
        font-size: 12px;
    }

    table.rates-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }

    table.rates-table th,
    table.rates-table td {
        word-break: normal;
        overflow-wrap: normal;
    }

    table.rates-table col.col-w-product {
        width: 38%;
    }

    table.rates-table col.col-w-num {
        width: 20%;
    }

    table.rates-table td.col-num,
    table.rates-table th.col-num {
        min-width: 4rem;
        padding-left: 4px;
        padding-right: 4px;
        font-size: 12px;
    }

    table.rates-table .location-scroll {
        max-height: 4rem;
        font-size: 11px;
    }

    /* Hide rarely-needed ID column on narrow phones */
    #arihantGoldPricesTable th:nth-child(1),
    #arihantGoldPricesTable td:nth-child(1),
    #jkSonsGoldPricesTable th:nth-child(1),
    #jkSonsGoldPricesTable td:nth-child(1),
    #jkSonsSilverPricesTable th:nth-child(1),
    #jkSonsSilverPricesTable td:nth-child(1) {
        display: none;
    }

    #aarav_silver-data th:nth-child(4),
    #aarav_silver-data td:nth-child(4),
    #aarav_silver-data th:nth-child(5),
    #aarav_silver-data td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 420px) {
    table:not(.rates-table) {
        min-width: 420px;
    }

    th,
    td {
        font-size: 11px;
        padding: 6px 4px;
    }
}
/* </style> */
