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

:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #475569;
    --secondary-light: #64748b;
    --accent-gold: #d4af37;
    --accent-emerald: #059669;
    --accent-rose: #e11d48;
    --success: #059669;
    --success-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --black: #000000;
    --gold: #d4af37;
    --silver: #c0c0c0;
    --platinum: #e5e4e2;
    --palladium: #cba135;
    --brand-navy: #1a1d4c;
    --brand-blue: #004bbc;
    --brand-gray: #333333;
    --brand-gold: #b38f40;
    --brand-gold-2: #c8a94e;
    --brand-cream: #f1dd80;
    --surface: #f9fafb;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Roboto, sans-serif;
    font-weight: 300;
    background-color: var(--surface);
    color: var(--gray-900); 
    line-height: 1.7; 
    min-height: 100vh; 
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em; 
}

h1, h2, h3, h4, h5, h6 {
    font-family: Roboto, sans-serif;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--gray-900);
    letter-spacing: -0.03em; 
}

h1 { 
    font-size: 1.875rem; 
    font-weight: 700;
}

h1#headerTitle { 
    font-size: 1.5rem; 
    font-weight: 700;
    color: var(--brand-cream);
}

h2 { 
    font-size: 1.5rem;
    font-weight: 700;
}

h3 { 
    font-size: 1rem; 
    font-weight: 700;
    color: var(--brand-blue) !important;
}

h4 { 
    font-size: 1.125rem; 
    font-weight: 500;
}

p {
    font-weight: 300;
    line-height: 1.7;
}
a{
    color: var(--gray-800)
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); }
.span-2 { grid-column: span 2; }

.header {
    background: var(--brand-navy);
    border-bottom: 1px solid #e5e4e2;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px 25px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -2px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary);
}

input, select, textarea {
    padding: 8px 16px;
    border: 1px solid #e5e4e2;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
    background: var(--white);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

input[readonly] {
    background: #f8fafc;
    cursor: not-allowed;
    opacity: 0.7;
}

.select-field { min-width: 200px; }

.btn {
    padding: 8px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -2px rgba(0,0,0,0.1);
}

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

.btn-primary { background: var(--primary); color: var(--white);}
.btn-secondary { background: var(--secondary); color: var(--white);}
.btn-success { background: var(--success); color: var(--white);}
.btn-danger { background: var(--danger); color: var(--white);}
.btn-small { padding: 4px 8px; font-size: 0.75rem; }

.btn-group { display: flex; gap: 8px;}
.btn-group .btn { flex:1;}

table { width: 100%; border-collapse: collapse;}

.data-table { font-variant-numeric: tabular-nums; }
.info-table td:first-child { color: var(--secondary); font-weight: 500; }

.balance-table th { text-align: right;}
.balance-table th:first-child { text-align: left;}
.balance-table td { text-align: right;}
.balance-table td:first-child { text-align: left;}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin { background: var(--success); color: var(--white);}
.badge-user { background: var(--primary); color: var(--white);}

.login-container { max-width: 400px; margin: 0 auto;}
.login-container h2 { text-align: center; margin-bottom: 16px;}

label {
    font-size: 0.875rem;
    font-weight: 600; 
    color: var(--gray-700);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-family: Roboto, sans-serif;
}

input, select, textarea {
    padding: 12px 25px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 300; 
    transition: all 200ms cubic-bezier(0.4,0,0.2,1);
    background: var(--white);
    font-family: Roboto, sans-serif;
    color: var(--gray-900);
}

th {
    text-align: left;
    padding: 10px 10px;
    font-weight: 600; 
    color: var(--brand-gold);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--brand-gold-2);
    font-family: Roboto, sans-serif;
}

td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    font-weight: 300; 
    color: var(--gray-800);
    font-family: Roboto, sans-serif;
}
td.td_title {
    font-weight: 600 !important; 
    color: var(--gray-900);
}
th.align_left,
td.align_left {
    text-align: left;
}
th.align_right,
td.align_right {
    text-align: right;
}

.data-table td {
    font-family: Roboto, sans-serif;
    font-size: 0.875rem;
    font-weight: 400; 
}

.balance-table td {
    font-family: Roboto, sans-serif;
    font-weight: 500;
}

.info-table td:first-child { color: var(--gray-900); font-weight: 600; }
.info-table td:last-child { color: var(--gray-900); font-weight: 400;}

.admin-header {
    background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    color: var(--white);
}
.admin-controls { display: flex; gap: 16px; margin-top: 16px;}

.user-header {
    background: linear-gradient(135deg,#3b82f6 0%,#8b5cf6 100%);
    color: var(--white);
}
.span_header_name{
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 500;
}
.span_header_dot{
    color: var(--white);
    font-size: 1rem;
    font-weight: 700;
    padding: 1px 5px;
}
.bt_header_logout{
    background-color: transparent;
    border: none;
    border-bottom: 1px solid white;
    color: var(--white);
    cursor: pointer;
    font-size: 0.92rem;
}
.bt_header_logout:hover{
    color: var(--gray-100);
    font-size: 0.95rem;
}
.new_client{
    height: 40px;
    font-weight: 600;
}
.select_client{
    height: 40px;
    padding: 0 20px;
    border-radius: 8px;
    background-color: transparent;
    color: var(--white);
    font-weight: 500;
}

.metal-label, 
.user-label, 
.price-label { font-weight: 600;}

.price-group {
    padding: 8px;
    border: 1px solid #e5e4e2;
    border-radius: 8px;
}
.price-group label { display: block; margin-bottom: 4px; font-weight: 600;}

.live-indicator { color: var(--success); animation: pulse 2s infinite;}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
.user-status { display: flex; align-items: center; gap: 8px; }

.text-small { font-size: 0.75rem;}
.text-muted { color: var(--secondary); }
.text-success { color: var(--success); font-weight: 500;}
.text-danger { color: var(--danger); font-weight: 500;}
.text-center { text-align: center; }

.negative-value { color: var(--danger); font-weight: 500; }

.balance-table td:contains("("), .data-table td:contains("(") { color: var(--danger); }

.hidden { display: none !important;}
.flex-between { display: flex; justify-content: space-between; align-items: center;}
.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 8px;
    text-align: center;
}
.timestamp-note {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 8px;
    text-align: center;
}

.prices_inputs {
    border: none;
    background: transparent;
    color: var(--gray-600); 
    padding: 4px 8px;
    font-size: 1em;
    outline: none;
}
.prices_inputs:disabled {
    border: none;
    background: transparent;
    cursor: not-allowed;
}
.prices_inputs.prices_dates {
    font-size: 0.8em;
}

.footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--secondary);
    font-size: 0.875rem;
}
@media (max-width: 768px) {
    .main-container { padding: 16px;}
    .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr;}
    .span-2 { grid-column: span 1;}
    .header .container { flex-direction: column; gap: 8px;}
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
}
@media print {
    .header,.footer,.btn,button,select {display:none;}
    .card { box-shadow: none; border:1px solid #e5e4e2;}
}
.chart-container { position: relative; height: 350px; width: 100%;}
.chart-subtitle {
    font-size: 0.8rem;
    color: var(--gray-700);
    font-weight: 400;
    text-align: right;
    margin-bottom: 8px;
}

canvas { max-width: 100%; max-height: 100%; }
.loading { opacity: 0.6; pointer-events: none;}
.spinner {
    border: 3px solid #f8fafc;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px; height: 40px;
    animation: spin 1s linear infinite;
    margin: 32px auto;
}
@keyframes spin {0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}
