:root {
  --primary: #1f4e79;
  --primary-dark: #173b5c;
  --secondary: #2e7d32;
  --success-soft: #eaf7ee;
  --warning: #f9a825;
  --warning-soft: #fff4d9;
  --danger: #c62828;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --muted: #75849a;
  --text: #1d2433;
  --line: #e6ebf2;
  --shadow: 0 16px 36px rgba(31, 78, 121, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #eef4fb 0%, #f7f9fc 100%);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: #132b42;
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffb74d, #ff8a65);
  color: #1d2433;
  font-weight: 800;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-block h1,
.brand-block small {
  margin: 0;
}

.brand-block small {
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.06s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.22), rgba(255, 138, 101, 0.16));
  color: #fff;
  box-shadow: inset 3px 0 0 #ffb74d;
}

.sidebar-footer {
  margin-top: auto;
}

.mini-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
}

.mini-card p {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.8);
}

.segmented {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.segment {
  flex: 1;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.segment.active {
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.main-panel {
  flex: 1;
  padding: 28px 36px 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

.topbar h2 {
  margin: 6px 0 0;
  font-size: 1.5rem;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

.primary-btn,
.ghost-btn,
.pill {
  border-radius: 12px;
  border: none;
  cursor: pointer;
}

.primary-btn {
  background: var(--primary);
  color: white;
  padding: 12px 18px;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: background 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease;
}

.primary-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 18px 40px rgba(31, 78, 121, 0.16);
}

.primary-btn:active {
  transform: scale(0.985);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghost-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 18px;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.ghost-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(31, 78, 121, 0.04);
}

.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.panel-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px 10px 16px;
  border-radius: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.row-actions {
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.kpi-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 20px;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.kpi-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
  opacity: 0.9;
}

.kpi-card h3 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.2rem);
}

.kpi-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.kpi-card.primary {
  background: linear-gradient(135deg, #163d61 0%, #1f4e79 100%);
  color: white;
}

.kpi-card.primary p,
.kpi-card.primary .kpi-header {
  color: rgba(255, 255, 255, 0.82);
}

.kpi-card.success {
  background: var(--success-soft);
}

.kpi-card.warning {
  background: var(--warning-soft);
}

.chip {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.chip.positive {
  background: rgba(46, 125, 50, 0.12);
  color: var(--secondary);
}

.chip.neutral {
  background: rgba(31, 78, 121, 0.08);
  color: var(--primary);
}

.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 26px;
}

.wide-panel,
.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-header a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.filter-pills {
  display: flex;
  gap: 8px;
}

.pill {
  background: #edf2f7;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 700;
}

.pill.active {
  background: rgba(31, 78, 121, 0.12);
  color: var(--primary);
}

.chart-placeholder {
  height: 230px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f6f9fd 0%, #edf4ff 100%);
  padding: 20px 20px 0;
  display: flex;
  align-items: end;
}

.bars {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.bars span {
  flex: 1;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #8db7d8 0%, #1f4e79 100%);
}

.rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rank-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.rank-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.lower-panel {
  margin-top: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status.success {
  background: rgba(46, 125, 50, 0.12);
  color: var(--secondary);
}

.status.info {
  background: rgba(31, 78, 121, 0.1);
  color: var(--primary);
}

.status.warning {
  background: rgba(249, 168, 37, 0.15);
  color: #a46800;
}

/* Login Screen Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef4fb 0%, #f7f9fc 100%);
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffb74d, #ff8a65);
  color: #1d2433;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
}

.login-logo img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
}

.login-card h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 24px;
}

.login-card p {
  margin: 0 0 30px;
  color: var(--muted);
}

.login-card .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.login-card label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  color: var(--text);
}

.login-card input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-card .primary-btn {
  width: 100%;
  margin-top: 10px;
}

/* Logout Button */
.logout-btn {
  margin-top: auto;
  color: rgba(255, 100, 100, 0.9) !important;
}

.logout-btn:hover {
  background: rgba(255, 100, 100, 0.1) !important;
  color: #ff6464 !important;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 28, 46, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  animation: modal-pop 0.18s ease;
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.large-modal {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-body h4 {
  margin: 0 0 16px;
  font-size: 16px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal-content > form {
  padding: 24px;
}

.modal-content > form > .modal-footer {
  margin: 24px -24px -24px;
  padding: 16px 24px;
}

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.text-muted {
  color: var(--muted);
  font-size: 14px;
}

.image-preview {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.image-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-item .remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--danger);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  margin-bottom: 10px;
}

.form-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.btn-block {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}

.primary-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-link:hover {
  text-decoration: underline;
}

.table-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input,
.filter-select,
.date-input,
.form-input,
.form-select {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.filter-select,
.date-input,
.form-select {
  min-width: 150px;
}

.form-input,
.form-select {
  width: 100%;
}

.data-table {
  margin-top: 16px;
}

.action-btn {
  background: #edf2f7;
  border: none;
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.18s;
}

.action-btn:hover {
  background: var(--primary);
  color: white;
}

.action-btn.danger {
  color: var(--danger);
}

.action-btn.danger:hover {
  background: var(--danger);
  color: white;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: rgba(31, 78, 121, 0.035);
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background: #f5f7fa;
  border-radius: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.report-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #edf4ff 100%);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
}

.report-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.report-card-content h4 {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--muted);
}

.report-value {
  margin: 4px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.report-tag {
  font-size: 12px;
  color: var(--muted);
}

.expense-summary {
  margin-bottom: 20px;
}

.expense-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.expense-summary-card {
  background: linear-gradient(135deg, #f9a825 0%, #ffb74d 100%);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #1d2433;
}

.expense-summary-card.secondary {
  background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
  color: white;
}

.expense-summary-card.tertiary {
  background: linear-gradient(135deg, #1f4e79 0%, #2196f3 100%);
  color: white;
}

.expense-summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.expense-summary-card h4 {
  margin: 0 0 4px;
  font-size: 13px;
  opacity: 0.9;
}

.expense-value {
  margin: 4px 0;
  font-size: 22px;
  font-weight: 700;
}

.expense-tag {
  font-size: 12px;
  opacity: 0.8;
}

.report-details {
  margin-top: 24px;
}

.report-details h4 {
  margin: 0 0 16px;
  font-size: 16px;
  color: var(--text);
}

.category-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.category-badge.office {
  background: rgba(31, 78, 121, 0.1);
  color: var(--primary);
}

.category-badge.utilities {
  background: rgba(249, 168, 37, 0.15);
  color: #a46800;
}

.category-badge.transport {
  background: rgba(198, 40, 40, 0.1);
  color: var(--danger);
}

.category-badge.inventory {
  background: rgba(46, 125, 50, 0.1);
  color: var(--secondary);
}

.user-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.user-tab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}

.user-tab.active {
  background: rgba(31, 78, 121, 0.1);
  color: var(--primary);
}

.role-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.role-badge.admin {
  background: rgba(31, 78, 121, 0.12);
  color: var(--primary);
}

.role-badge.manager {
  background: rgba(46, 125, 50, 0.12);
  color: var(--secondary);
}

.role-badge.accountant {
  background: rgba(33, 150, 243, 0.12);
  color: #1565c0;
}

.role-badge.employee {
  background: rgba(249, 168, 37, 0.16);
  color: #a46800;
}

.role-badge.outsider {
  background: rgba(108, 93, 211, 0.12);
  color: #5e35b1;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.setting-group {
  background: #f5f7fa;
  border-radius: 12px;
  padding: 20px;
}

.setting-group h4 {
  margin: 0 0 16px;
  font-size: 16px;
  color: var(--text);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .kpi-grid,
  .content-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .main-panel {
    padding: 20px 18px 28px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .kpi-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

/* ===== Label Design editor ===== */
.element-editor {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.element-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.element-visible {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.element-visible input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.element-key {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
}
.element-editor-inputs {
  display: flex;
  gap: 10px;
}
.element-num {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--muted);
  flex: 1;
}
.element-num input {
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
}
.element-num input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===== Label Design interactive preview ===== */
.label-canvas {
  position: relative;
  width: 384px;
  max-width: 100%;
  aspect-ratio: 384 / 260;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(31, 78, 121, 0.12);
  overflow: hidden;
}
.label-canvas img,
.label-canvas .label-preview-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.label-canvas .label-preview-canvas {
  display: block;
}
.label-print-area {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1.5px dashed #c62828;
  color: #c62828;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
  padding-top: 2px;
  opacity: 0.75;
}
.label-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.label-handle {
  position: absolute;
  pointer-events: auto;
  cursor: move;
  box-sizing: border-box;
  border: 1.5px solid #1F4E79;
  background: rgba(31, 78, 121, 0.12);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}
.label-handle:hover {
  background: rgba(31, 78, 121, 0.22);
}
.label-handle-label {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 9px;
  font-weight: 700;
  color: #1F4E79;
  background: #fff;
  border: 1px solid #1F4E79;
  border-radius: 3px;
  padding: 0 3px;
  white-space: nowrap;
  line-height: 13px;
}
.label-resize-grip {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 11px;
  height: 11px;
  background: #1F4E79;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, background 0.12s ease;
}

.label-resize-grip:hover {
  transform: scale(1.35);
  background: #ffb74d;
}

.label-handle.is-selected {
  border-color: #ff8a65;
  background: rgba(255, 183, 77, 0.22);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 138, 101, 0.6);
}

.label-handle.is-selected .label-handle-label {
  background: #ff8a65;
  color: #fff;
  border-color: #ff8a65;
}

/* ===== Professional label designer ===== */
.designer-grid {
  grid-template-columns: 1.6fr 1fr;
  align-items: start;
}

.design-preview-wrap {
  background: transparent;
  border-radius: 12px;
  padding: 28px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  background-image:
    radial-gradient(circle, rgba(31, 78, 121, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--line);
}

.label-design-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #f6f9fd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.toolbar-hint {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.zoom-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-group span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 2px;
}

.toolbar-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.toolbar-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.design-elements {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.element-editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.element-editor:hover {
  border-color: rgba(31, 78, 121, 0.4);
}

.element-editor.is-selected {
  border-color: #ff8a65;
  background: rgba(255, 183, 77, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 138, 101, 0.18);
}

.element-visible {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.element-visible input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.element-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #edf2f7;
  color: var(--primary);
  font-size: 12px;
  flex-shrink: 0;
}

.element-key {
  border: none;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s ease;
}

.element-key:hover {
  background: var(--primary);
  color: #fff;
}

.element-num {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--muted);
  flex: 1;
}

.element-num > span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin-bottom: 4px;
}

.stepper-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.stepper-wrap input {
  border: none;
  border-radius: 0;
  width: 100%;
  min-width: 0;
  text-align: center;
  padding: 5px 2px;
  font-size: 13px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper-wrap input::-webkit-outer-spin-button,
.stepper-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-wrap input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.step-btn {
  flex-shrink: 0;
  width: 26px;
  border: none;
  background: #edf2f7;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.step-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== Sell / POS ===== */
.sell-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}

.sell-picker {
  background: #f6f9fd;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.sell-picker h4,
.sell-cart-head h4 {
  margin: 0 0 4px;
}

.sell-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
}

.sell-result {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sell-result:hover {
  border-color: rgba(31, 78, 121, 0.45);
  box-shadow: 0 6px 16px rgba(31, 78, 121, 0.08);
}

.sell-result-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sell-result-info strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sell-result-price {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.adder-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--secondary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.adder-btn:hover {
  background: var(--secondary);
  color: #fff;
}

.sell-cart {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.sell-cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.sell-cart-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 4px 10px;
}

.sell-cart .data-table {
  margin-top: 8px;
}

.price-input {
  width: 96px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: right;
  font-weight: 600;
}

.sell-customer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.sell-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 0 12px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}

.sell-total span {
  color: var(--muted);
  font-weight: 600;
}

.sell-total strong {
  font-size: 1.5rem;
  color: var(--primary);
}

/* Activity Logs Styles */
.activity-summary {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--success-soft);
  border-radius: 8px;
  border: 1px solid #c8e6c9;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stat span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.summary-stat strong {
  font-size: 16px;
  color: var(--secondary);
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-success {
  background: var(--success-soft);
  color: var(--secondary);
}

.status-failed {
  background: #ffebee;
  color: var(--danger);
}

.activity-details {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  margin-top: 8px;
}

.activity-details div {
  margin-bottom: 4px;
  font-size: 13px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 12px;
}

@media (max-width: 980px) {
  .sell-layout,
  .designer-grid {
    grid-template-columns: 1fr;
  }

  .activity-summary {
    flex-direction: column;
    gap: 12px;
  }
}
