/* ── GEOMARINE – SAP Fiori-inspired theme ── */
:root {
  --sap-shell:    #354a5e;
  --sap-primary:  #0a6ed1;
  --sap-accent:   #0854a0;
  --sap-bg:       #f5f6f7;
  --sap-content:  #ffffff;
  --sap-border:   #d9d9d9;
  --sap-text:     #32363a;
  --sap-muted:    #6a6d70;
  --sap-success:  #107e3e;
  --sap-warning:  #e9730c;
  --sap-danger:   #bb0000;
  --sap-info:     #0a6ed1;
  --sap-sidebar-w: 220px;
  --sap-header-h:  48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "72", "72full", Arial, Helvetica, sans-serif;
       font-size: 14px; color: var(--sap-text);
       background: var(--sap-bg); overflow-x: hidden; }

/* ── Shell Bar ── */
.shell-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--sap-header-h);
  background: var(--sap-shell);
  display: flex; align-items: center; padding: 0 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.shell-logo { color: #fff; font-size: 18px; font-weight: 700;
              letter-spacing: .5px; display: flex; align-items: center; gap: 10px; }
.shell-logo span { color: #89b8f3; }
.shell-logo .divider { width: 1px; height: 24px; background: rgba(255,255,255,.3); }
.shell-app-name { color: rgba(255,255,255,.85); font-size: 14px; font-weight: 400; }
.shell-spacer { flex: 1; }
.shell-user { color: rgba(255,255,255,.9); font-size: 13px;
              display: flex; align-items: center; gap: 8px; }
.shell-avatar { width: 32px; height: 32px; border-radius: 50%;
                background: var(--sap-primary); color: #fff;
                display: flex; align-items: center; justify-content: center;
                font-size: 13px; font-weight: 700; }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: var(--sap-header-h); left: 0; bottom: 0;
  width: var(--sap-sidebar-w); background: #fff;
  border-right: 1px solid var(--sap-border);
  overflow-y: auto; z-index: 900;
  display: flex; flex-direction: column;
}
.sidebar-section { padding: 8px 0; }
.sidebar-label { padding: 10px 16px 4px; font-size: 11px; font-weight: 700;
                 color: var(--sap-muted); text-transform: uppercase;
                 letter-spacing: .8px; }
.nav-item { display: flex; align-items: center; gap: 10px;
            padding: 9px 16px; color: var(--sap-text);
            text-decoration: none; font-size: 14px;
            border-left: 3px solid transparent;
            transition: background .15s, border-color .15s; }
.nav-item:hover { background: #f0f5fc; color: var(--sap-primary); }
.nav-item.active { background: #e8f1fb; color: var(--sap-primary);
                   border-left-color: var(--sap-primary); font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-divider { border: none; border-top: 1px solid var(--sap-border);
                   margin: 4px 0; }

/* ── Main content ── */
.main-wrap {
  margin-left: var(--sap-sidebar-w);
  margin-top: var(--sap-header-h);
  min-height: calc(100vh - var(--sap-header-h));
  padding: 24px;
}

/* ── Page header ── */
.page-actions { display:flex; gap:8px; align-items:center; flex-shrink:0; }
.btn-export { white-space:nowrap; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--sap-border);
}
.page-title { font-size: 20px; font-weight: 600; color: var(--sap-text); }
.page-subtitle { font-size: 13px; color: var(--sap-muted); margin-top: 2px; }
.breadcrumb-bar { font-size: 12px; color: var(--sap-muted); margin-bottom: 6px; }
.breadcrumb-bar a { color: var(--sap-primary); text-decoration: none; }

/* ── KPI Tiles ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 16px; margin-bottom: 24px; }
.kpi-tile { background: var(--sap-content); border: 1px solid var(--sap-border);
            border-radius: 6px; padding: 16px 20px;
            border-top: 3px solid var(--sap-primary);
            box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.kpi-tile.green  { border-top-color: var(--sap-success); }
.kpi-tile.orange { border-top-color: var(--sap-warning); }
.kpi-tile.red    { border-top-color: var(--sap-danger); }
.kpi-tile.gray   { border-top-color: var(--sap-muted); }
.kpi-label { font-size: 12px; color: var(--sap-muted); font-weight: 500;
             text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--sap-text); line-height: 1.1; }
.kpi-sub   { font-size: 12px; color: var(--sap-muted); margin-top: 4px; }

/* ── Cards ── */
.card { background: var(--sap-content); border: 1px solid var(--sap-border);
        border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; }
.card-header { padding: 12px 16px; border-bottom: 1px solid var(--sap-border);
               display: flex; align-items: center; justify-content: space-between; }
.card-title  { font-size: 15px; font-weight: 600; color: var(--sap-text); }
.card-body   { padding: 16px; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
           margin-bottom: 14px; }
.search-box { display: flex; border: 1px solid var(--sap-border); border-radius: 4px;
              overflow: hidden; background: #fff; }
.search-box input { border: none; outline: none; padding: 7px 10px;
                    font-size: 14px; color: var(--sap-text); width: 220px; }
.search-box button { background: var(--sap-primary); color: #fff; border: none;
                     padding: 7px 12px; cursor: pointer; font-size: 13px; }
.search-box button:hover { background: var(--sap-accent); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px;
       padding: 7px 14px; border-radius: 4px; font-size: 13px;
       font-weight: 500; cursor: pointer; border: 1px solid transparent;
       text-decoration: none; transition: background .15s, border-color .15s; }
.btn-primary   { background: var(--sap-primary); color: #fff; border-color: var(--sap-primary); }
.btn-primary:hover { background: var(--sap-accent); border-color: var(--sap-accent); }
.btn-success   { background: var(--sap-success); color: #fff; border-color: var(--sap-success); }
.btn-success:hover { background: #0d6b33; }
.btn-outline   { background: #fff; color: var(--sap-primary); border-color: var(--sap-primary); }
.btn-outline:hover { background: #e8f1fb; }
.btn-danger    { background: var(--sap-danger); color: #fff; border-color: var(--sap-danger); }
.btn-danger:hover { background: #990000; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px 8px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table.sap-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sap-table thead th {
  background: #f0f0f0; color: var(--sap-text);
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; padding: 10px 12px; text-align: left;
  border-bottom: 2px solid var(--sap-border); white-space: nowrap;
}
.sap-table tbody tr { border-bottom: 1px solid #eeeeee; }
.sap-table tbody tr:hover { background: #f7f9fd; }
.sap-table td { padding: 10px 12px; vertical-align: middle; color: var(--sap-text); }
.sap-table tfoot td { background: #f0f0f0; font-weight: 700; padding: 10px 12px;
                      border-top: 2px solid var(--sap-border); }
.col-actions { width: 100px; text-align: center; }

/* ── Status badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px;
         font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success  { background: #dcf3e8; color: #0d6b33; }
.badge-warning  { background: #fde8d0; color: #b75800; }
.badge-danger   { background: #fde8e8; color: #a00000; }
.badge-info     { background: #e0ecfb; color: #054a91; }
.badge-neutral  { background: #f0f0f0; color: #555; }
.badge-purple   { background: #ede0f8; color: #5c26a3; }

/* ── Modals ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 2000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff; border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  width: 560px; max-width: 95vw; max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .18s ease;
}
.modal-box.modal-lg { width: 720px; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; }
                     to   { transform: scale(1);   opacity: 1; } }
.modal-header { background: var(--sap-shell); color: #fff;
                padding: 14px 20px; border-radius: 8px 8px 0 0;
                display: flex; align-items: center; justify-content: space-between; }
.modal-header h5 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: #fff; font-size: 20px;
               cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: #ffd; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--sap-border);
                display: flex; justify-content: flex-end; gap: 8px; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--sap-muted);
              text-transform: uppercase; letter-spacing: .4px; }
.form-control { border: 1px solid var(--sap-border); border-radius: 4px;
                padding: 8px 10px; font-size: 14px; color: var(--sap-text);
                background: #fff; outline: none; width: 100%;
                transition: border-color .15s; }
.form-control:focus { border-color: var(--sap-primary);
                      box-shadow: 0 0 0 2px rgba(10,110,209,.15); }
.form-control[readonly] { background: #f7f7f7; color: var(--sap-muted); }
select.form-control { cursor: pointer; }

/* ── Alerts / Flashes ── */
.flash-container { margin-bottom: 16px; }
.flash { padding: 10px 16px; border-radius: 4px; font-size: 13px;
         display: flex; align-items: center; gap: 8px;
         border-left: 4px solid; }
.flash-success { background: #e8f5ee; border-color: var(--sap-success); color: #0d6b33; }
.flash-info    { background: #e4eff9; border-color: var(--sap-info);    color: #054a91; }
.flash-danger  { background: #fde8e8; border-color: var(--sap-danger);  color: #a00000; }

/* ── Charts (simple bar) ── */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row   { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { width: 160px; text-align: right; color: var(--sap-text);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: #eee; border-radius: 4px; height: 18px;
             overflow: hidden; }
.bar-fill  { height: 100%; background: var(--sap-primary); border-radius: 4px;
             transition: width .5s ease; }
.bar-fill.green  { background: var(--sap-success); }
.bar-fill.orange { background: var(--sap-warning); }
.bar-val   { width: 100px; color: var(--sap-muted); font-size: 12px; }

/* ── Misc ── */
.text-right  { text-align: right !important; }
.text-center { text-align: center !important; }
.text-muted  { color: var(--sap-muted); }
.text-success{ color: var(--sap-success); }
.text-danger { color: var(--sap-danger); }
.text-primary{ color: var(--sap-primary); }
.fw-bold     { font-weight: 700; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mb-2  { margin-bottom: 8px; }
.d-flex { display: flex; }
.gap-2  { gap: 8px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--sap-muted); }
.empty-state i { font-size: 36px; display: block; margin-bottom: 10px; }

/* ── Rentabilidad gauge ring (CSS only) ── */
.gauge-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.gauge-box { text-align: center; }
.gauge-ring { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 8px;
              display: flex; align-items: center; justify-content: center;
              font-size: 16px; font-weight: 700; color: #fff; }
.ring-green  { background: conic-gradient(var(--sap-success) var(--pct), #ddd var(--pct)); }
.ring-warn   { background: conic-gradient(var(--sap-warning) var(--pct), #ddd var(--pct)); }
.ring-danger { background: conic-gradient(var(--sap-danger)  var(--pct), #ddd var(--pct)); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; padding: 16px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }
