:root {
  --orange: #F57C00;
  --orange-dark: #d86600;
  --orange-soft: #fff3e6;
  --black: #1E1E1E;
  --ink: #2a2a2a;
  --muted: #6f7480;
  --line: #e8e8ec;
  --surface: #ffffff;
  --background: #f5f6fa;
  --success: #118a4f;
  --danger: #d93025;
  --warning: #f4b400;
  --shadow: 0 18px 50px rgba(30, 30, 30, 0.09);
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--black);
  background: var(--background);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }
.muted { color: var(--muted); }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(245, 124, 0, 0.16), transparent 28%),
    linear-gradient(135deg, #1e1e1e 0%, #292929 45%, #f57c00 140%);
}

.login-card {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--surface);
  border-radius: 32px;
  box-shadow: 0 30px 90px rgba(0,0,0,.32);
  overflow: hidden;
}

.brand-panel {
  padding: 56px;
  color: #fff;
  background: linear-gradient(145deg, rgba(30,30,30,.98), rgba(30,30,30,.92)),
              repeating-linear-gradient(45deg, rgba(245,124,0,.14) 0 12px, transparent 12px 24px);
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--orange);
  box-shadow: 0 16px 30px rgba(245,124,0,.35);
  font-size: 30px;
}
.brand-mark.small { width: 44px; height: 44px; border-radius: 14px; font-size: 18px; flex: none; }

.brand-panel h1 { margin: 24px 0 8px; font-size: clamp(2.3rem, 5vw, 4.5rem); letter-spacing: -0.08em; }
.brand-panel p { max-width: 440px; color: rgba(255,255,255,.78); line-height: 1.7; }
.feature-list { margin: 42px 0 0; padding: 0; list-style: none; display: grid; gap: 18px; }
.feature-list li { display: flex; align-items: center; gap: 14px; color: rgba(255,255,255,.9); }
.feature-list i { color: var(--orange); }

.auth-form { padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.auth-form h2 { margin: 0; font-size: 2rem; }
.auth-form label, .form-panel label { color: var(--ink); font-weight: 650; font-size: .9rem; display: grid; gap: 8px; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--black);
  background: #fff;
  outline: none;
  transition: border .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(245,124,0,.12); }
textarea { resize: vertical; }

.primary-button, .secondary-button, .text-button, .icon-button {
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 750;
  transition: transform .2s, background .2s, border .2s;
}
.primary-button { background: var(--orange); color: #fff; box-shadow: 0 12px 24px rgba(245,124,0,.22); }
.primary-button:hover { background: var(--orange-dark); transform: translateY(-1px); }
.secondary-button { background: #fff; color: var(--black); border: 1px solid var(--line); }
.secondary-button:hover { border-color: var(--orange); color: var(--orange); }
.text-button { color: var(--orange); background: transparent; padding-inline: 8px; justify-content: flex-start; }
.icon-button { width: 44px; padding: 0; background: #fff; border: 1px solid var(--line); color: var(--black); }
.compact { min-height: 36px; padding: 0 13px; font-size: .84rem; }
.form-message { min-height: 20px; color: var(--danger); font-weight: 650; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 282px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  color: #fff;
  background: var(--black);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  z-index: 20;
}
.sidebar-header { display: flex; align-items: center; gap: 13px; padding: 8px 6px 24px; }
.sidebar-header strong { display: block; font-size: 1.2rem; letter-spacing: -0.04em; }
.sidebar-header small { color: rgba(255,255,255,.55); }
.main-nav { display: grid; gap: 5px; overflow-y: auto; padding-right: 4px; }
.nav-link {
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,.78);
  background: transparent;
  text-align: left;
  font-weight: 650;
}
.nav-link i { width: 22px; color: rgba(255,255,255,.48); }
.nav-link:hover, .nav-link.active { color: #fff; background: var(--orange); }
.nav-link:hover i, .nav-link.active i { color: #fff; }
.sidebar-footer { margin-top: auto; padding-top: 18px; }
.role-badge, .tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: .78rem;
  font-weight: 800;
  color: var(--orange);
  background: var(--orange-soft);
}

.content-area { min-width: 0; padding: 24px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.topbar h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2.2rem); letter-spacing: -0.05em; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search-field { position: relative; }
.search-field i { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--muted); }
.search-field input { width: 260px; padding-left: 40px; border-radius: 999px; }

.alert-zone { display: grid; gap: 10px; margin-bottom: 18px; }
.alert-item {
  border: 1px solid rgba(217,48,37,.18);
  background: #fff6f4;
  color: #9f241c;
  padding: 13px 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.view { display: none; animation: fadeUp .25s ease; }
.active-view { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.kpi-card, .panel {
  background: var(--surface);
  border: 1px solid rgba(232,232,236,.88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi-card { padding: 22px; position: relative; overflow: hidden; }
.kpi-card::after { content: ''; position: absolute; inset: auto -30px -40px auto; width: 100px; height: 100px; border-radius: 50%; background: rgba(245,124,0,.09); }
.kpi-icon { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: var(--black); margin-bottom: 14px; }
.kpi-card p { margin: 0; color: var(--muted); font-weight: 650; }
.kpi-card strong { display: block; margin: 6px 0; font-size: 1.75rem; letter-spacing: -0.05em; }
.kpi-card small { color: var(--muted); }
.warning-card .kpi-icon { background: var(--orange); }

.dashboard-grid, .module-layout, .report-grid { display: grid; gap: 18px; }
.dashboard-grid { grid-template-columns: 1.3fr .9fr; margin-bottom: 18px; }
.module-layout { grid-template-columns: minmax(320px, 430px) 1fr; align-items: start; }
.module-layout.two-columns { grid-template-columns: repeat(2, minmax(0,1fr)); }
.report-grid { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 18px; }

.panel { padding: 20px; min-width: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-header h3, .form-panel h3, .report-card h3 { margin: 0; letter-spacing: -0.035em; }
.form-panel { position: sticky; top: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin: 16px 0; }
.form-grid.single { grid-template-columns: 1fr; }
.wide { grid-column: 1 / -1; }

.chart-box { position: relative; height: 330px; }
.chart-box.tall { height: 430px; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .9rem; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; background: #fafafa; }
td strong { color: var(--black); }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; }
.delete-button, .toggle-button {
  border: none;
  border-radius: 10px;
  min-width: 34px;
  height: 34px;
  color: #fff;
  background: var(--danger);
}
.toggle-button { background: var(--success); }
.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .75rem;
  font-weight: 800;
  background: #f1f2f5;
  color: var(--muted);
}
.status-pill.good { color: var(--success); background: #e9f8f0; }
.status-pill.warn { color: #9b6900; background: #fff6dc; }
.status-pill.bad { color: var(--danger); background: #ffe9e6; }

.tank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tank-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: #fff; }
.tank-card h4 { margin: 0 0 6px; }
.progress-bar { height: 12px; border-radius: 999px; background: #eceef3; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--orange); }
.report-card p { font-size: 1.8rem; font-weight: 850; margin: 10px 0 0; letter-spacing: -0.05em; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 18px;
  color: #fff;
  background: var(--black);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translateY(90px);
  opacity: 0;
  transition: .25s;
  z-index: 50;
  font-weight: 700;
}
.toast.show { transform: none; opacity: 1; }

@media (max-width: 1180px) {
  .kpi-grid, .report-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid, .module-layout, .module-layout.two-columns { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}

@media (max-width: 880px) {
  .login-card { grid-template-columns: 1fr; }
  .brand-panel, .auth-form { padding: 34px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 282px; transform: translateX(-105%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .content-area { padding: 16px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .search-field, .search-field input { width: 100%; }
}

@media (max-width: 620px) {
  .login-screen { padding: 10px; }
  .brand-panel, .auth-form { padding: 24px; }
  .kpi-grid, .report-grid, .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .panel { padding: 15px; border-radius: 16px; }
  .kpi-card { padding: 18px; }
  .topbar-actions .secondary-button { width: 100%; }
}

@media print {
  .sidebar, .topbar, .alert-zone, form, .secondary-button, .primary-button { display: none !important; }
  .app-shell { display: block; }
  .content-area { padding: 0; }
  .view { display: block; }
  body { background: #fff; }
  .panel, .kpi-card { box-shadow: none; break-inside: avoid; }
}
