/* ============================================================
   NetSuite OTP Login + Invoice Dashboard CSS
   ============================================================ */

:root {
    --otp-primary:  #2D66B1;
    --otp-dark:     #11162B;
    --otp-gradient: linear-gradient(135deg, #2D66B1, #11162B);
    --otp-white:    #ffffff;
    --otp-input-bg: #eef3fb;
    --otp-border:   #d0dff0;
    --otp-muted:    #6b7a99;
    --otp-success:  #2ecc71;
    --otp-error:    #e74c3c;
    --otp-radius:   12px;
    --otp-shadow:   0 20px 60px rgba(17,22,43,0.35);
}

/* ---- HEADER BUTTON ---- */
.otp-nav-item { display:flex !important; align-items:center !important; margin-left:12px; }
.otp-header-btn { background:var(--otp-gradient); color:#fff !important; border:none; padding:9px 22px; border-radius:50px; font-size:14px; font-weight:600; cursor:pointer; transition:all 0.25s; box-shadow:0 4px 15px rgba(45,102,177,0.35); white-space:nowrap; }
.otp-header-btn:hover { transform:translateY(-2px); box-shadow:0 8px 25px rgba(45,102,177,0.5); }
.otp-user-greeting { color:var(--otp-primary); font-size:13px; font-weight:500; margin-right:8px; }
.otp-logout-btn { background:transparent; color:var(--otp-muted) !important; border:1px solid var(--otp-border); padding:6px 14px; border-radius:50px; font-size:13px; text-decoration:none !important; cursor:pointer; transition:all 0.2s; }
.otp-logout-btn:hover { border-color:var(--otp-primary); color:var(--otp-primary) !important; }

/* ---- OVERLAY ---- */
.otp-overlay { position:fixed; inset:0; background:rgba(17,22,43,0.7); backdrop-filter:blur(6px); z-index:999999; align-items:center; justify-content:center; padding:16px; }
.otp-overlay.otp-open { display:flex !important; }

/* ---- MODAL ---- */
.otp-modal { background:#fff; border-radius:20px; padding:40px 36px; width:100%; max-width:420px; position:relative; box-shadow:var(--otp-shadow); animation:otpSlideUp 0.3s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes otpSlideUp { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }
.otp-close { position:absolute; top:16px; right:18px; background:none; border:none; font-size:24px; color:var(--otp-muted); cursor:pointer; padding:4px 8px; border-radius:6px; transition:all 0.2s; }
.otp-close:hover { background:var(--otp-input-bg); color:var(--otp-dark); }
.otp-logo { display:flex; justify-content:center; margin-bottom:16px; }
.otp-title { font-size:22px !important; font-weight:700 !important; color:var(--otp-dark) !important; text-align:center; margin:0 0 6px !important; }
.otp-subtitle { font-size:14px; color:var(--otp-muted); text-align:center; margin:0 0 28px !important; line-height:1.5; }
.otp-subtitle strong { color:var(--otp-primary); font-weight:600; }

/* ---- FORM ---- */
.otp-field-group { margin-bottom:20px; }
.otp-field-group label { display:block; font-size:13px; font-weight:600; color:var(--otp-primary); margin-bottom:8px; }
.otp-req { color:var(--otp-error); }
.otp-phone-wrap { display:flex; gap:8px; }
.otp-country-select { background:var(--otp-input-bg); border:2px solid var(--otp-border); border-radius:var(--otp-radius); padding:11px 8px; font-size:14px; color:#11162B; cursor:pointer; outline:none; min-width:90px; transition:border-color 0.2s; appearance:none; -webkit-appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7a99' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 8px center; padding-right:24px; }
.otp-country-select:focus { border-color:var(--otp-primary); }
.otp-input { flex:1; background:var(--otp-input-bg) !important; border:2px solid var(--otp-border) !important; border-radius:var(--otp-radius) !important; padding:12px 16px !important; font-size:15px !important; color:#11162B !important; outline:none !important; transition:all 0.2s !important; }
.otp-input:focus { border-color:var(--otp-primary) !important; box-shadow:0 0 0 3px rgba(45,102,177,0.15) !important; background:#fff !important; }

/* ---- OTP BOXES ---- */
.otp-boxes-wrap { display:flex; gap:8px; justify-content:center; margin:0 0 20px; }
.otp-box { width:46px !important; height:54px !important; text-align:center !important; font-size:22px !important; font-weight:700 !important; color:#11162B !important; background:var(--otp-input-bg) !important; border:2px solid var(--otp-border) !important; border-radius:10px !important; outline:none !important; transition:all 0.15s !important; caret-color:transparent; padding:0 !important; }
.otp-box:focus { border-color:var(--otp-primary) !important; background:#fff !important; box-shadow:0 0 0 3px rgba(45,102,177,0.15) !important; transform:scale(1.05); }
.otp-box.filled { border-color:var(--otp-primary) !important; background:#e8f0fb !important; }
.otp-box.error-box { border-color:var(--otp-error) !important; animation:otpShake 0.4s ease; }
@keyframes otpShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-4px)} 40%{transform:translateX(4px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* ---- BUTTONS ---- */
.otp-primary-btn { width:100%; background:var(--otp-gradient); color:#fff !important; border:none; border-radius:50px; padding:14px 24px; font-size:15px; font-weight:600; cursor:pointer; transition:all 0.25s; box-shadow:0 4px 18px rgba(45,102,177,0.4); display:flex; align-items:center; justify-content:center; gap:8px; margin-bottom:16px; }
.otp-primary-btn:hover:not(:disabled) { transform:translateY(-2px); box-shadow:0 8px 25px rgba(45,102,177,0.55); }
.otp-primary-btn:disabled { opacity:0.65; cursor:not-allowed; }
.otp-spinner { display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,0.4); border-top-color:#fff; border-radius:50%; animation:otpSpin 0.6s linear infinite; }
@keyframes otpSpin { to{transform:rotate(360deg)} }
.otp-resend-wrap { display:flex; justify-content:center; }
.otp-link-btn { background:none; border:none; color:var(--otp-muted); font-size:13px; cursor:pointer; padding:0; transition:color 0.2s; }
.otp-link-btn:hover { color:var(--otp-primary); text-decoration:underline; }

/* ---- MESSAGES ---- */
.otp-message { padding:10px 14px; border-radius:8px; font-size:13px; font-weight:500; margin-bottom:16px; }
.otp-message.success { background:#e8f8ef; color:#1a7a45; border-left:3px solid var(--otp-success); }
.otp-message.error { background:#fdf0f0; color:#c0392b; border-left:3px solid var(--otp-error); }

/* ---- SUCCESS ---- */
.otp-success-icon { display:flex; justify-content:center; margin-bottom:20px; animation:otpPop 0.5s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes otpPop { from{transform:scale(0);opacity:0} to{transform:scale(1);opacity:1} }

/* ============================================================
   INVOICE DASHBOARD
   ============================================================ */
.ns-dashboard { max-width:1100px; margin:0 auto; padding:30px 20px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; }

.ns-dashboard-header { display:flex; justify-content:space-between; align-items:flex-start; background:var(--otp-gradient); color:#fff; padding:24px 30px; border-radius:16px; margin-bottom:30px; }
.ns-dashboard-header h2 { margin:0 0 8px !important; font-size:22px !important; color:#fff !important; }
.ns-dashboard-header p { margin:0 0 4px !important; font-size:14px; opacity:0.85; }
.ns-dashboard-header strong { color:#fff; }
.ns-last-synced { font-size:12px !important; opacity:0.65 !important; margin-top:8px !important; }

.ns-btn { padding:10px 20px; border-radius:50px; font-size:14px; font-weight:600; cursor:pointer; border:none; transition:all 0.2s; }
.ns-btn-logout { background:rgba(255,255,255,0.15); color:#fff; border:2px solid rgba(255,255,255,0.4); }
.ns-btn-logout:hover { background:rgba(255,255,255,0.25); }

/* Table */
.ns-table-wrap { overflow-x:auto; border-radius:12px; box-shadow:0 2px 20px rgba(0,0,0,0.08); }
.ns-invoice-table { width:100%; border-collapse:collapse; background:#fff; }
.ns-invoice-table thead { background:var(--otp-gradient); }
.ns-invoice-table thead th { color:#fff; padding:14px 16px; text-align:left; font-size:13px; font-weight:600; letter-spacing:0.3px; white-space:nowrap; }
.ns-invoice-table tbody tr { border-bottom:1px solid #f0f4fb; transition:background 0.15s; }
.ns-invoice-table tbody tr:hover { background:#f8faff; }
.ns-invoice-table tbody tr:last-child { border-bottom:none; }
.ns-invoice-table tbody td { padding:14px 16px; font-size:14px; color:#333; vertical-align:middle; }

/* Status badges */
.ns-status { display:inline-block; padding:4px 10px; border-radius:50px; font-size:12px; font-weight:600; }
.ns-status-fullyBilled { background:#e8f8ef; color:#1a7a45; }
.ns-status-pendingBilling { background:#fff8e1; color:#e67e22; }
.ns-status-closed { background:#f0f0f0; color:#666; }
.ns-status-cancelled { background:#fdf0f0; color:#c0392b; }

/* Tracking links */
.ns-track-link { color:var(--otp-primary); text-decoration:none; font-size:13px; display:inline-block; margin-bottom:2px; }
.ns-track-link:hover { text-decoration:underline; }

.ns-no-data { text-align:center; padding:40px; color:var(--otp-muted); font-size:16px; }
.ns-not-logged-in { text-align:center; padding:60px 20px; }
.ns-not-logged-in a { color:var(--otp-primary); font-weight:600; }

/* Responsive */
@media(max-width:768px) {
    .ns-dashboard-header { flex-direction:column; gap:16px; }
    .otp-modal { padding:30px 20px; border-radius:16px; }
    .otp-box { width:40px !important; height:48px !important; font-size:19px !important; }
    .otp-boxes-wrap { gap:6px; }
    .otp-phone-wrap { flex-direction:column; }
}

/* ============================================================
   SYNC BUTTON & MESSAGE
   ============================================================ */
.ns-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ns-btn-sync {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.4);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ns-btn-sync:hover:not(:disabled) {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.7);
}

.ns-btn-sync:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ns-sync-icon {
    font-size: 16px;
    display: inline-block;
    transition: transform 0.3s ease;
}

@keyframes ns-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.ns-spinning {
    animation: ns-spin 0.8s linear infinite;
    display: inline-block;
}

/* Sync message bar */
.ns-sync-message {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
}

.ns-sync-success {
    background: #e8f8ef;
    color: #1a7a45;
    border-left: 4px solid #2ecc71;
}

.ns-sync-info {
    background: #e8f0fb;
    color: #1a3a6a;
    border-left: 4px solid #2D66B1;
}

/* Pagination */
.ns-pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 13px;
    color: var(--otp-muted);
    flex-wrap: wrap;
    gap: 8px;
}

.ns-items-dropdown {
    background: var(--otp-input-bg);
    border: 1px solid var(--otp-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--otp-text);
    cursor: pointer;
    margin: 0 6px;
}

.ns-pagination-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0 8px;
    flex-wrap: wrap;
}

.ns-page-btn {
    background: var(--otp-input-bg);
    border: 1px solid var(--otp-border);
    color: var(--otp-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 36px;
}

.ns-page-btn:hover:not(:disabled) {
    border-color: var(--otp-primary);
    color: var(--otp-primary);
}

.ns-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ns-page-btn.ns-page-active {
    background: var(--otp-gradient);
    color: #fff !important;
    border-color: transparent;
}

.ns-page-dots {
    font-size: 13px;
    color: var(--otp-muted);
    padding: 0 4px;
}

/* ============================================================
   STATUS FILTER DROPDOWN
   ============================================================ */
.ns-filter-wrap {
    position: relative;
}

.ns-filter-btn {
    background: var(--otp-input-bg);
    border: 1px solid var(--otp-border);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--otp-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ns-filter-btn:hover {
    border-color: var(--otp-primary);
    color: var(--otp-primary);
}

.ns-filter-arrow {
    font-size: 10px;
    opacity: 0.6;
}

.ns-filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid var(--otp-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(17,22,43,0.12);
    min-width: 220px;
    z-index: 999;
    overflow: hidden;
}

.ns-filter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--otp-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--otp-dark);
}

.ns-filter-link {
    background: none;
    border: none;
    color: var(--otp-primary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    font-weight: 500;
}

.ns-filter-link:last-child {
    margin-left: 8px;
    color: var(--otp-muted);
}

.ns-filter-checkboxes {
    padding: 8px 0;
    max-height: 220px;
    overflow-y: auto;
}

.ns-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 13px;
}

.ns-filter-item:hover {
    background: var(--otp-input-bg);
}

.ns-filter-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--otp-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.ns-filter-label {
    flex: 1;
    color: var(--otp-text);
}

.ns-filter-count {
    color: var(--otp-muted);
    font-size: 12px;
}

/* ============================================================
   OTP EXPIRY BAR & RESEND BUTTON
   ============================================================ */
.otp-expiry-wrap {
    margin-bottom: 14px;
}

.otp-expiry-track {
    height: 4px;
    background: var(--otp-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.otp-expiry-fill {
    height: 100%;
    width: 100%;
    background: var(--otp-gradient);
    border-radius: 4px;
    transition: width 1s linear, background 0.5s ease;
}

.otp-expiry-fill.otp-expiry-urgent {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.otp-expiry-label {
    font-size: 11px;
    color: var(--otp-muted);
}

.otp-resend-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.otp-resend-btn {
    background: none;
    border: none;
    color: var(--otp-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s ease;
}

.otp-resend-btn:disabled {
    color: var(--otp-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.otp-resend-btn:not(:disabled):hover {
    text-decoration: underline;
}

.otp-link-btn {
    background: none;
    border: none;
    color: var(--otp-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.otp-link-btn:hover {
    color: var(--otp-primary);
    text-decoration: underline;
}

/* ============================================================
   FLIP CARD LOGIN MODAL
   ============================================================ */
.otp-flip-wrap {
    width: 100%;
    max-width: 420px;
    perspective: 1400px;
}

.otp-flip-card {
    position: relative;
    width: 100%;
    min-height: 480px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.otp-flip-card.is-flipped {
    transform: rotateY(180deg);
}

.otp-flip-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: var(--otp-shadow);
}

.otp-flip-front {
    background: #ffffff;
}

.otp-flip-back {
    background: #11162B;
    transform: rotateY(180deg);
}

.otp-close-dark {
    color: rgba(255, 255, 255, 0.6);
}

.otp-close-dark:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.otp-title-dark {
    color: #fff !important;
}

.otp-subtitle-dark {
    color: rgba(255, 255, 255, 0.55) !important;
}

.otp-subtitle-dark strong {
    color: #7fb0f0 !important;
}

.otp-label-dark {
    color: #7fb0f0 !important;
}

.otp-input-dark {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    width: 100%;
    box-sizing: border-box;
    padding: 13px 16px !important;
}

.otp-input-dark::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.otp-input-dark:focus {
    border-color: #7fb0f0 !important;
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 0 3px rgba(127, 176, 240, 0.2) !important;
}

.otp-primary-btn-light {
    background: linear-gradient(135deg, #2D66B1, #5a8fd9);
}

.otp-flip-switch-wrap {
    text-align: center;
    margin-top: 4px;
}

.otp-flip-switch-btn {
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--otp-primary);
    cursor: pointer;
    padding: 0;
}

.otp-flip-switch-btn:hover {
    text-decoration: underline;
}

.otp-flip-switch-btn-dark {
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: #7fb0f0;
    cursor: pointer;
    padding: 0;
}

.otp-flip-switch-btn-dark:hover {
    text-decoration: underline;
}

.ns-support-text {
    text-align: center;
    font-size: 12px;
    color: var(--otp-muted);
    margin: 16px 0 0;
}

.ns-support-link-phone,.ns-support-link-email {
    color: var(--otp-primary);
    font-weight: 600;
    text-decoration: none;
}

.ns-support-link-phone:hover {
    text-decoration: underline;
    color: var(--otp-primary);
}

.ns-support-link-email:hover {
    text-decoration: underline;
    color: var(--otp-white);
}

@media (max-width: 480px) {
    .otp-flip-face {
        padding: 30px 22px;
    }
    .otp-flip-card {
        min-height: 460px;
    }
}