/* ============================================================
   Repair Tracking Tool – Custom Styles
   Primary:   #eb6b48  (warm orange-red)
   Secondary: #2d2e82  (deep indigo)
   ============================================================ */

/* ---- Transitions ---- */
*, *::before, *::after {
  transition-property: color, background-color, border-color, box-shadow, opacity, transform;
  transition-timing-function: cubic-bezier(.4,0,.2,1);
  transition-duration: 150ms;
}

/* ---- Form elements ---- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
  border: 2px solid #cbd5e1 !important;
  border-radius: 0.5rem !important;
  padding-top: 0.625rem !important;
  padding-bottom: 0.625rem !important;
  padding-left: 2.75rem !important;
  padding-right: 0.875rem !important;
  font-size: 0.9375rem !important;
  background-color: #f8fafc !important;
  color: #1e293b !important;
  width: 100%;
  outline: none !important;
  line-height: 1.5 !important;
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

input:hover, textarea:hover, select:hover {
  border-color: #94a3b8 !important;
  background-color: #fff !important;
}

input:focus, textarea:focus, select:focus {
  border-color: #eb6b48 !important;
  box-shadow: 0 0 0 3px rgba(235,107,72,0.18) !important;
  background-color: #fff !important;
}

select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2364748b' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.625rem center !important;
  background-size: 1.25rem 1.25rem !important;
  padding-right: 2.75rem !important;
  cursor: pointer;
  height: auto !important;
}

select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23eb6b48' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9'/%3E%3C/svg%3E") !important;
}

select option {
  padding: 0.5rem;
  background: #fff;
  color: #1e293b;
}

select option:checked {
  background: #fef3f0;
  color: #eb6b48;
}

/* ---- Input icon positioning ---- */
.input-group {
  position: relative;
}
.input-group .input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: #94a3b8;
  pointer-events: none;
  transition: color 200ms ease;
}
.input-group:focus-within .input-icon {
  color: #eb6b48;
}
/* Textarea icon sits at top, not centered */
.input-group--textarea .input-icon {
  top: 0.875rem;
  transform: none;
}

/* ---- Labels ---- */
label {
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.25rem;
  display: block;
}

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ---- Dashboard scrollable cards ---- */
.dashboard-orders-grid {
  /* Fill remaining viewport height so order lists don't overflow the page */
  min-height: 0;
}
.card-scrollable {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Sensible max-height: fills roughly the remaining viewport */
  max-height: calc(100vh - 24rem);
  min-height: 16rem;
}
.card-scrollable .card-scroll-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* Subtle scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.card-scrollable .card-scroll-content::-webkit-scrollbar {
  width: 6px;
}
.card-scrollable .card-scroll-content::-webkit-scrollbar-track {
  background: transparent;
}
.card-scrollable .card-scroll-content::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}
.card-scrollable .card-scroll-content::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* ---- Order detail: comments sidebar ---- */
.order-detail-comments {
  overflow-x: hidden;
}
@media (min-width: 1024px) {
  .order-detail-comments {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 6rem);
    overflow: hidden;
  }
  .order-detail-comments .comment-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
  }
  .order-detail-comments .comment-list::-webkit-scrollbar {
    width: 6px;
  }
  .order-detail-comments .comment-list::-webkit-scrollbar-track {
    background: transparent;
  }
  .order-detail-comments .comment-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
  }
  .order-detail-comments .comment-list::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
  }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 200ms ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: #eb6b48; color: #fff; }
.btn-primary:hover { background: #d4593a; box-shadow: 0 2px 8px rgba(235,107,72,0.3); }

.btn-secondary { background: #2d2e82; color: #fff; }
.btn-secondary:hover { background: #23246b; box-shadow: 0 2px 8px rgba(45,46,130,0.3); }

.btn-outline { background: transparent; border: 2px solid #e2e8f0; color: #475569; }
.btn-outline:hover { border-color: #eb6b48; color: #eb6b48; background: rgba(235,107,72,0.04); }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

/* ---- Icon button ---- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  padding: 0;
  border: none;
  cursor: pointer;
  position: relative;
  background: transparent;
  transition: all 200ms ease;
}
.btn-icon:active { transform: scale(0.92); }
.btn-icon svg { width: 1.125rem; height: 1.125rem; }

.btn-icon-edit { color: #2d2e82; }
.btn-icon-edit:hover { background: rgba(45,46,130,0.08); color: #1a1b5e; }

.btn-icon-lock { color: #f59e0b; }
.btn-icon-lock:hover { background: rgba(245,158,11,0.08); color: #d97706; }

.btn-icon-unlock { color: #22c55e; }
.btn-icon-unlock:hover { background: rgba(34,197,94,0.08); color: #16a34a; }

.btn-icon-delete { color: #ef4444; }
.btn-icon-delete:hover { background: rgba(239,68,68,0.08); color: #dc2626; }

/* ---- Tooltips ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1e293b;
  color: #fff;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 50;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* ---- Sidebar ---- */
.sidebar {
  background: linear-gradient(180deg, #2d2e82 0%, #232468 50%, #1a1b52 100%);
  width: 16.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  transition: width 300ms cubic-bezier(.4,0,.2,1), transform 300ms cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  z-index: 30;
  box-shadow: 4px 0 16px rgba(30,31,82,0.18), 1px 0 4px rgba(30,31,82,0.1);
}
/* Subtle pattern overlay */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 0%, rgba(235,107,72,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(74,75,176,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

/* ---- Sidebar collapse (desktop) ---- */
.sidebar.collapsed { width: 4.5rem; }
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-user-name,
.sidebar.collapsed .sidebar-version {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 1.25rem 0.5rem; }
.sidebar.collapsed .sidebar-brand-logo { margin: 0; }
.sidebar.collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-link svg { margin: 0; }
.sidebar.collapsed .sidebar-divider { margin-left: 0.5rem; margin-right: 0.5rem; }

/* Collapsed: User section stacks vertically */
.sidebar.collapsed .sidebar-user {
  flex-direction: column;
  padding: 0.625rem 0.5rem;
  gap: 0.375rem;
}
.sidebar.collapsed .sidebar-user-avatar { margin: 0; }
.sidebar.collapsed .sidebar-user-logout {
  width: 1.75rem;
  height: 1.75rem;
}
.sidebar.collapsed .sidebar-user-logout svg {
  width: 1rem;
  height: 1rem;
}

/* Collapsed: Footer centers button only */
.sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 0.5rem;
}
.sidebar.collapsed .sidebar-collapse-btn { margin-left: 0; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* Tooltips for collapsed mode */
.sidebar.collapsed .nav-link[data-tooltip]::after {
  bottom: auto;
  left: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
}
.sidebar.collapsed .nav-link[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(12px);
}

/* ---- Nav links container ---- */
.sidebar-nav-container {
  flex: 1;
  padding: 0 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}
.sidebar-nav-container::-webkit-scrollbar {
  display: none;                  /* Chrome/Safari */
}

/* ---- Nav links ---- */
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  margin: 0.125rem 0;
  border-radius: 0.625rem;
  color: rgba(255,255,255,0.6);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
  position: relative;
  transition: all 200ms cubic-bezier(.4,0,.2,1);
}
.sidebar .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.95);
}
.sidebar .nav-link:hover svg {
  color: rgba(255,255,255,0.95);
}
.sidebar .nav-link.active {
  background: rgba(235,107,72,0.15);
  color: #f4a08a;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #eb6b48;
}
.sidebar .nav-link.active svg {
  color: #eb6b48;
}
.sidebar .nav-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: rgba(255,255,255,0.45);
  transition: color 200ms ease;
}
.sidebar .nav-text {
  transition: opacity 200ms ease, width 200ms ease;
}

/* ---- Sidebar sections ---- */
.sidebar-section-label {
  padding: 0 0.75rem;
  color: rgba(255,255,255,0.25);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 0.375rem;
  transition: opacity 200ms ease, width 200ms ease;
}
.sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  margin: 0.75rem 0.875rem;
}

/* ---- Sidebar brand ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  margin-bottom: 0.25rem;
}
.sidebar-brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  object-fit: contain;
  background: rgba(255,255,255,0.1);
  padding: 0.25rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.sidebar-brand-text h1 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}
.sidebar-brand-text p {
  color: rgba(255,255,255,0.4);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  margin: 0.125rem 0 0;
}

/* ---- Sidebar user ---- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: auto;
  background: rgba(0,0,0,0.1);
}
.sidebar-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #eb6b48, #d4593a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(235,107,72,0.3);
}
.sidebar-user-name {
  flex: 1;
  color: rgba(255,255,255,0.8);
  font-size: 0.8125rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 200ms ease, width 200ms ease;
}
.sidebar-user-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: rgba(255,255,255,0.4);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 200ms ease;
  flex-shrink: 0;
}
.sidebar-user-logout:hover {
  background: rgba(255,255,255,0.1);
  color: #eb6b48;
}
.sidebar-user-logout svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* ---- Sidebar footer: Version + Collapse ---- */
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-version {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.03em;
  font-weight: 500;
  transition: opacity 200ms ease, width 200ms ease;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-collapse-btn {
  display: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 200ms ease;
  margin-left: auto;
}
.sidebar-collapse-btn:hover {
  background: rgba(235,107,72,0.15);
  border-color: rgba(235,107,72,0.25);
  color: #eb6b48;
}
.sidebar-collapse-btn svg {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform 300ms ease;
}
@media (min-width: 769px) {
  .sidebar-collapse-btn { display: flex; }
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,15,40,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    height: 100vh;
    width: 17rem;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-collapse-btn { display: none !important; }
}

/* ---- Mobile header ---- */
.mobile-header {
  display: none;
  background: linear-gradient(135deg, #2d2e82, #232468);
  color: #fff;
  padding: 0.625rem 1rem;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  position: sticky;
  top: 0;
  z-index: 35;
}
.mobile-header img {
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.1);
  padding: 0.125rem;
}
@media (max-width: 768px) {
  .mobile-header { display: flex; }
}

/* ---- Main content area ---- */
.app-main {
  box-shadow: inset 6px 0 12px -6px rgba(30,31,82,0.08);
}

/* ---- Order list: viewport-filling table ---- */
.order-list-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 7rem);
}
.order-list-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.order-list-scroll table {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 100%;
}
.order-list-scroll thead {
  flex-shrink: 0;
}
.order-list-scroll tbody {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.order-list-scroll tbody::-webkit-scrollbar {
  width: 6px;
}
.order-list-scroll tbody::-webkit-scrollbar-track {
  background: transparent;
}
.order-list-scroll tbody::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}
.order-list-scroll tbody::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}
/* Keep column widths consistent between thead and tbody */
.order-list-scroll thead tr,
.order-list-scroll tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

/* ---- Responsive table ---- */
@media (max-width: 768px) {
  .responsive-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .responsive-table table { min-width: 600px; }
}

/* ---- Page background ---- */
.page-bg {
  background: linear-gradient(135deg, #f1f5f9 0%, #e8ecf1 100%);
  min-height: 100vh;
}

/* ---- Toasts override ---- */
#toast-container > div {
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-admin   { background: #fde8e8; color: #991b1b; border-color: #fca5a5; }
.badge-manager { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.badge-report  { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.badge-repair  { background: #fef3f0; color: #c2410c; border-color: #f4a08a; }
.badge-reception { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.badge-user    { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.badge-active  { background: #dcfce7; color: #166534; border-color: #86efac; }
.badge-locked  { background: #fde8e8; color: #991b1b; border-color: #fca5a5; }

/* Order status badges */
.badge-pending    { background: #f3f4f6; color: #6b7280; border-color: #d1d5db; }
.badge-new        { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.badge-assigned   { background: #fef3f0; color: #c2410c; border-color: #f4a08a; }
.badge-completed  { background: #dcfce7; color: #166534; border-color: #86efac; }
.badge-postponed  { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.badge-incomplete { background: #fde8e8; color: #991b1b; border-color: #fca5a5; }

/* ---- Login page background ---- */
.login-bg {
  background: #2d2e82;
  min-height: 100vh;
}

/* ---- Autosuggest dropdown ---- */
.autosuggest-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.autosuggest-item {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 150ms ease;
}
.autosuggest-item:hover,
.autosuggest-item.autosuggest-active {
  background: #fef3f0;
  color: #eb6b48;
}

/* ---- Tag Manager Checklist ---- */
.tag-checklist {
  max-height: 20rem;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
}
.tag-checklist-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
.tag-checklist-item:last-child {
  border-bottom: none;
}
.tag-checklist-item:hover {
  background: #fef3f0;
}
.tag-checklist-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #eb6b48;
  flex-shrink: 0;
  border: 2px solid #cbd5e1 !important;
  border-radius: 0.25rem !important;
  padding: 0 !important;
}
.tag-checklist-label {
  flex: 1;
  font-weight: 500;
  text-transform: capitalize;
}

/* ---- Audit log styles ---- */
.audit-action-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #f1f5f9;
  color: #475569;
}
[class*="audit-action-user\\.login"],
[class*="audit-action-user\\.logout"] {
  background: #e0f2fe;
  color: #0369a1;
}
[class*="audit-action-user\\.created"],
[class*="audit-action-order\\.created"],
[class*="audit-action-backup\\.created"] {
  background: #dcfce7;
  color: #15803d;
}
[class*="audit-action-user\\.updated"],
[class*="audit-action-order\\.updated"],
[class*="audit-action-order\\.status_changed"],
[class*="audit-action-order\\.assigned"] {
  background: #fef3c7;
  color: #92400e;
}
[class*="audit-action-user\\.locked"],
[class*="audit-action-user\\.deleted"],
[class*="audit-action-backup\\.deleted"] {
  background: #fee2e2;
  color: #991b1b;
}
[class*="audit-action-backup\\.restored"] {
  background: #ede9fe;
  color: #6d28d9;
}
.audit-diff {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.5rem;
  max-width: 400px;
}
.audit-diff-field {
  display: inline-block;
  margin: 0.125rem 0.25rem;
  padding: 0.125rem 0.375rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  font-family: ui-monospace, monospace;
}
.audit-diff-field code {
  color: #1e40af;
}

/* ---- Markdown Editor Toolbar ---- */
.md-editor {
  display: flex;
  flex-direction: column;
}
.md-editor textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.md-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  border-radius: 0.5rem 0.5rem 0 0;
}
.md-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.md-toolbar-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.md-toolbar-btn:active {
  background: #cbd5e1;
}
.md-toolbar-btn svg {
  width: 16px;
  height: 16px;
}
.md-toolbar-sep {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
  margin: 0 4px;
}

/* ---- Prose (rendered Markdown) ---- */
.prose { line-height: 1.65; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-weight: 600; margin-top: 1em; margin-bottom: 0.5em; color: #1f2937; }
.prose h2 { font-size: 1.25em; }
.prose h3 { font-size: 1.1em; }
.prose p { margin-bottom: 0.6em; }
.prose ul, .prose ol { padding-left: 1.5em; margin-bottom: 0.6em; }
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li { margin-bottom: 0.25em; }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose-sm { font-size: 0.875rem; }

/* ---- Overlay Dialog ---- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.dialog-overlay.dialog-visible {
  display: flex;
}
.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: dialogFadeIn 150ms ease;
}
.dialog-container {
  position: relative;
  z-index: 1;
  animation: dialogSlideIn 200ms cubic-bezier(.4,0,.2,1);
}
.dialog-box {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  max-width: 26rem;
  width: calc(100vw - 2rem);
  padding: 1.75rem;
  text-align: center;
}
.dialog-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.dialog-icon svg {
  width: 1.75rem;
  height: 1.75rem;
}
.dialog-message {
  font-size: 0.9375rem;
  color: #334155;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}
.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}
.dialog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 150ms ease;
  min-width: 5rem;
}
.dialog-btn:active { transform: scale(0.97); }
.dialog-btn-cancel {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.dialog-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.dialog-btn-confirm {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.dialog-btn-confirm:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

@keyframes dialogFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dialogSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   Help System
   ============================================================ */

/* Help overview: card grid */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.help-card {
  transition: transform 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
}
.help-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Help page: rendered markdown content */
.help-content { font-size: 0.95rem; line-height: 1.7; color: #374151; }
.help-content h1 { font-size: 1.5rem; font-weight: 700; margin-top: 1.5rem; margin-bottom: 0.75rem; color: #1f2937; }
.help-content h2 { font-size: 1.25rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid #e5e7eb; color: #1f2937; }
.help-content h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; color: #374151; }
.help-content p { margin-bottom: 0.75rem; }
.help-content ul, .help-content ol { margin-bottom: 0.75rem; padding-left: 1.5rem; }
.help-content ul { list-style-type: disc; }
.help-content ol { list-style-type: decimal; }
.help-content ul ul { list-style-type: circle; }
.help-content li { margin-bottom: 0.25rem; }
.help-content table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.9rem; }
.help-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.help-content th, .help-content td { padding: 0.5rem 0.75rem; border: 1px solid #e5e7eb; text-align: left; }
.help-content th { background: #f9fafb; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.help-content td { font-size: 0.9rem; }
.help-content img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin: 1rem 0; }
.help-content code { font-size: 0.85em; background: #f3f4f6; padding: 0.15em 0.4em; border-radius: 4px; color: #1f2937; }
.help-content pre { background: #f3f4f6; border-radius: 8px; padding: 1rem; overflow-x: auto; margin-bottom: 1rem; }
.help-content pre code { background: none; padding: 0; }
.help-content a { color: var(--color-primary, #2d2e82); text-decoration: underline; }
.help-content a:hover { opacity: 0.8; }
.help-content hr { border: none; border-top: 1px solid #e5e7eb; margin: 1.5rem 0; }
.help-content blockquote { border-left: 3px solid var(--color-primary, #2d2e82); padding-left: 1rem; margin: 1rem 0; color: #6b7280; font-style: italic; }

/* Context help button */
.context-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 46, 130, 0.08);
  color: var(--color-primary, #2d2e82);
  transition: background 150ms ease;
  flex-shrink: 0;
}
.context-help-btn:hover {
  background: rgba(45, 46, 130, 0.16);
}

/* Guest help: senior-friendly large text */
.guest-help { font-size: 1.125rem; line-height: 1.8; color: #1f2937; }
.guest-help h1 { font-size: 1.5rem; font-weight: 700; text-align: center; color: #2d2e82; margin-bottom: 1rem; }
.guest-help h2 { font-size: 1.3rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.5rem; color: #2d2e82; }
.guest-help p { margin-bottom: 0.75rem; }
.guest-help img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.12); margin: 1rem 0; }
.guest-help strong { color: #2d2e82; }
.guest-help ul, .guest-help ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.guest-help li { margin-bottom: 0.5rem; }
.guest-help hr { border: none; border-top: 1px solid #e5e7eb; margin: 1.5rem 0; }

/* Language switcher */
.lang-switch { display: flex; gap: 4px; justify-content: center; }
.lang-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; font-size: 0.7rem; font-weight: 600; border: none;
  background: transparent; color: rgba(255,255,255,0.45); cursor: pointer;
  border-radius: 5px; transition: all 0.15s ease; letter-spacing: 0.02em;
}
.lang-btn:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); }
.lang-btn.lang-active { color: #fff; background: rgba(255,255,255,0.14); }
.lang-flag { width: 18px; height: 13px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(255,255,255,0.15); }
.lang-label { line-height: 1; }

.sidebar-lang { display: flex; justify-content: center; padding: 6px 0; }
.sidebar.collapsed .sidebar-lang { padding: 4px 0; }
.sidebar.collapsed .lang-label { display: none; }
.sidebar.collapsed .lang-btn { padding: 4px 6px; }
.sidebar.collapsed .lang-flag { width: 16px; height: 12px; }

/* Guest layout: wrapper removed, no extra CSS needed */

/* Guest layout language switcher (inside card, top-right) */
.guest-lang-switch {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
}
.guest-lang-switch .lang-btn {
  color: rgba(0,0,0,0.4); background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px); padding: 5px 10px; font-size: 0.75rem;
}
.guest-lang-switch .lang-btn:hover { color: rgba(0,0,0,0.7); background: rgba(255,255,255,0.9); }
.guest-lang-switch .lang-btn.lang-active { color: #1f2937; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.guest-lang-switch .lang-flag { box-shadow: 0 0 0 1px rgba(0,0,0,0.1); }

@media print {
  .help-grid, .context-help-btn, .lang-switch, .guest-lang-switch { display: none; }
}

