/* ===========================
   Design System - OBBUD Brand
   =========================== */
:root {
  /* OBBUD Brand Colors */
  --background: #f7fbf5;
  --foreground: #141210;

  --card: #ffffff;
  --card-foreground: #141210;

  /* Main Orange - Primary Action */
  --primary: #f16036;
  --primary-dark: #c44a28;
  --primary-foreground: #f7fbf5;
  --primary-gradient: linear-gradient(135deg, #f16036, #d94e2a);

  /* Dark Blue - Trust & Stability */
  --secondary: #253f8d;
  --secondary-foreground: #f7fbf5;

  /* Grey for body text */
  --muted: #e4e4e7;
  --muted-foreground: #171412;

  /* Light Blue - Accent */
  --accent: #c6d5e9;
  --accent-foreground: #141210;

  /* Destructive */
  --destructive: #e5443b;
  --destructive-foreground: #f7fbf5;

  /* Borders & Inputs */
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #f16036;

  /* Utility colors */
  --success: #48bb78;
  --success-dark: #38a169;

  /* Gradients */
  --gradient-blue: linear-gradient(135deg, #c6d5e9, #253f8d);
  --gradient-hero: linear-gradient(135deg, rgba(37, 63, 141, 0.7), rgba(20, 18, 16, 0.8));

  /* Spacing & Radius */
  --radius: 0.5rem;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ===========================
   Reset & Base
   =========================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===========================
   App Layout
   =========================== */
.app {
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

/* ===========================
   App Header with Logo & Nav
   =========================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.app-logo {
  height: 38px;
  width: auto;
}

.app-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-tab {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  opacity: 0.5;
  cursor: pointer;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-tab:hover {
  opacity: 1;
  color: var(--primary);
}

.nav-tab.active {
  opacity: 1;
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* ===========================
   Tab Content
   =========================== */
.tab-content {
  display: none;
  padding: 24px;
}

.tab-content.active {
  display: block;
}

/* ===========================
   Cards
   =========================== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 16px;
}

/* ===========================
   Products Section
   =========================== */
.products-section {
  padding: 24px 16px;
}

/* ===========================
   Offer Header Section
   =========================== */
.offer-header-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.offer-header-row .offer-option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.offer-name-group {
  flex: 1;
  min-width: 250px;
}

.offer-name-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  margin-bottom: 6px;
  opacity: 0.6;
}

.offer-name-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.2s;
  color: var(--foreground);
  background: var(--card);
}

.offer-name-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

.offer-actions {
  display: flex;
  gap: 8px;
}

.btn-save {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  box-shadow: var(--shadow-sm);
}

.btn-save:hover {
  background-color: #1e3472;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-new {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

.btn-new:hover {
  background-color: var(--border);
  transform: translateY(-1px);
}

/* ===========================
   Offer Options Row (transport + przygotowal)
   =========================== */
.offer-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
}

.offer-options-left {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.offer-option-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.offer-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}

.offer-checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.delivery-cost-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.delivery-cost-wrapper label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.delivery-cost-wrapper input[type="number"] {
  width: 100px;
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  color: var(--foreground);
  background: var(--card);
  transition: border-color 0.2s;
}

.delivery-cost-wrapper input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

.delivery-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.offer-select-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
  white-space: nowrap;
}

.offer-option-group select {
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.2s;
}

.offer-option-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

/* Saved offers list */
.saved-offers {
  margin-top: 0;
  padding-top: 0;
}

.saved-offers h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  margin-bottom: 10px;
  opacity: 0.6;
}

.saved-offers-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saved-offers-month {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--secondary);
  margin-top: 12px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
}

.saved-offers-month:first-child {
  margin-top: 0;
}

.saved-offer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
}

.saved-offer-item:hover {
  border-color: var(--primary);
  background-color: rgba(241, 96, 54, 0.04);
}

.saved-offer-item.active {
  border-color: var(--primary);
  background-color: rgba(241, 96, 54, 0.08);
}

.saved-offer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.saved-offer-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.saved-offer-meta {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.6;
}

.saved-offer-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===========================
   VAT Selector (inline in section header)
   =========================== */
.vat-selector {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.vat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted-foreground);
  letter-spacing: 0.3px;
  opacity: 0.6;
}

.vat-option {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.vat-option:hover {
  border-color: var(--primary);
}

.vat-option:has(input:checked) {
  border-color: var(--primary);
  background-color: rgba(241, 96, 54, 0.08);
}

.vat-option input[type="radio"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
}

.vat-custom input[type="number"] {
  width: 50px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
  font-family: inherit;
}

.vat-custom input[type="number"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===========================
   Section Header
   =========================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  margin-bottom: 0;
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-export {
  background-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  padding: 10px 24px;
}

.btn-export:hover {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--destructive);
  padding: 6px 10px;
  font-size: 18px;
}

.btn-danger:hover {
  background-color: rgba(229, 68, 59, 0.1);
  border-radius: var(--radius-sm);
}

/* ===========================
   Table
   =========================== */
.table-wrapper {
  overflow-x: hidden;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.products-table th {
  background-color: var(--card);
  border-bottom: 2px solid var(--border);
  padding: 12px 4px;
  text-align: center;
  font-weight: 600;
  color: var(--muted-foreground);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.3;
  vertical-align: bottom;
  height: 56px;
}

.products-table td {
  padding: 5px 4px;
  border-bottom: 1px solid var(--muted);
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.products-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Column widths - 15 columns, total = 100% */
.col-lp {
  width: 3%;
}

.col-name {
  width: 15%;
  text-align: left !important;
}

.col-unit {
  width: 4%;
}

.col-input {
  width: 7.5%;
}

.col-qty {
  width: 5%;
}

.col-computed {
  width: 7%;
}

.col-actions {
  width: 3%;
}

.col-profit {
  font-weight: 700 !important;
  color: var(--success-dark) !important;
}

/* Inputs in table */
.products-table input[type="text"],
.products-table input[type="number"] {
  width: 100%;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  text-align: right;
  transition: border-color 0.2s;
}

.products-table input[type="text"] {
  text-align: left;
}

.products-table input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(241, 96, 54, 0.2);
}

/* Unit select in table */
.unit-select {
  width: 100%;
  padding: 5px 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  background: var(--card);
  color: var(--foreground);
  transition: border-color 0.2s;
}

.unit-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(241, 96, 54, 0.2);
}

/* Hide number input spinners to save space */
.products-table input[type="number"]::-webkit-outer-spin-button,
.products-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.products-table input[type="number"] {
  -moz-appearance: textfield;
}

/* Computed cells */
.computed {
  font-weight: 500;
  color: var(--muted-foreground);
  background-color: var(--card);
  font-size: 11px;
  white-space: nowrap;
}

/* Summary row */
.summary-row {
  background-color: var(--background) !important;
}

.summary-row td {
  padding: 10px 4px;
  font-weight: 700;
  font-size: 11px;
  border-top: 2px solid var(--border);
  color: var(--foreground);
  white-space: nowrap;
}

/* ===========================
   Styrofoam Calculator
   =========================== */
.styro-calc {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px;
}

.styro-calc h2 {
  text-align: center;
  margin-bottom: 8px;
}

.styro-desc {
  font-size: 14px;
  color: var(--muted-foreground);
  opacity: 0.6;
  margin-bottom: 32px;
  text-align: center;
}

.styro-inputs {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.styro-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.styro-field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
}

.styro-field input,
.styro-field select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--card);
  transition: border-color 0.2s;
}

.styro-field input:focus,
.styro-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

.styro-field input[type="number"] {
  width: 120px;
  text-align: right;
}

.styro-field select {
  min-width: 80px;
}

.styro-field-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.styro-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.styro-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 16px;
  background: var(--background);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  text-align: center;
}

.styro-result-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-foreground);
  font-weight: 600;
  opacity: 0.6;
}

.styro-result-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--foreground);
}

.styro-result-unit {
  font-size: 13px;
  color: var(--muted-foreground);
  font-weight: 500;
}

.styro-result-highlight {
  background: linear-gradient(135deg, rgba(37, 63, 141, 0.06), rgba(198, 213, 233, 0.3));
  border-color: var(--accent);
}

.styro-result-highlight .styro-result-value {
  color: var(--secondary);
}

.styro-field-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-foreground);
  padding: 10px 4px;
  white-space: nowrap;
}

.styro-pack-info {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.styro-pack-detail {
  font-size: 13px;
  color: var(--muted-foreground);
  font-weight: 500;
  line-height: 1.6;
}

/* ===========================
   Facade Materials Calculator
   =========================== */
.facade-calc {
  max-width: 600px;
  margin: 40px auto 0;
  padding: 32px;
}

.facade-calc h2 {
  text-align: center;
  margin-bottom: 8px;
}

.facade-calc > p {
  text-align: center;
  font-size: 14px;
  color: var(--muted-foreground);
  opacity: 0.6;
  margin-bottom: 24px;
}

.facade-input-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.facade-area-input {
  width: 160px !important;
}

.facade-results {
  margin-top: 16px;
}

.facade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.facade-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
  border-bottom: 2px solid var(--border);
}

.facade-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.facade-table tbody tr:hover {
  background-color: var(--background);
}

.facade-material-name {
  font-weight: 600;
  color: var(--foreground);
}

.facade-material-note {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.6;
  margin-top: 2px;
}

.facade-qty {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
}

.facade-qty-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-left: 4px;
}

.facade-pack-select {
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 13px;
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
}

.facade-pack-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

/* Panel offers list (reuses saved-offer styles) */
.panel-offers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===========================
   Panel - Sub-nawigacja
   =========================== */
.panel-subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.panel-subnav-tab {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  cursor: pointer;
}

.panel-subnav-tab:hover {
  background: var(--background);
  color: var(--foreground);
}

.panel-subnav-tab.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

.panel-view {
  display: none;
}

.panel-view.active {
  display: block;
}

/* Panel filters */
.panel-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-filter-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
  white-space: nowrap;
}

.panel-filter select {
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--card);
  cursor: pointer;
}

.panel-search-input {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  min-width: 250px;
  color: var(--foreground);
  background: var(--card);
  transition: border-color 0.2s;
}

.panel-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-foreground);
  opacity: 0.5;
  font-size: 14px;
}

/* ===========================
   Orders List
   =========================== */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.15s;
  gap: 12px;
}

.order-item:hover {
  border-color: var(--primary);
  background: rgba(241, 96, 54, 0.03);
}

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

.order-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.order-client {
  font-size: 12px;
  color: var(--muted-foreground);
}

.order-meta {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.6;
}

.order-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
}

.order-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-nowe {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.status-w_realizacji {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.status-zrealizowane {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.status-anulowane {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Order details line (adres) */
.order-details-line {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.7;
}

/* Order numbers column */
.order-numbers {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
  padding-right: 12px;
}

.order-profit {
  font-size: 12px;
  font-weight: 600;
  color: var(--success-dark);
}

/* Order detail modal */
.order-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.order-detail-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.order-detail-info {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-md);
}

.order-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.order-detail-row span:first-child {
  color: var(--muted-foreground);
}

.order-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}

.order-detail-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
  border-bottom: 2px solid var(--border);
}

.order-detail-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.order-detail-table td:last-child,
.order-detail-table th:last-child {
  text-align: right;
}

.order-detail-totals {
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.order-detail-profit {
  font-weight: 700;
  color: var(--success-dark) !important;
}

.order-detail-profit span {
  color: var(--success-dark) !important;
}

.order-detail-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--secondary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.order-detail-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Status select in order */
.order-status-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--card);
  cursor: pointer;
}

/* ===========================
   Clients List
   =========================== */
.clients-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.client-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.15s;
  cursor: pointer;
}

.client-item:hover {
  border-color: var(--primary);
  background: rgba(241, 96, 54, 0.03);
}

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

.client-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.client-details {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.7;
}

.client-actions {
  display: flex;
  gap: 6px;
}

/* Client inline orders */
.client-orders-inline {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--background);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.client-orders-inline .client-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: all 0.15s;
  gap: 8px;
}

.client-orders-inline .client-order-row:hover {
  border-color: var(--primary);
  background: rgba(241, 96, 54, 0.04);
}

.client-orders-inline .client-order-row:last-child {
  margin-bottom: 0;
}

.client-order-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.client-order-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
}

.client-order-meta {
  font-size: 11px;
  color: var(--muted-foreground);
  opacity: 0.7;
}

.client-order-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
}

/* Client item expandable */
.client-item-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.15s;
  overflow: hidden;
  margin-bottom: 6px;
}

.client-item-wrapper:hover {
  border-color: var(--primary);
}

.client-item-wrapper .client-item {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
}

.client-item-wrapper .client-item:hover {
  border-color: transparent;
  background: rgba(241, 96, 54, 0.03);
}

/* Client form */
.client-form-wrapper {
  margin-bottom: 20px;
  padding: 20px;
  background: var(--background);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.client-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.client-form-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
  margin-bottom: 4px;
}

.client-form-field input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--foreground);
  background: var(--card);
  transition: border-color 0.2s;
}

.client-form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

.client-form-actions {
  display: flex;
  gap: 8px;
}

/* Client type selector */
.client-type-selector {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.client-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}

.client-type-option input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Delivery toggle */
.client-delivery-toggle {
  margin: 16px 0 8px;
}

.client-delivery-fields {
  margin-bottom: 16px;
}

/* ===========================
   Summary Table
   =========================== */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.summary-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-foreground);
  opacity: 0.6;
  border-bottom: 2px solid var(--border);
}

.summary-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.summary-table tr:hover td {
  background-color: var(--background);
}

.summary-table .summary-total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
}

.summary-table td:nth-child(n+3),
.summary-table th:nth-child(n+3) {
  text-align: right;
}

.summary-table td:nth-child(2),
.summary-table th:nth-child(2) {
  text-align: center;
}

/* ===========================
   Modal (konwersja oferty)
   =========================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
}

.modal-close {
  padding: 4px 8px !important;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-offer-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-md);
}

.modal-section {
  margin-bottom: 16px;
}

.modal-client-search {
  margin: 8px 0;
}

.modal-client-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.modal-client-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.modal-client-option:hover {
  border-color: var(--primary);
  background: rgba(241, 96, 54, 0.04);
}

.modal-client-option.selected {
  border-color: var(--primary);
  background: rgba(241, 96, 54, 0.08);
}

.modal-client-option-name {
  font-weight: 600;
  font-size: 13px;
}

.modal-client-option-details {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.7;
}

.modal-hint {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 8px;
}

.modal-hint a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.modal-hint a:hover {
  text-decoration: underline;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ===========================
   Dashboard
   =========================== */
.dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 24px;
  margin-top: -40px;
}

.dashboard-logo {
  height: 56px;
  width: auto;
  margin-bottom: 48px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 900px;
  width: 100%;
}

.dashboard-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.dashboard-tile:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.dashboard-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37, 63, 141, 0.08), rgba(198, 213, 233, 0.4));
  color: var(--secondary);
  margin-bottom: 20px;
}

.dashboard-tile:hover .dashboard-tile-icon {
  background: linear-gradient(135deg, rgba(37, 63, 141, 0.15), rgba(198, 213, 233, 0.6));
}

.dashboard-tile-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 8px;
}

.dashboard-tile-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  opacity: 0.6;
  line-height: 1.5;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
  .tab-content {
    padding: 12px;
  }

  .app-header {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .app-logo {
    height: 26px;
  }

  .nav-tab {
    padding: 6px 14px;
    font-size: 13px;
  }

  .card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .section-header-right {
    flex-wrap: wrap;
  }

  .offer-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .offer-actions {
    flex-wrap: wrap;
  }

  .styro-calc {
    padding: 24px 16px;
  }

  .styro-results {
    grid-template-columns: 1fr;
  }

  .styro-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .styro-field {
    width: 100%;
  }

  .styro-field input[type="number"] {
    width: 100%;
  }

  .facade-calc {
    padding: 24px 16px;
    margin-top: 24px;
  }

  .facade-table {
    font-size: 13px;
  }

  .facade-table th,
  .facade-table td {
    padding: 8px 8px;
  }

  .panel-subnav {
    gap: 2px;
  }

  .panel-subnav-tab {
    padding: 8px 10px;
    font-size: 12px;
  }

  .panel-search-input {
    min-width: 0;
    width: 100%;
  }

  .order-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .order-actions {
    width: 100%;
    justify-content: space-between;
  }

  .client-form-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 100%;
    max-height: 90vh;
  }

  .offer-options-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .offer-options-left {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard {
    min-height: calc(100vh - 60px);
    padding: 32px 16px;
  }

  .dashboard-logo {
    height: 40px;
    margin-bottom: 32px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  .dashboard-tile {
    padding: 32px 24px;
  }
}

/* ===========================
   Loading Indicator
   =========================== */
.loading-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   Login Overlay
   =========================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--secondary), #1a2e5a);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  height: 48px;
  margin-bottom: 16px;
}

.login-card h2 {
  margin: 0 0 32px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--foreground);
}

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

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--foreground);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(241, 96, 54, 0.15);
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}

.login-error {
  margin: 8px 0 0 0;
  padding: 10px 16px;
  background: rgba(229, 68, 59, 0.1);
  border: 1px solid var(--destructive);
  border-radius: var(--radius-md);
  color: var(--destructive);
  font-size: 13px;
}
