/* ==========================================================================
   Agro Pak Farms — Mobile-First Admin Portal Stylesheet
   ========================================================================== */

:root {
  --forest-950: #0b1a11;
  --forest-900: #132b1d;
  --forest-800: #1b3d29;
  --gold-500: #c9a23f;
  --gold-400: #ddb959;
  --gold-600: #9e7b22;
  --ivory: #faf9f5;
  --sage: #eef2ec;
  --white: #ffffff;
  --ink: #17241c;
  --muted: #55665b;
  --border: rgba(19, 43, 29, 0.12);
  --shadow-sm: 0 4px 12px rgba(11, 26, 17, 0.05);
  --shadow-md: 0 12px 28px rgba(11, 26, 17, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--sage);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
}

/* Login Screen */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(circle at top right, #1b3d29, #0b1a11 70%);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-md);
  border-top: 5px solid var(--gold-500);
}
.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-brand img {
  width: 68px;
  height: 68px;
  margin-inline: auto;
  margin-bottom: 0.75rem;
}
.login-brand h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.45rem;
  color: var(--forest-900);
}
.login-brand p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* App Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--forest-900);
  color: var(--ivory);
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-right: 3px solid var(--gold-500);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
.admin-sidebar.open {
  transform: translateX(0);
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 26, 17, 0.55);
  z-index: 190;
  display: none;
}
.admin-backdrop.open {
  display: block;
}

@media (min-width: 960px) {
  .admin-sidebar {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 260px;
  }
  .sidebar-toggle {
    display: none !important;
  }
  .admin-backdrop {
    display: none !important;
  }
}

.sidebar-head {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-head img {
  width: 42px;
  height: 42px;
}
.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(250, 249, 245, 0.85);
  min-height: 44px;
}
.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(201, 162, 63, 0.18);
  color: var(--gold-400);
}
.nav-pill {
  background: var(--gold-500);
  color: var(--forest-950);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
}
.sidebar-foot {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-toggle {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--ivory);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.page-heading {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  color: var(--forest-900);
}

.admin-content {
  padding: 1.25rem;
  max-width: 1320px;
  width: 100%;
  margin-inline: auto;
}
@media (min-width: 768px) {
  .admin-content {
    padding: 1.75rem;
  }
}

/* Panels & Cards */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.35rem;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  color: var(--forest-900);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  margin-bottom: 1.35rem;
}
@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold-500);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kpi-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  font-weight: 700;
  color: var(--forest-900);
  margin-top: 0.2rem;
}

.two-col {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 900px) {
  .two-col {
    grid-template-columns: 1.4fr 1fr;
  }
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 0.88rem;
}
th {
  background: var(--forest-900);
  color: var(--gold-400);
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-weight: 700;
}
td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-new { background: #fef3c7; color: #92400e; }
.badge-review { background: #dbeafe; color: #1e40af; }
.badge-quoted { background: #e0f2fe; color: #075985; }
.badge-closed { background: #dcfce7; color: #166534; }
.badge-archived { background: #e5e7eb; color: #374151; }

/* Forms & Buttons */
.form-grid {
  display: grid;
  gap: 0.9rem;
}
@media (min-width: 640px) {
  .form-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--forest-900);
}
.field-control {
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(19, 43, 29, 0.22);
  border-radius: 9px;
  background: var(--ivory);
  width: 100%;
}
.field-control:focus {
  outline: none;
  border-color: var(--gold-500);
  background: var(--white);
}
textarea.field-control {
  min-height: 95px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.55rem 1.05rem;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.86rem;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.btn-sm {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}
.btn-gold { background: var(--gold-500); color: var(--forest-950); }
.btn-gold:hover { background: var(--gold-400); }
.btn-forest { background: var(--forest-900); color: var(--white); }
.btn-forest:hover { background: var(--forest-800); }
.btn-outline { background: var(--white); border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--forest-900); }
.btn-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-success { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }
.alert-error { background: #fee2e2; border: 1px solid #fca5a5; color: #7f1d1d; }

.bar-row {
  margin-bottom: 0.85rem;
}
.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.bar-track {
  height: 10px;
  background: var(--sage);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-900), var(--gold-500));
  border-radius: 999px;
}
