/* DESTIN MZ SERVICES — ERP — design system "épuré / SaaS moderne" */

:root {
  --accent: #E8650C;
  --accent-dark: #C7530A;
  --accent-light: #FFF1E7;
  --navbar-bg: #1A1B1E;
  --navbar-bg-2: #232428;
  --navbar-text: #EDEDED;
  --navbar-text-dim: #9B9CA1;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --border: #E7E8EC;
  --text: #1D1E22;
  --text-dim: #6B6D76;
  --text-faint: #9A9CA5;
  --danger: #D64545;
  --danger-bg: #FDEBEB;
  --success: #1E8E5A;
  --success-bg: #E9F7EF;
  --warning: #B7791F;
  --warning-bg: #FCF3DF;
  --info: #2563AE;
  --info-bg: #E9F1FB;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20,21,26,.04), 0 1px 12px rgba(20,21,26,.05);
  --shadow-md: 0 6px 24px rgba(20,21,26,.10);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 4px 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 8px 0; }

/* ---------- layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navbar-bg), var(--navbar-bg-2));
  color: var(--navbar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .name { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.25; }
.sidebar-brand .sub { font-size: 11.5px; color: var(--navbar-text-dim); margin-top: 2px; }
.sidebar-brand .dot { display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--accent); margin-right:6px; }

.nav-group { padding: 10px 10px 4px; }
.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--navbar-text-dim); padding: 10px 10px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--navbar-text-dim); font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--accent); color: #fff; }
.nav-link .ico { width: 16px; text-align: center; opacity: .9; }

.topbar {
  height: 60px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 17px; font-weight: 650; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 22px 24px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- cards / surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15.5px; }
.section-sub { color: var(--text-dim); font-size: 12.5px; margin-top: -2px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.kpi .value.accent { color: var(--accent); }
.kpi .value.danger { color: var(--danger); }
.kpi .value.success { color: var(--success); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .12s; line-height: 1.3;
}
.btn:hover { border-color: #d3d4da; background: #fafafb; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: #f2c7c7; background: var(--danger-bg); }
.btn-danger:hover { background: #fbdcdc; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #f0f0f2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; background: var(--surface); color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
textarea { resize: vertical; min-height: 64px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > .field { flex: 1; min-width: 160px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.help { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #fafafb; }
tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.empty-row td { text-align: center; color: var(--text-faint); padding: 34px 10px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; }
.badge-gray { background: #EEEFF2; color: var(--text-dim); }
.badge-accent { background: var(--accent-light); color: var(--accent-dark); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ---------- toolbar / search ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; justify-content: space-between; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; width: 240px; }
.search-box input { padding-left: 30px; }
.search-box .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 13px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,20,24,.45); display: flex; align-items: flex-start;
  justify-content: center; padding: 5vh 16px; z-index: 100; overflow-y: auto;
}
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; box-shadow: var(--shadow-md); }
.modal.modal-lg { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; max-height: 74vh; overflow-y: auto; }
.modal-close { cursor: pointer; color: var(--text-faint); font-size: 20px; background: none; border: none; line-height: 1; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 25% 20%, #26272c, #17181b 55%);
}
.login-card { background: var(--surface); border-radius: 16px; padding: 38px 34px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.login-card .dot { display:inline-block; width:10px; height:10px; border-radius:50%; background: var(--accent); margin-right:8px; }
.login-card h1 { font-size: 19px; }
.login-card .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.login-error { background: var(--danger-bg); color: var(--danger); padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

.login-wrap { position: relative; }
.powered-by {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 99px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.65); font-size: 12px; font-weight: 600;
  letter-spacing: .01em; transition: all .15s;
}
.powered-by:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.22); }
.powered-by-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }


/* ---------- misc ---------- */
.flash { padding: 10px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 14px; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.tag-line { display: flex; align-items: center; gap: 6px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-dim); border-bottom: 2px solid transparent; cursor: pointer; }
.tab.active { color: var(--accent); border-color: var(--accent); }

.stock-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.stock-pill.production { background: #E9F1FB; color: #2563AE; }
.stock-pill.genie_civil { background: #FCF3DF; color: #B7791F; }

[x-cloak] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7d8dd; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- brand mark (logo) ---------- */
.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-badge { flex-shrink: 0; display: block; }
.brand-mark-sm .brand-badge { width: 30px; height: 30px; }
.brand-mark-lg .brand-badge { width: 56px; height: 56px; }
.brand-name { font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.brand-mark-sm .brand-name { font-size: 14.5px; }
.brand-mark-lg .brand-name { font-size: 21px; }
.brand-name-accent { color: var(--accent); }
.brand-mark-dark .brand-name-main { color: #fff; }
.brand-mark-dark .brand-name-accent { color: #FF9A52; }
.brand-mark-light .brand-name-main { color: var(--text); }
.brand-caption {
  font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-mark-lg .brand-caption { font-size: 11px; letter-spacing: .09em; white-space: normal; }
.brand-mark-sm .brand-caption { font-size: 11.5px; font-weight: 500; letter-spacing: normal; text-transform: none; }
.brand-mark-sm { min-width: 0; }
.brand-mark-sm .brand-text { min-width: 0; }
.brand-mark-dark .brand-caption { color: var(--navbar-text-dim); }
.brand-mark-light .brand-caption { color: var(--text-faint); }
.sidebar-brand { padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }

/* ---------- splash screen ---------- */
.splash {
  position: fixed; inset: 0; z-index: 999; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease, visibility .5s ease;
}
.splash-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.splash-inner .brand-mark { flex-direction: column; text-align: center; gap: 14px; }
.splash-inner .brand-badge { width: 72px; height: 72px; animation: splash-pop .7s cubic-bezier(.34,1.56,.64,1) both; }
.splash-inner .brand-name { font-size: 24px; animation: splash-fade .6s ease .25s both; }
.splash-inner .brand-caption { animation: splash-fade .6s ease .4s both; }
.splash-bar { width: 140px; height: 3px; border-radius: 99px; background: var(--accent-light); overflow: hidden; }
.splash-bar-fill {
  width: 40%; height: 100%; border-radius: 99px; background: var(--accent);
  animation: splash-bar 1.1s ease-in-out infinite;
}
@keyframes splash-pop { 0% { opacity: 0; transform: scale(.55) rotate(-8deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes splash-fade { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes splash-bar { 0% { transform: translateX(-120%); } 100% { transform: translateX(350%); } }

.login-card { text-align: left; }

/* ---------- modern dashboard ---------- */
.welcome-banner {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--navbar-bg) 0%, #2b2c31 60%, var(--accent-dark) 150%);
  border-radius: var(--radius); padding: 26px 28px; color: #fff; margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.welcome-banner h1 { font-size: 23px; color: #fff; margin-bottom: 4px; }
.welcome-banner h1 .accent { color: #FF9A52; }
.welcome-banner p { color: rgba(255,255,255,.72); font-size: 13.5px; margin: 0; }
.welcome-banner .skyline {
  position: absolute; right: 0; bottom: 0; top: 0; width: 46%;
  opacity: .5; pointer-events: none;
}
@media (max-width: 760px) { .welcome-banner .skyline { display: none; } }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1000px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .kpi-row { grid-template-columns: 1fr; } }

.kpi-card { display: flex; align-items: flex-start; gap: 14px; padding: 18px; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--accent-light); color: var(--accent-dark);
}
.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }
.kpi-body { min-width: 0; }
.kpi-body .label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.kpi-body .value { font-size: 23px; font-weight: 750; letter-spacing: -.02em; margin-top: 3px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; margin-top: 5px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.flat { color: var(--text-faint); }
.kpi-trend .ctx { color: var(--text-faint); font-weight: 500; margin-left: 2px; }

.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; flex-wrap: wrap; gap: 10px; }
.chart-legend { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-dim); }
.chart-legend .dot-leg { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.chart-wrap { position: relative; height: 230px; margin-top: 10px; }
.donut-wrap { position: relative; height: 170px; display: flex; align-items: center; justify-content: center; }
.donut-center { position: absolute; text-align: center; pointer-events: none; }
.donut-center .n { font-size: 20px; font-weight: 750; line-height: 1.1; }
.donut-center .u { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.donut-legend { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.donut-legend-item { display: flex; align-items: flex-start; gap: 9px; }
.donut-legend-item .dot-leg { margin-top: 5px; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-item .t { font-size: 13px; font-weight: 650; }
.donut-legend-item .v { font-size: 12.5px; color: var(--text-dim); }
.donut-legend-item .d { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }

.activity-table td.type-cell { white-space: nowrap; }
.type-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; color: var(--text-dim); }
.type-pill .dot-leg { width: 7px; height: 7px; border-radius: 50%; }

.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px;
  border-radius: 9px; border-left: 3px solid var(--border); background: #fafafb;
  transition: background .12s;
}
.alert-item:hover { background: #f3f3f5; }
.alert-item.sev-danger { border-left-color: var(--danger); background: var(--danger-bg); }
.alert-item.sev-warning { border-left-color: var(--warning); background: var(--warning-bg); }
.alert-item.sev-info { border-left-color: var(--info); background: var(--info-bg); }
.alert-item .ico { font-size: 15px; margin-top: 1px; flex-shrink: 0; }
.alert-item .body { min-width: 0; flex: 1; }
.alert-item .t { font-size: 13px; font-weight: 700; }
.alert-item.sev-danger .t { color: var(--danger); }
.alert-item.sev-warning .t { color: var(--warning); }
.alert-item.sev-info .t { color: var(--info); }
.alert-item .d { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.alert-item .meta { font-size: 11px; color: var(--text-faint); margin-top: 4px; white-space: nowrap; }
.alert-item .chev { color: var(--text-faint); font-size: 15px; margin-top: 2px; }

.seg-toggle { display: inline-flex; background: #EEEFF2; border-radius: 9px; padding: 3px; gap: 2px; }
.seg-toggle button {
  border: none; background: transparent; padding: 6px 13px; border-radius: 7px;
  font-size: 12.5px; font-weight: 650; color: var(--text-dim); cursor: pointer;
}
.seg-toggle button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20,20,26,.12); }
