/* Dairy factory app — Odoo-inspired, simple and touch friendly. */
:root {
  --app-primary: #1c6ea4;
  --app-nav-bg: #1f3b57;
  --app-bg: #f2f4f7;
  --app-border: #e3e6ea;
  --bs-primary: #1c6ea4;
  --bs-primary-rgb: 28, 110, 164;
  --bs-link-color: #1c6ea4;
  --bs-link-color-rgb: 28, 110, 164;
  --bs-link-hover-color: #155580;
  --bs-body-font-size: 0.95rem;
}

body {
  background: var(--app-bg);
  min-height: 100vh;
}

.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: #155580;
  --bs-btn-hover-border-color: #155580;
  --bs-btn-active-bg: #124a70;
  --bs-btn-active-border-color: #124a70;
  --bs-btn-disabled-bg: var(--app-primary);
  --bs-btn-disabled-border-color: var(--app-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-bg: var(--app-primary);
  --bs-btn-active-border-color: var(--app-primary);
}
.btn .bi + .app-btn-label { margin-left: 0.15rem; }

/* ---------- navbar */
.app-navbar {
  background: var(--app-nav-bg);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}
.app-home-btn {
  color: #fff;
  font-size: 1.35rem;
  margin-right: 0.75rem;
  opacity: 0.9;
  line-height: 1;
}
.app-home-btn:hover { opacity: 1; color: #fff; }
.app-module-name { font-weight: 600; font-size: 1.05rem; }
.app-navbar .nav-link { color: rgba(255, 255, 255, 0.8); border-radius: 0.375rem; }
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, 0.12); }

/* ---------- control panel */
.app-control-panel {
  background: #fff;
  border-bottom: 1px solid var(--app-border);
  padding: 0.6rem 0;
}
.app-breadcrumbs .breadcrumb { font-size: 1.15rem; }
.app-breadcrumbs .breadcrumb-item a { text-decoration: none; }
.app-breadcrumbs .breadcrumb-item.active { color: var(--bs-body-color); font-weight: 600; }
.app-search { min-width: 220px; }
.app-content { padding-top: 1rem; padding-bottom: 2rem; }
.app-messages .alert { margin-bottom: 0.75rem; }

/* ---------- sheet (card) */
.app-sheet {
  border: 1px solid var(--app-border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.app-sheet > .card-body { padding: 1.25rem 1.5rem; }
.app-narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.app-sheet-title { font-size: 1.6rem; font-weight: 600; margin-bottom: 1rem; }
.app-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  font-weight: 700;
  border-bottom: 1px solid var(--app-border);
  padding-bottom: 0.35rem;
  margin: 1.25rem 0 0.75rem;
}
.app-fields { row-gap: 0.25rem; }
.app-field { display: flex; gap: 0.75rem; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.app-field.col-12 > .app-field-label { flex-basis: calc(21% - 0.35rem); }
.app-field-label { flex: 0 0 42%; color: #6c757d; }
.app-field-value { flex: 1; font-weight: 500; word-break: break-word; }
.app-print-header { display: none; }

/* ---------- status bar (Odoo-like pipeline) */
.app-statusbar { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--app-border); border-radius: 0.4rem; overflow: hidden; }
.app-status-step {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: #6c757d;
  background: #fff;
  border-right: 1px solid var(--app-border);
}
.app-status-step:last-child { border-right: 0; }
.app-status-step.done { color: #495057; background: #f8f9fa; }
.app-status-step.active { color: #fff; background: var(--app-primary); font-weight: 600; }
.app-status-step.active.status-rejected,
.app-status-step.active.status-cancelled { background: #dc3545; }
.app-status-step.active.status-done,
.app-status-step.active.status-accepted { background: #198754; }

/* ---------- smart buttons */
.app-smart-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-bottom: 0.5rem; }
.app-smart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--app-border);
  border-radius: 0.4rem;
  color: #495057;
  text-decoration: none;
  background: #fff;
  min-width: 140px;
}
.app-smart-btn:hover { background: #f5f8fb; color: var(--app-primary); }
.app-smart-btn > .bi { font-size: 1.4rem; color: var(--app-primary); }
.app-smart-btn > span { display: flex; flex-direction: column; line-height: 1.15; }
.app-smart-value { font-weight: 700; font-size: 1.05rem; }
.app-smart-label { font-size: 0.8rem; }

/* ---------- tables */
.app-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #6c757d;
  background: #f8f9fa;
  white-space: nowrap;
  border-bottom-width: 1px;
}
.app-table td { white-space: nowrap; }
.app-table td.text-start { white-space: normal; }
.app-sort { color: inherit; text-decoration: none; }
.app-row-link { cursor: pointer; }
.app-empty { text-align: center; padding: 3rem 1rem; color: #6c757d; }
.app-empty > .bi { font-size: 3rem; display: block; margin-bottom: 0.5rem; color: #adb5bd; }
.app-empty-title { font-size: 1.15rem; font-weight: 600; color: #495057; }
.app-filters { background: #fff; }

/* ---------- forms */
.app-formset table { min-width: 720px; }
.app-formset td { vertical-align: top; }
.app-formset .form-control,
.app-formset .form-select { min-width: 110px; }
.app-col-actions { width: 1%; white-space: nowrap; }
.app-check { padding-top: 2rem; }
.form-label { font-weight: 500; margin-bottom: 0.3rem; }
.ts-wrapper.form-select,
.ts-wrapper.form-control { padding: 0; }
.ts-wrapper.is-invalid .ts-control { border-color: var(--bs-form-invalid-border-color); }

/* ---------- home tiles */
.app-home-wrap { max-width: 1000px; margin: 2rem auto; }
.app-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.5rem 1rem;
}
.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: #343a40;
  padding: 0.5rem;
  border-radius: 0.75rem;
  transition: transform 0.12s ease;
}
.app-tile:hover { transform: translateY(-3px); color: #000; }
.app-tile-icon {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.6rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}
.app-tile-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 13px;
  background: #dc3545;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--app-bg);
}
.app-tile-label { font-weight: 600; text-align: center; }

/* ---------- dashboard / KPI */
.app-kpi { border: 1px solid var(--app-border); border-radius: 0.6rem; background: #fff; padding: 1rem 1.1rem; height: 100%; }
.app-kpi-label { color: #6c757d; font-size: 0.85rem; }
.app-kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.app-kpi-sub { font-size: 0.8rem; color: #6c757d; }
.app-kpi-icon { font-size: 1.6rem; opacity: 0.85; }
.app-tank { border: 1px solid var(--app-border); border-radius: 0.6rem; background: #fff; padding: 1rem; height: 100%; }
.app-tank-gauge { height: 14px; border-radius: 7px; background: #e9ecef; overflow: hidden; }
.app-tank-fill { height: 100%; background: linear-gradient(90deg, #64b5f6, #1e88e5); }

/* ---------- login */
.app-login .app-content { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.app-login-card { width: 100%; max-width: 400px; border: 0; }
.app-login-logo {
  display: inline-flex;
  width: 64px;
  height: 64px;
  border-radius: 1rem;
  align-items: center;
  justify-content: center;
  background: #1e88e5;
  color: #fff;
  font-size: 2rem;
}

/* ---------- small screens: icon-only secondary buttons */
@media (max-width: 575.98px) {
  .app-control-panel .btn-outline-secondary .app-btn-label,
  .app-control-panel .btn-outline-danger .app-btn-label,
  .app-control-panel .btn-outline-primary .app-btn-label { display: none; }
  .app-field { flex-direction: column; gap: 0; }
  .app-sheet > .card-body { padding: 1rem; }
  .app-tile-icon { width: 72px; height: 72px; font-size: 2.1rem; }
}

/* ---------- print */
@media print {
  .app-navbar,
  .app-control-panel,
  .app-messages,
  .app-smart-buttons,
  .btn,
  .pagination,
  .app-no-print { display: none !important; }
  body { background: #fff; }
  .app-sheet { border: 0; box-shadow: none; }
  .app-print-header { display: block; font-size: 0.85rem; color: #555; margin-bottom: 0.5rem; }
  .app-content { padding: 0; }
  a { color: inherit; text-decoration: none; }
}
.app-table a { text-decoration: none; }
/* first column of line tables is usually the product: give it room */
.app-formset td:first-child { min-width: 260px; }
