/* FarmCrest UI — light theme; high-contrast readable text */
:root {
  --hf-bg: #eef1f5;
  --hf-surface: #ffffff;
  --hf-text: #1a1d23;
  --hf-muted: #4a5563;
  --hf-muted-soft: #5c6570;
  --hf-border: #cfd6e0;
  --hf-green: #1e9e1e;
  --hf-green-border: #2f7a30;
  --hf-red: #d32f2f;
  --hf-blue: #1b6ca8;
  --hf-blue-dark: #155a8a;
  --hf-radius: 12px;
  --hf-radius-pill: 9px;
  --hf-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

body.hf-theme {
  background-color: var(--hf-bg);
  color: var(--hf-text);
  font-family: "Montserrat", "Open Sans", system-ui, sans-serif;
  min-height: 100vh;
}

body.hf-theme.hf-rtl {
  font-family: "Cairo", "Montserrat", system-ui, sans-serif;
}

.hf-theme a {
  color: var(--hf-blue);
  text-decoration: none;
  font-weight: 600;
}

.hf-theme a:hover {
  color: var(--hf-blue-dark);
}

/* Header / navbar */
.hf-header {
  background: var(--hf-surface);
  border-radius: 10px;
  box-shadow: var(--hf-shadow);
  padding: 0.65rem 1rem;
  margin: 0.75rem auto 0;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hf-header .hf-brand {
  text-decoration: none;
}

.hf-header .hf-logo {
  height: 42px;
  width: auto;
  max-width: 220px;
  display: block;
  object-fit: contain;
}

.hf-header .hf-nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hf-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--hf-bg);
  border: 1px solid var(--hf-border);
  border-radius: 999px;
  padding: 0.15rem;
}

.hf-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--hf-muted) !important;
  text-decoration: none !important;
}

.hf-lang-btn:hover {
  background: #fff;
  color: var(--hf-text) !important;
}

.hf-lang-btn.is-active {
  background: var(--hf-blue);
  color: #fff !important;
}

.hf-header .hf-nav-links a.nav-link {
  color: var(--hf-text);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.hf-header .hf-nav-links a.nav-link:hover {
  background: var(--hf-bg);
}

.hf-main {
  max-width: 1200px;
  margin: 1rem auto 2rem;
  padding: 0 0.75rem;
}

/* Cards */
.hf-card {
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: var(--hf-radius);
  box-shadow: var(--hf-shadow);
  color: var(--hf-text);
}

.hf-card .card-header {
  background: #f4f6f9;
  border-bottom: 1px solid var(--hf-border);
  color: var(--hf-text);
  font-weight: 700;
}

.hf-card .card-body {
  color: var(--hf-text);
}

.hf-theme .card {
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: var(--hf-radius);
  box-shadow: var(--hf-shadow);
  color: var(--hf-text);
}

.hf-theme .card.bg-dark {
  background: var(--hf-surface) !important;
  color: var(--hf-text) !important;
}

.hf-theme .card.bg-dark.text-white,
.hf-theme .card.text-white:not(.bg-primary):not(.bg-success):not(.bg-warning):not(.bg-info):not(.bg-danger):not(.bg-secondary) {
  background: var(--hf-surface) !important;
  color: var(--hf-text) !important;
}

.hf-theme .card-header.bg-dark {
  background: #f4f6f9 !important;
  color: var(--hf-text) !important;
  border-bottom: 1px solid var(--hf-border);
}

.hf-theme .table-dark {
  --bs-table-bg: #fff;
  --bs-table-color: var(--hf-text);
  --bs-table-border-color: var(--hf-border);
  --bs-table-striped-bg: #f5f7fa;
  --bs-table-hover-bg: #eaf1f8;
  color: var(--hf-text);
}

.hf-theme .card.bg-primary,
.hf-theme .card.bg-success,
.hf-theme .card.bg-info,
.hf-theme .card.bg-danger {
  color: #fff !important;
}

.hf-theme .card.bg-warning {
  color: #212529 !important;
}

.hf-theme .text-muted {
  color: var(--hf-muted) !important;
}

.hf-theme .small,
.hf-theme small {
  color: var(--hf-muted-soft);
}

.hf-theme code {
  color: #1f3a5f !important;
  background: #eef3f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.88em;
}

.hf-theme .alert-info {
  background: #e8f4fc;
  border-color: #9ec9e6;
  color: #134a66;
}

/* Buttons */
.btn-hf-start {
  background: var(--hf-green);
  border: 1px solid var(--hf-green-border);
  color: #fff !important;
  border-radius: var(--hf-radius-pill);
  font-weight: 700;
  padding: 0.4rem 0.95rem;
}

.btn-hf-start:hover {
  background: #178217;
  color: #fff !important;
}

.btn-hf-stop {
  background: var(--hf-red);
  border: 1px solid #b71c1c;
  color: #fff !important;
  border-radius: var(--hf-radius-pill);
  font-weight: 700;
  padding: 0.4rem 0.95rem;
}

.btn-hf-stop:hover {
  background: #b71c1c;
  color: #fff !important;
}

.btn-hf-ayar {
  background: #fff;
  border: 1px solid #9eb6cc;
  color: var(--hf-blue) !important;
  border-radius: var(--hf-radius-pill);
  font-weight: 700;
  padding: 0.4rem 0.95rem;
}

.btn-hf-ayar:hover {
  background: #eaf3fb;
  color: var(--hf-blue-dark) !important;
}

.btn-hf-history {
  background: #f4f7fb;
  border: 1px solid #9eb6cc;
  color: #1f3a5f !important;
  border-radius: var(--hf-radius-pill);
  font-weight: 700;
  padding: 0.4rem 0.95rem;
}

.btn-hf-history:hover {
  background: #e4edf7;
  color: #12263f !important;
}

.btn-hf-logout {
  background: var(--hf-red);
  border: none;
  color: #fff !important;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
}

.btn-hf-logout:hover {
  background: #b71c1c;
  color: #fff !important;
}

.btn-hf-primary {
  background: var(--hf-blue);
  border: 1px solid #134f7a;
  color: #fff !important;
  border-radius: var(--hf-radius-pill);
  font-weight: 700;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-hf-primary:hover {
  background: var(--hf-blue-dark);
  color: #fff !important;
}

.btn-hf-save {
  background: var(--hf-blue);
  border: 1px solid #134f7a;
  color: #fff !important;
  border-radius: var(--hf-radius-pill);
  font-weight: 700;
}

.btn-hf-save:hover {
  background: #134f7a;
  color: #fff !important;
}

.hf-theme .btn-secondary {
  background: #3d4654 !important;
  border-color: #2f3641 !important;
  color: #fff !important;
  font-weight: 700;
}

.hf-theme .btn-secondary:hover {
  background: #2a303a !important;
  color: #fff !important;
}

.hf-theme .btn-outline-secondary {
  border-color: #7a8699;
  color: #2a3340 !important;
  font-weight: 700;
  background: #fff;
}

.hf-theme .btn-outline-secondary:hover {
  background: #eef1f5;
  color: #1a1d23 !important;
  border-color: #5c6570;
}

/* Auth */
.hf-auth-wrap {
  min-height: calc(100vh - 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0.75rem;
}

.hf-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--hf-surface);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--hf-border);
  padding: 1.75rem 1.5rem;
}

.hf-auth-card .hf-auth-logo {
  display: block;
  margin: 0 auto 1rem;
  height: 56px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.hf-auth-card h3 {
  text-align: center;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.hf-auth-card .form-control {
  border-radius: 10px;
  border-color: var(--hf-border);
  padding: 0.65rem 0.85rem;
  color: var(--hf-text);
}

.hf-auth-card .form-control:focus {
  border-color: var(--hf-blue);
  box-shadow: 0 0 0 0.2rem rgba(27, 108, 168, 0.18);
}

/* Account / castle cards */
.hf-castle-card {
  background: var(--hf-surface);
  border: 1px solid #d7dee8;
  border-radius: var(--hf-radius);
  box-shadow: var(--hf-shadow);
  overflow: hidden;
}

.hf-castle-card .hf-castle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--hf-border);
  background: #f7f9fc;
}

.hf-castle-card .hf-castle-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  color: var(--hf-text);
  min-width: 0;
}

.hf-castle-card .hf-castle-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.hf-castle-card .hf-castle-body {
  padding: 0.85rem 1rem 1rem;
}

.hf-castle-card .hf-meta {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--hf-text);
}

.hf-castle-card .hf-meta strong {
  color: var(--hf-text);
}

.hf-castle-card .hf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.hf-icon-inline {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.hf-icon-tab {
  width: 20px;
  height: 20px;
  object-fit: contain;
  margin-right: 0.3rem;
  vertical-align: text-bottom;
}

.hf-icon-section {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin-right: 0.45rem;
  vertical-align: middle;
}

.hf-icon-task {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Settings */
.hf-theme .settings-section {
  background: #ffffff;
  border: 1px solid var(--hf-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 15px;
  color: var(--hf-text);
}

.hf-theme .settings-section h5 {
  color: var(--hf-text);
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.hf-theme .settings-section.border-warning {
  border-color: #e0a800 !important;
  background: #fffdf5;
}

.hf-theme .nav-tabs {
  border-bottom-color: var(--hf-border);
}

.hf-theme .nav-tabs .nav-link {
  color: var(--hf-muted);
  font-weight: 700;
  border-radius: 8px 8px 0 0;
}

.hf-theme .nav-tabs .nav-link.active {
  color: var(--hf-blue);
  background: var(--hf-surface);
  border-color: var(--hf-border) var(--hf-border) var(--hf-surface);
}

.hf-theme .form-control,
.hf-theme .form-select {
  border-color: #b7c0cd;
  border-radius: 8px;
  color: var(--hf-text);
  background: #fff;
}

.hf-theme .form-control:focus,
.hf-theme .form-select:focus {
  border-color: var(--hf-blue);
  box-shadow: 0 0 0 0.2rem rgba(27, 108, 168, 0.18);
}

.hf-theme .form-check-label {
  color: var(--hf-text);
  font-weight: 500;
}

.hf-theme .form-check-input {
  border: 1.5px solid #7a8699;
  width: 1.15em;
  height: 1.15em;
}

.hf-theme .form-check-input:checked {
  background-color: var(--hf-blue);
  border-color: var(--hf-blue);
}

.hf-theme .form-switch {
  padding-left: 3.2rem;
}

.hf-theme .form-switch .form-check-input {
  width: 2.6rem;
  height: 1.35rem;
  margin-left: -3.2rem;
  border: 1.5px solid #7a8699;
}

.hf-theme .form-switch .form-check-label {
  padding-left: 0.25rem;
}

.hf-page-title {
  font-weight: 700;
  color: var(--hf-text);
}

.hf-badge-working {
  background: #d9f0dc;
  color: #146c2e !important;
  border: 1px solid #8bc99a;
  font-weight: 700;
}

.hf-badge-pending {
  background: #ffe8b8;
  color: #8a4b00 !important;
  border: 1px solid #e0a800;
  font-weight: 700;
}

.hf-badge-stopped {
  background: #e4e8ed;
  color: #334155 !important;
  border: 1px solid #a8b0bc;
  font-weight: 700;
}

/* Task history */
.hf-history-table {
  margin: 0;
  color: var(--hf-text);
}

.hf-history-table thead th {
  background: #e8eef5;
  color: #1a1d23;
  font-weight: 700;
  border-bottom: 2px solid #b7c0cd;
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

.hf-history-table tbody td {
  padding: 0.7rem 1rem;
  vertical-align: middle;
  border-color: #d7dee8;
  color: var(--hf-text);
}

.hf-history-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.hf-history-table tbody tr:hover {
  background: #eaf2fa;
}

.hf-history-time {
  font-weight: 700;
  color: #1a1d23;
  font-variant-numeric: tabular-nums;
}

.hf-history-tz {
  display: block;
  font-size: 0.78rem;
  color: var(--hf-muted);
  font-weight: 600;
}

.hf-history-task {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 600;
  color: #1f3a5f;
  background: #eef3f9;
  border: 1px solid #c5d3e4;
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
}

.hf-history-detail {
  color: var(--hf-muted);
  font-weight: 600;
}

.hf-history-detail.is-error {
  color: #9a3412;
  font-weight: 700;
}

.hf-skill-card {
  border: 1.5px solid #9aa7b8 !important;
  background: #fff;
}

.hf-skill-card.is-on {
  border-color: #2f9e44 !important;
  background: #f3fbf5;
}

.hf-skill-card .small {
  color: var(--hf-text) !important;
  font-weight: 600;
}

.hf-skill-card .hf-skill-key {
  color: var(--hf-muted) !important;
  font-size: 0.72rem;
  font-weight: 600;
}

/* Admin stats */
.hf-stat-card {
  background: #fff;
  border: 1px solid var(--hf-border);
  border-radius: var(--hf-radius);
  box-shadow: var(--hf-shadow);
  padding: 1rem 1.1rem;
  border-left: 4px solid #64748b;
  height: 100%;
}

.hf-stat-card.is-green {
  border-left-color: #1e9e1e;
}

.hf-stat-card.is-amber {
  border-left-color: #d97706;
}

.hf-stat-card.is-blue {
  border-left-color: #1b6ca8;
}

.hf-stat-label {
  color: #4a5563;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.hf-stat-value {
  color: #1a1d23;
  font-weight: 800;
  font-size: 1.85rem;
  line-height: 1.1;
}

/* Task history date navigator */
.hf-date-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.hf-date-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  flex: 1 1 220px;
  padding: 0.15rem 0.1rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.hf-date-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1.5px solid #b7c0cd;
  background: #fff;
  color: #1a1d23;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  min-width: 96px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hf-date-chip:hover {
  background: #eaf2fa;
  border-color: #7aa0c2;
}

.hf-date-chip.is-active {
  background: #1b6ca8;
  border-color: #134f7a;
  color: #fff;
  box-shadow: 0 2px 8px rgba(27, 108, 168, 0.28);
}

.hf-date-chip.is-active .hf-date-chip-meta,
.hf-date-chip.is-active .text-success,
.hf-date-chip.is-active .text-danger {
  color: #fff !important;
}

.hf-date-chip-label {
  display: block;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1.2;
}

.hf-date-chip-meta {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.15rem;
  color: #4a5563;
}

.hf-date-select {
  max-width: 280px;
  font-weight: 600;
}

.hf-date-prev,
.hf-date-next {
  flex: 0 0 auto;
  min-width: 42px;
}

.hf-date-prev:disabled,
.hf-date-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 576px) {
  .hf-date-select {
    max-width: 100%;
    width: 100%;
    order: 5;
  }
}
