@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --tsp-red: #d32f2f;
    --tsp-red-hover: #b71c1c;
    --tsp-dark: #1e293b;
    --tsp-light: #f8fafc;
    --tsp-border: #e2e8f0;
    --tsp-text: #334155;
    --tsp-text-muted: #64748b;
    
    --status-pend: #cbd5e1;
    --status-actv: #3b82f6;
    --status-succ: #10b981;
    --status-err: #ef4444;
    
    --role-debtor-bg: #fff7ed;
    --role-debtor-txt: #ea580c;
    --role-creditor-bg: #eff6ff;
    --role-creditor-txt: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: #f1f5f9; color: var(--tsp-text); min-height: 100vh; overflow-x: hidden; padding-bottom: 60px; font-size: 14px;}

/* Navigation */
.tsp_nav { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 15px 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); margin-bottom: 30px; border-bottom: 4px solid var(--tsp-red); }
.nav_brand { font-weight: 700; font-size: 1.15rem; color: var(--tsp-dark); display: flex; align-items: center; gap: 15px; }
.nav_brand img { max-height: 35px; }
.nav_menu { display: flex; gap: 10px; align-items: center;}
.nav_btn { background: none; border: none; font-size: 0.95rem; font-weight: 600; color: var(--tsp-text-muted); cursor: pointer; padding: 10px 16px; border-radius: 6px; transition: 0.2s; }
.nav_btn.active { background: #f1f5f9; color: var(--tsp-dark); }
.nav_btn:hover { background: #e2e8f0; color: var(--tsp-dark); }
.user_badge { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--tsp-red); padding-left: 20px; border-left: 1px solid var(--tsp-border); margin-left: 10px;}

/* Layout */
.dashboard_main { display: flex; flex-direction: column; align-items: center; padding: 0 20px; gap: 30px; animation: slideUp 0.3s ease-out; }
.layout_grid { display: flex; gap: 30px; width: 100%; max-width: 1300px; align-items: flex-start; }
.tsp_panel { background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); padding: 30px; display: flex; flex-direction: column; width: 100%; }
.full_w { max-width: 1300px; }
.staff_area { flex: 1.5; border-top: 5px solid var(--tsp-dark); }
.cust_area { flex: 1; border-top: 5px solid var(--tsp-red); max-width: 450px; background: #fafafa; align-items: center; margin: 0 auto; }

.panel_hdr { font-size: 1.25rem; font-weight: 600; color: var(--tsp-dark); margin-bottom: 25px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--tsp-border); padding-bottom: 15px; width: 100%; }
.hdr_red { color: var(--tsp-red); justify-content: center; border-bottom: none; margin-bottom: 10px;}

/* Forms & Buttons */
.inp_group { margin-bottom: 20px; width: 100%; }
.inp_group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: var(--tsp-text-muted); }
.inp_group input[type="text"], .inp_group input[type="password"] { width: 100%; padding: 12px 15px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1rem; outline: none; transition: all 0.2s; font-family: 'Inter', sans-serif; }
.inp_group input:focus { border-color: var(--tsp-red); box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1); }
.chk_group { font-size: 0.75rem; color: var(--tsp-text-muted); margin-bottom: 20px; display: flex; gap: 8px; align-items: flex-start;}
.chk_group input { margin-top: 3px; }

.btn { width: 100%; padding: 14px; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; justify-content: center; align-items: center; gap: 10px; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn_primary { background: var(--tsp-red); color: #fff; }
.btn_primary:hover { background: var(--tsp-red-hover); }
.btn_dark { background: var(--tsp-dark); color: #fff; }
.btn_dark:hover { background: #0f172a; }
.btn_grey { background: #64748b; color: #fff; }
.btn_grey:hover { background: #475569; }
.btn_outline { background: transparent; border: 1px solid var(--tsp-red); color: var(--tsp-red); }
.btn_outline:hover { background: #fef2f2; }
.btn_ai { background: var(--status-actv); color: #fff;}
.btn_ai:hover { background: #2563eb; }
.btn_link { background: transparent; border: 1px solid #cbd5e1; color: #64748b; padding: 10px; }
.btn_sm { padding: 8px 12px; font-size: 0.85rem; width: auto; }
.w_full { width: 100%; }

/* Simulation Mobile Frame */
.sim_device_frame { border: 12px solid var(--tsp-dark); border-radius: 35px; width: 100%; max-width: 360px; min-height: 600px; padding: 25px 20px; background: #fff; position: relative; box-shadow: inset 0 0 10px rgba(0,0,0,0.05); }
.sim_notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 20px; background: var(--tsp-dark); border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; }
.sim_pad { padding-top: 15px; }
.sim_brand { text-align: center; margin-bottom: 25px; }
.sim_brand img { max-width: 140px; margin-bottom: 15px; }
.sim_brand h3 { font-size: 1.1rem; color: var(--tsp-dark); }
.sim_desc { font-size: 0.85rem; line-height: 1.5; color: var(--tsp-text-muted); margin-bottom: 20px; text-align: center; }
.sms_input { text-align: center; font-size: 1.2rem !important; letter-spacing: 5px; }

/* Intel Tree Pipeline */
.sys_status_box { background: var(--tsp-light); padding: 15px; border-radius: 8px; margin-bottom: 20px; font-size: 0.85rem; color: var(--tsp-text-muted); border: 1px solid var(--tsp-border); }
.intel_pipeline { list-style: none; margin-top: 10px; width: 100%; }
.pipe_node { display: flex; flex-direction: column; padding: 16px 0; border-bottom: 1px dashed var(--tsp-border); }
.pipe_node:last-child { border-bottom: none; }
.node_hdr { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.n_title { font-weight: 500; display: flex; align-items: center; gap: 10px; }
.n_sub { padding-left: 30px; font-size: 0.95rem; color: var(--tsp-text-muted); }
.n_deep { padding-left: 55px; font-size: 0.95rem; color: #475569; position: relative; }
.n_deep::before { content: "↳"; position: absolute; left: 35px; color: #94a3b8; }
.n_data { padding-left: 30px; font-size: 0.8rem; color: #94a3b8; margin-top: 8px; font-style: italic; min-height: 14px; }
.deep_data { padding-left: 55px; }

/* Badges */
.bdg { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; }
.bdg_pend { background: var(--status-pend); color: #fff; }
.bdg_actv { background: #eff6ff; color: var(--status-actv); animation: pulse_b 1.5s infinite; border: 1px solid #bfdbfe; }
.bdg_succ { background: #ecfdf5; color: var(--status-succ); border: 1px solid #a7f3d0; }
.bdg_err { background: #fef2f2; color: var(--status-err); border: 1px solid #fecaca; }

/* Data Tables */
.table_responsive { overflow-x: auto; background: #fff; border: 1px solid var(--tsp-border); border-radius: 8px; margin-bottom: 20px; }
.data_grid { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: left; }
.data_grid th { background: #1e293b; color: #fff; font-weight: 600; padding: 12px 15px; border-bottom: 1px solid var(--tsp-border); white-space: nowrap; border-right: 1px solid #334155; }
.data_grid td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; color: #334155; border-right: 1px solid #f1f5f9; }
.data_grid tr:nth-child(even) td { background: #f8fafc; }
.data_grid tr:hover td { background: #f1f5f9; }
.tbl_empty { padding: 20px; text-align: center; color: var(--tsp-text-muted); font-style: italic; background: #f8fafc; font-size: 0.9rem; }

/* Detailed Report UI */
.rep_meta_bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 15px; background: #f8fafc; padding: 20px; border-radius: 8px; border: 1px solid var(--tsp-border); margin-bottom: 25px; align-items: center; }
.meta_kv { font-size: 0.95rem; }
.meta_kv label { color: var(--tsp-text-muted); font-weight: 600; margin-right: 10px; }
.meta_kv span { color: var(--tsp-dark); font-weight: bold; font-family: monospace; font-size: 1.05rem; }
.txt_red { color: var(--tsp-red) !important;}
.act_bar { display: flex; gap: 10px; margin-top: 25px; border-top: 1px solid var(--tsp-border); padding-top: 20px; flex-wrap: wrap; }

.doc_canvas { background: #fff; padding: 30px 40px; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-top: 20px; color: #1e293b; }
.doc_hdr { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--tsp-dark); padding-bottom: 20px; margin-bottom: 30px; }
.doc_hdr img { max-height: 50px; }
.doc_hdr_txt { text-align: right; }
.doc_hdr_txt h1 { font-size: 1.4rem; font-weight: 700; color: var(--tsp-dark); margin-bottom: 5px; }
.doc_hdr_txt p { font-size: 0.85rem; color: var(--tsp-text-muted); }
.sec_title { font-size: 1.15rem; font-weight: 700; color: var(--tsp-dark); border-bottom: 2px solid var(--tsp-red); padding-bottom: 8px; margin: 35px 0 15px 0; display: flex; justify-content: space-between; align-items: flex-end; }
.sub_title { font-size: 0.95rem; font-weight: 700; color: #475569; margin: 20px 0 10px 0; background: #e2e8f0; padding: 8px 12px; border-left: 4px solid var(--tsp-dark); }
.doc_split { display: flex; gap: 30px; margin-bottom: 20px; align-items: flex-start; }
.doc_col { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 20px; }
.doc_col h4 { font-size: 1rem; color: var(--tsp-red); margin-bottom: 15px; font-weight: 600; }
.info_grid { display: flex; flex-direction: column; }
.info_row { display: flex; border-bottom: 1px solid #e2e8f0; padding: 8px 0; font-size: 0.85rem; }
.info_row:last-child { border-bottom: none; }
.info_lbl { width: 40%; font-weight: 600; color: var(--tsp-text-muted); }
.info_val { width: 60%; font-weight: 700; color: var(--tsp-dark); word-break: break-word; }
.role_chip { padding: 4px 12px; border-radius: 12px; font-size: 0.8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.role_debtor { background-color: var(--role-debtor-bg); color: var(--role-debtor-txt); border: 1px solid #ffedd5; }
.role_creditor { background-color: var(--role-creditor-bg); color: var(--role-creditor-txt); border: 1px solid #dbeafe; }

/* AI Scanner & Results */
.ai_scan_box { background: #0f172a; border-radius: 8px; padding: 25px; margin-top: 40px; border: 1px solid #1e293b; box-shadow: 0 10px 30px rgba(0,0,0,0.15), inset 0 0 40px rgba(15,23,42,0.8); position: relative; overflow: hidden; }
.scan_fx_overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(56,189,248,0.05) 50%, rgba(15,23,42,0) 100%); animation: scanLine 3s infinite linear; pointer-events: none; }
.scan_hdr { display: flex; align-items: center; gap: 15px; border-bottom: 1px solid #334155; padding-bottom: 15px; margin-bottom: 15px; color: #f8fafc; font-size: 1.1rem; font-weight: 600; }
.scan_term { height: 140px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-family: 'Courier New', Courier, monospace; font-size: 0.9rem; color: #38bdf8; text-shadow: 0 0 5px rgba(56,189,248,0.4); }
.term_line { opacity: 0; animation: fadeLine 0.3s forwards; }
.scan_prog_bg { width: 100%; height: 4px; background: #1e293b; border-radius: 2px; margin-top: 20px; overflow: hidden; }
.scan_prog_fill { height: 100%; background: #3b82f6; width: 0%; transition: width 0.4s ease; box-shadow: 0 0 10px #3b82f6; }

.ai_res_box { background: #fff; border: 1px solid var(--tsp-border); border-radius: 8px; padding: 25px; margin-top:40px; display: flex; gap: 30px; box-shadow: 0 4px 10px rgba(0,0,0,0.02); }
.res_score_ring { min-width: 140px; height: 140px; border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; box-shadow: inset 0 0 20px rgba(0,0,0,0.1); }
.ring_val { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.ring_lbl { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; margin-top: 5px; opacity: 0.9; }
.res_details { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.res_lvl { font-size: 1.15rem; font-weight: 700; margin-bottom: 15px; }
.res_notes { list-style: none; margin: 0; padding: 0; }
.res_notes li { font-size: 0.9rem; color: #475569; margin-bottom: 8px; padding-left: 20px; position: relative; }
.res_notes li::before { content: '•'; position: absolute; left: 0; color: var(--tsp-red); font-weight: bold; font-size: 1.2rem; line-height: 0.8; }

/* Utilities & Animations */
.hidden { display: none !important; }
.mt_0 { margin-top: 0;}
.mt_20 { margin-top: 20px;}
.mt_40 { margin-top: 40px;}
.mb_15 { margin-bottom: 15px;}
.flex_center { display: flex; justify-content: center; align-items: center; flex-direction: column; padding: 40px 0; }

.loader_ring { width: 110px; height: 110px; border-radius: 50%; border: 6px solid #f1f5f9; border-top-color: var(--tsp-red); display: flex; justify-content: center; align-items: center; font-size: 2.5rem; font-weight: 700; color: var(--tsp-dark); animation: spin_b 1s linear infinite; position: relative; }
.loader_ring span { position: absolute; animation: spin_f 1s linear infinite; }

.guarantor_block { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 30px; text-align: center; margin-top: 15px; }
.guarantor_block p { color: var(--tsp-text-muted); margin-bottom: 15px; font-size: 0.95rem; }

/* Toast */
#toast_wrapper { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.t_toast { min-width: 300px; padding: 16px 20px; background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 12px; transform: translateX(120%); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); border-left: 4px solid var(--tsp-dark); }
.t_toast.show { transform: translateX(0); opacity: 1; }
.t_toast.err { border-left-color: var(--status-err); }
.t_toast.succ { border-left-color: var(--status-succ); }
.t_toast.warn { border-left-color: #f59e0b; }
.t_ico { width: 24px; height: 24px; display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 1.1rem; }
.t_toast.err .t_ico { color: var(--status-err); }
.t_toast.succ .t_ico { color: var(--status-succ); }
.t_msg { font-size: 0.9rem; font-weight: 500; color: var(--tsp-text); }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin_b { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes spin_f { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } }
@keyframes fadeLine { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scanLine { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
@keyframes pulse_b { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }