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

:root {
  --yellow: #FFCC00;
  --yellow-light: #FFF3B0;
  --yellow-dark: #E6B800;
  --dark: #1a1a1a;
  --dark-2: #2c2c2c;
  --dark-3: #3d3d3d;
  --gray-1: #6b7280;
  --gray-2: #9ca3af;
  --gray-3: #d1d5db;
  --gray-4: #e5e7eb;
  --gray-5: #f3f4f6;
  --gray-6: #f9fafb;
  --white: #ffffff;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dark);
  background-color: var(--gray-5);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--dark);
  border-bottom: 3px solid var(--yellow);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-corp {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
}

.header-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-2);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

main {
  flex: 1;
  padding: 28px 24px;
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  align-items: start;
}

.col-left,
.col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-4);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card--sticky {
  position: sticky;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header--accent {
  background: var(--dark);
  border-bottom: none;
}

.card-header--accent .card-header-title h2 {
  color: var(--white);
}

.card-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header-title h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -0.01em;
}

.card-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon--blue {
  background: var(--blue-light);
  color: var(--blue);
}

.card-icon--yellow {
  background: var(--yellow-light);
  color: #92700a;
}

.card-icon--gray {
  background: var(--gray-5);
  color: var(--gray-1);
}

.card-icon--dark {
  background: rgba(255,204,0,0.15);
  color: var(--yellow);
}

.card-body {
  padding: 20px;
}

.card-body--no-pad {
  padding: 0;
}

.live-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--yellow);
  border: 1.5px solid rgba(255,204,0,0.4);
  padding: 2px 7px;
  border-radius: 100px;
  animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-1);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--dark);
  background: var(--gray-6);
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--yellow-dark);
  box-shadow: 0 0 0 3px rgba(255,204,0,0.15);
  background: var(--white);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--yellow);
  color: var(--dark);
  width: 100%;
}

.btn-primary:hover {
  background: var(--yellow-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,204,0,0.35);
}

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

.btn-ghost {
  background: transparent;
  color: var(--gray-1);
  border: 1.5px solid var(--gray-3);
}

.btn-ghost:hover {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.operations-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.operation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--gray-6);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-4);
  gap: 12px;
}

.operation-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.operation-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
}

.operation-price {
  font-size: 11px;
  color: var(--gray-1);
  font-weight: 500;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  transition: background 0.15s;
  padding: 0;
  border-radius: 0;
  line-height: 1;
}

.qty-btn:hover {
  background: var(--yellow);
}

.qty-input {
  width: 52px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--gray-3);
  border-right: 1.5px solid var(--gray-3);
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  background: var(--white);
  padding: 0 4px;
}

.qty-input:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--gray-3);
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-4);
}

.section-divider span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-2);
  white-space: nowrap;
}

.services-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--gray-6);
  border-radius: var(--radius-xs);
  border: 1px solid var(--gray-4);
  gap: 12px;
}

.service-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.service-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--dark-2);
}

.service-price {
  font-size: 11px;
  color: var(--gray-2);
}

.svc-input {
  width: 80px;
  padding: 6px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-xs);
  background: var(--white);
  flex-shrink: 0;
}

.svc-input:focus {
  border-color: var(--yellow-dark);
  box-shadow: 0 0 0 3px rgba(255,204,0,0.12);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-1);
  background: var(--gray-6);
  border-bottom: 1.5px solid var(--gray-4);
  white-space: nowrap;
}

thead th.text-right {
  text-align: right;
}

tbody tr {
  border-bottom: 1px solid var(--gray-4);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover:not(.empty-row) {
  background: var(--gray-6);
}

tbody tr.row-peak-storage {
  background: rgba(255, 204, 0, 0.08);
}

tbody tr.row-peak-storage:hover {
  background: rgba(255, 204, 0, 0.14);
}

tbody td {
  padding: 10px 16px;
  color: var(--dark);
  vertical-align: middle;
}

tbody td.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tag-entrada {
  background: var(--green-light);
  color: var(--green);
}

.tag-saida {
  background: var(--red-light);
  color: var(--red);
}

.tag-peak {
  background: rgba(255,204,0,0.2);
  color: #92700a;
  font-size: 9px;
  padding: 2px 6px;
  margin-left: 4px;
  vertical-align: middle;
}

.btn-delete {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--gray-2);
  transition: all 0.15s;
  font-size: 14px;
}

.btn-delete:hover {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

.empty-row td {
  padding: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
}

.empty-state p {
  font-size: 13px;
  color: var(--gray-2);
  font-weight: 500;
}

.cost-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 20px;
  text-align: center;
}

.cost-empty p {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  line-height: 1.6;
  max-width: 240px;
}

.cost-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cost-group {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cost-group:last-child {
  border-bottom: none;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

.cost-label {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  flex: 1;
}

.cost-sub-label {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-left: 12px;
  flex: 1;
}

.cost-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cost-value--muted {
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}

.cost-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,204,0,0.6);
  margin-bottom: 4px;
}

.cost-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0;
}

.cost-subtotal {
  padding: 12px 0;
}

.cost-subtotal .cost-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}

.cost-subtotal .cost-value {
  font-size: 14px;
}

.cost-iss {
  padding: 8px 0;
}

.cost-iss .cost-label {
  color: rgba(255,255,255,0.5);
}

.cost-total {
  margin-top: 4px;
  padding: 14px 16px;
  background: var(--yellow);
  border-radius: var(--radius-sm);
}

.cost-total .cost-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--dark);
}

.cost-total .cost-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
}

.peak-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255,204,0,0.08);
  border: 1px solid rgba(255,204,0,0.2);
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
}

.peak-info-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,204,0,0.7);
}

.peak-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.peak-info-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.peak-info-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--yellow);
}

.chart-container {
  position: relative;
  height: 260px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--white);
}

.chart-empty p {
  font-size: 12px;
  color: var(--gray-2);
  font-weight: 500;
  text-align: center;
  max-width: 200px;
  line-height: 1.5;
}

.chart-empty.hidden {
  display: none;
}

footer {
  background: var(--dark);
  border-top: 1px solid var(--dark-3);
  padding: 16px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

footer p {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
  text-align: center;
}

.footer-note {
  font-size: 11px;
  color: rgba(255,255,255,0.2) !important;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

input[type=number] {
  -moz-appearance: textfield;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .card--sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .header-title h1 {
    font-size: 13px;
  }
  .header-badge {
    display: none;
  }
  main {
    padding: 16px 12px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .header-inner {
    padding: 0 16px;
  }
}
