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

:root {
  /* Variocube Brand Colors */
  --navy:    #1a2d6e;
  --navy-dk: #111e4a;
  --navy-lt: #e8edf8;
  --orange:  #f47920;
  --orange-dk: #d4641a;
  --orange-lt: #fef0e6;

  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --green:    #15803d;
  --green-lt: #f0fdf4;
  --red-lt:   #fee2e2;
  --yellow-lt:#fef9c3;
  --blue-lt:  var(--navy-lt);
  --text:     #1a1a2e;
  --radius:   6px;
  --shadow:   0 1px 3px rgba(0,0,0,.1);
}

body { font-family: -apple-system, 'Segoe UI', Arial, sans-serif; font-size: 13px; background: var(--gray-100); color: var(--text); display: flex; flex-direction: column; height: 100vh; }

/* HEADER */
.app-header { background: var(--navy); color: white; padding: 0 16px; height: 56px; display: flex; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.25); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; }
.header-title { display: flex; align-items: center; gap: 14px; }
.header-logo-wrap { background: white; border-radius: 6px; padding: 5px 10px; display: flex; align-items: center; height: 42px; }
.header-logo { height: 30px; display: block; }
.header-logo-text { font-size: 15px; font-weight: 800; letter-spacing: 1px; color: white; }
.product { font-size: 15px; font-weight: 600; color: rgba(255,255,255,.90); border-left: 2px solid var(--orange); padding-left: 12px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.version-badge { font-size: 11px; opacity: .65; margin-right: 4px; white-space: nowrap; }

/* BUTTONS */
.btn { padding: 6px 14px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 12px; font-weight: 600; transition: background .15s; }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dk); }
.btn-outline { background: rgba(255,255,255,.12); color: white; border: 1px solid rgba(255,255,255,.35); }
.btn-outline:hover { background: rgba(255,255,255,.22); }
.btn-lang { background: rgba(255,255,255,.15); color: white; border: 1px solid rgba(255,255,255,.5); min-width: 38px; font-weight: 700; letter-spacing: .5px; }
.btn-lang:hover { background: var(--orange); border-color: var(--orange-dk); }
.btn-logout { background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.25); padding: 4px 10px; font-size: 11px; }
.btn-logout:hover { background: rgba(220,50,50,.5); color: white; border-color: transparent; }

/* USER BADGE */
.user-badge { display: flex; align-items: center; gap: 7px; margin-left: 8px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.2); }
.user-icon { font-size: 14px; opacity: .7; }
.user-name { font-size: 12px; color: rgba(255,255,255,.85); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* LAYOUT */
#app { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.main-layout { display: grid; grid-template-columns: 460px 1fr; flex: 1; overflow: hidden; }

/* FOOTER */
.app-footer { background: var(--navy-dk); color: rgba(255,255,255,.6); font-size: 11px; padding: 0 16px; height: 32px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-footer a { color: rgba(255,255,255,.8); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.3); }
.app-footer a:hover { color: var(--orange); border-color: var(--orange); }
.footer-sep { opacity: .4; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal-box { background: white; border-radius: 8px; max-width: 680px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.modal-header { background: var(--navy); color: white; padding: 16px 20px; border-radius: 8px 8px 0 0; flex-shrink: 0; }
.modal-header h2 { font-size: 15px; font-weight: 700; margin: 0; }
.modal-body { overflow-y: auto; padding: 20px; font-size: 13px; line-height: 1.6; color: var(--text); flex: 1; }
.modal-body h3 { font-size: 13px; font-weight: 700; color: var(--navy); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .5px; }
.modal-body h4 { font-size: 12px; font-weight: 700; color: var(--gray-800); margin: 12px 0 4px; }
.modal-body p { margin: 0 0 8px; color: var(--gray-600); }
.modal-body hr { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; background: var(--gray-50); border-radius: 0 0 8px 8px; }
.modal-dismiss-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--gray-600); cursor: pointer; }
.input-panel { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--gray-100); }
.results-panel { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* CARDS */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.card-title { font-size: 11px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--orange); }

/* FORM ROWS */
.form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.form-row label { flex: 0 0 130px; font-size: 12px; color: var(--gray-600); }
.form-row input[type="text"], .form-row input[type="date"] { flex: 1; border: 1px solid var(--gray-200); border-radius: 4px; padding: 5px 8px; font-size: 12px; color: var(--text); background: white; }
.form-row textarea { flex: 1; border: 1px solid var(--gray-200); border-radius: 4px; padding: 5px 8px; font-size: 12px; color: var(--text); background: white; resize: vertical; }
.form-row--tall { align-items: flex-start; }

/* SPIN ROWS with +/- buttons */
.spin-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--gray-100); }
.spin-row:last-child { border-bottom: none; }
.spin-row label { font-size: 12px; color: var(--gray-800); flex: 1; padding-right: 8px; cursor: default; }

.num-ctrl { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.num-btn { width: 30px; height: 30px; border: 1px solid var(--gray-200); background: var(--gray-100); color: var(--navy); font-size: 18px; font-weight: 700; cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s; user-select: none; line-height: 1; flex-shrink: 0; }
.num-btn:hover { background: var(--orange); color: white; border-color: var(--orange-dk); }
.num-btn:active { transform: scale(0.93); }

.spin-row input[type="number"] { width: 60px; text-align: center; border: 1px solid var(--gray-200); border-radius: 4px; padding: 5px 4px; font-size: 13px; color: var(--text); background: white; transition: background .15s, border-color .15s; }
.spin-row input[type="number"]:focus { outline: none; border-color: var(--navy); }
.spin-row input[type="number"].has-value { background: #dcfce7; border-color: #16a34a; color: #14532d; font-weight: 700; }

/* Hide browser spinner arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check-row label { font-size: 12px; color: var(--gray-800); cursor: pointer; }

.depth-label { font-size: 11px; font-style: italic; padding: 5px 0; margin: 4px 0 2px; }
.depth-650 { color: var(--gray-600); }
.depth-950 { color: #92400e; background: #fef3c7; padding: 5px 8px; border-radius: 4px; }

.radio-group { padding: 6px 0; }
.radio-label { font-size: 12px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; }
.radio-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; color: var(--gray-800); cursor: pointer; }
.radio-row input { cursor: pointer; accent-color: var(--orange); }

/* VALIDATION */
.validation-box { border-radius: var(--radius); overflow: hidden; }
.validation-box:empty { display: none; }
.v-msg { padding: 7px 12px; font-size: 12px; border-left: 4px solid; }
.v-error   { background: var(--red-lt);    border-color: #dc2626; color: #7f1d1d; }
.v-warning { background: var(--yellow-lt); border-color: #b45309; color: #78350f; }
.v-info    { background: var(--navy-lt);   border-color: var(--navy); color: var(--navy-dk); }
.v-auto_fix{ background: var(--green-lt);  border-color: var(--green); color: #14532d; }

/* METRICS BAR */
.metrics-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.metric { background: var(--navy-lt); border-radius: var(--radius); padding: 8px 16px; display: flex; flex-direction: column; align-items: center; min-width: 100px; border-top: 3px solid var(--orange); }
.metric-label { font-size: 10px; color: var(--navy); text-transform: uppercase; font-weight: 600; }
.metric-value { font-size: 20px; font-weight: 800; color: var(--navy); }

/* TABS */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); }
.tab-btn { padding: 7px 18px; border: none; background: none; cursor: pointer; font-size: 13px; color: var(--gray-600); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s; }
.tab-btn.active { color: var(--orange); border-bottom-color: var(--orange); }
.tab-btn:hover { color: var(--navy); }
.tab-content { flex: 1; }
.hidden { display: none; }

/* RESULT TABLE */
.result-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-table thead tr { background: var(--navy); color: white; }
.result-table th { padding: 8px 10px; text-align: left; font-weight: 600; white-space: nowrap; }
.result-table th.col-num, .result-table td.col-num { text-align: right; }
.result-table td { padding: 6px 10px; border-bottom: 1px solid var(--gray-200); color: var(--text); }
.result-table tbody tr:nth-child(even) { background: var(--gray-50); }
.result-table tbody tr:hover { background: var(--navy-lt); }
.result-table tfoot tr { font-weight: 700; font-size: 13px; }
.row-user   { background: var(--orange-lt) !important; }
.row-auto   { background: var(--green-lt) !important; }
.row-total  { background: var(--navy-lt) !important; }
.row-dealer { background: var(--gray-100) !important; }
.row-group  { background: var(--gray-100) !important; font-weight: 700; color: var(--navy); }
.surcharge-pos { color: var(--green); font-weight: 600; }
.surcharge-neg { color: #64748b; }

/* TAB NAV BUTTONS */
.tab-nav { display: flex; justify-content: flex-end; padding: 12px 0 4px; }
.tab-nav-left { justify-content: flex-start; }
.btn-nav { padding: 8px 22px; border-radius: var(--radius); border: 2px solid var(--orange); background: white; color: var(--orange); cursor: pointer; font-size: 13px; font-weight: 700; transition: background .15s, color .15s; }
.btn-nav:hover { background: var(--orange); color: white; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 3px; opacity: .5; }
