/* ==========================================================================
   MiNAMA Shared Layout System
   Global container, spacing grid, card/table widths, and loading skeletons
   for the main agent SPA (index.html).
   Container max-width tuned to 1360px (1432px at ≥1921px).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Main container
   -------------------------------------------------------------------------- */
.app-container {
  width: calc(100% - 48px);
  max-width: 1360px;
  margin: 0 auto;
  box-sizing: border-box;
}

@media (min-width: 1921px) {
  .app-container {
    max-width: 1432px;
  }
}

@media (max-width: 640px) {
  .app-container {
    width: calc(100% - 32px);
  }
}

/* --------------------------------------------------------------------------
   2. View wrapper
   -------------------------------------------------------------------------- */
.app-view {
  width: 100%;
  padding-top: 24px;
  padding-bottom: 40px;
}

/* --------------------------------------------------------------------------
   3. 8pt spacing grid utilities
   -------------------------------------------------------------------------- */
.app-gap-8   { gap: 8px; }
.app-gap-16  { gap: 16px; }
.app-gap-24  { gap: 24px; }
.app-gap-32  { gap: 32px; }
.app-gap-40  { gap: 40px; }

.app-p-8     { padding: 8px; }
.app-p-16    { padding: 16px; }
.app-p-24    { padding: 24px; }
.app-p-32    { padding: 32px; }

.app-py-8    { padding-top: 8px;  padding-bottom: 8px; }
.app-py-16   { padding-top: 16px; padding-bottom: 16px; }
.app-py-24   { padding-top: 24px; padding-bottom: 24px; }
.app-py-32   { padding-top: 32px; padding-bottom: 32px; }

.app-px-16   { padding-left: 16px; padding-right: 16px; }
.app-px-24   { padding-left: 24px; padding-right: 24px; }
.app-px-32   { padding-left: 32px; padding-right: 32px; }

.app-mb-8    { margin-bottom: 8px; }
.app-mb-16   { margin-bottom: 16px; }
.app-mb-24   { margin-bottom: 24px; }
.app-mb-32   { margin-bottom: 32px; }
.app-mb-40   { margin-bottom: 40px; }

/* --------------------------------------------------------------------------
   4. Card widths — differentiate search/filter forms from data tables
   -------------------------------------------------------------------------- */
.app-card {
  width: 100%;
  box-sizing: border-box;
}

.app-card-narrow {
  background: linear-gradient(145deg, rgba(255,255,255,0.56), rgba(255,255,255,0.25));
  -webkit-backdrop-filter: blur(24px) saturate(165%);
  backdrop-filter: blur(24px) saturate(165%);
  border: 1px solid rgba(255,255,255,0.76);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(52,10,13,0.13), 0 8px 22px rgba(52,10,13,0.08), inset 0 1px 0 rgba(255,255,255,0.82), inset 0 -28px 42px rgba(123,24,24,0.035);
  padding: 18px;
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   5. Table wrapper — data tables should use full container width
   -------------------------------------------------------------------------- */
.app-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  background: linear-gradient(145deg, rgba(255,255,255,0.56), rgba(255,255,255,0.25));
  -webkit-backdrop-filter: blur(24px) saturate(165%);
  backdrop-filter: blur(24px) saturate(165%);
  border: 1px solid rgba(255,255,255,0.76);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(52,10,13,0.13), 0 8px 22px rgba(52,10,13,0.08), inset 0 1px 0 rgba(255,255,255,0.82), inset 0 -28px 42px rgba(123,24,24,0.035);
}

.app-table-wrap table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.app-table-wrap thead { background: rgba(255,255,255,0.28); }

.app-table-wrap th {
  padding: 0 20px;
  height: 38px;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(90,86,80,0.66);
}

.app-table-wrap tbody tr {
  height: 56px;
  background: linear-gradient(145deg, rgba(255,255,255,0.52), rgba(255,255,255,0.30));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.58), inset 0 -12px 20px rgba(123,24,24,0.026);
  border-bottom: 1px solid rgba(185,165,165,0.14);
}

.app-table-wrap td {
  padding: 0 20px;
  height: 56px;
  vertical-align: middle;
}

.app-table-wrap tbody tr:hover {
  background: linear-gradient(145deg, rgba(255,255,255,0.58), rgba(255,255,255,0.34));
}

/* --------------------------------------------------------------------------
   6. Empty / loading states
   -------------------------------------------------------------------------- */
.app-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3, #8e8e93);
  font-size: 14px;
  line-height: 1.5;
}

.app-empty-state strong {
  color: var(--text, #340A0D);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   7. Skeleton loading rows
   -------------------------------------------------------------------------- */
.app-skeleton-row {
  display: grid;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  align-items: center;
}

.app-skeleton-cell {
  min-width: 0;
}

.app-skeleton-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e5e5e5 25%, #f0f0f0 50%, #e5e5e5 75%);
  background-size: 200% 100%;
  animation: appSkeletonShimmer 1.4s infinite linear;
}

.app-skeleton-bar.short { width: 35%; }
.app-skeleton-bar.medium { width: 65%; }
.app-skeleton-bar.long { width: 90%; }

@keyframes appSkeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.app-skeleton-head {
  background: rgba(0, 0, 0, 0.04);
}

.app-skeleton-head .app-skeleton-bar {
  background: linear-gradient(90deg, #d4d4d4 25%, #e0e0e0 50%, #d4d4d4 75%);
}

/* --------------------------------------------------------------------------
   8. Greeting bar spacing (inside mainContentWrap)
   -------------------------------------------------------------------------- */
.app-greeting-bar {
  padding: 8px 24px;
  width: 100%;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   9. Shared form components — Assignments page source-of-truth palette
   -------------------------------------------------------------------------- */

/* Shared filter inputs / selects — translucent glass */
.asn-filter-inp {
  height: 32px;
  padding: 0 10px;
  background: rgba(255,255,255,0.24);
  border: 1px solid rgba(185,165,165,0.34);
  border-radius: 10px;
  color: #1f2937;
  font-family: var(--font);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.asn-filter-inp[type="date"], .asn-filter-inp[type="month"] {
  -webkit-appearance: none; appearance: none;
  min-height: 32px;
  line-height: 1.2;
}
.asn-filter-inp::placeholder { color: #a8a39c; }
.asn-filter-inp:focus {
  background: rgba(255,255,255,0.42);
  border-color: rgba(123,24,24,0.58);
  box-shadow: 0 10px 22px rgba(52,10,13,0.05), inset 0 1px 0 rgba(255,255,255,0.62);
}

.asn-filter-sel {
  height: 32px;
  padding: 0 28px 0 10px;
  background: rgba(255,255,255,0.24);
  border: 1px solid rgba(185,165,165,0.34);
  border-radius: 10px;
  color: #1f2937;
  font-family: var(--font);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a39c' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.asn-filter-sel:focus {
  background: rgba(255,255,255,0.42);
  border-color: rgba(123,24,24,0.58);
  box-shadow: 0 10px 22px rgba(52,10,13,0.05), inset 0 1px 0 rgba(255,255,255,0.62);
}

/* Buttons */
.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.app-btn:disabled, .app-btn.is-disabled { opacity: 0.5; cursor: not-allowed; }

.app-btn-primary {
  background: linear-gradient(145deg, rgba(123,24,24,0.88), rgba(84,20,24,0.70));
  color: rgba(255,255,255,0.96);
  border-color: rgba(255,255,255,0.34);
  box-shadow: 0 14px 30px rgba(52,10,13,0.16), inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -16px 24px rgba(52,10,13,0.16);
}
.app-btn-primary:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(123,24,24,0.94), rgba(84,20,24,0.78));
}

.app-btn-secondary {
  background: linear-gradient(145deg, rgba(255,255,255,0.42), rgba(255,255,255,0.20));
  color: var(--text-2, #5a5550);
  border-color: rgba(255,255,255,0.58);
  box-shadow: 0 10px 22px rgba(52,10,13,0.055), inset 0 1px 0 rgba(255,255,255,0.64), inset 0 -14px 22px rgba(123,24,24,0.03);
}
.app-btn-secondary:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(255,255,255,0.54), rgba(255,255,255,0.28));
  color: var(--brand, #340A0D);
}

.app-btn-success {
  background: linear-gradient(145deg, rgba(26,122,74,0.82), rgba(20,99,59,0.60));
  color: rgba(255,255,255,0.96);
  border-color: rgba(255,255,255,0.34);
  box-shadow: 0 14px 30px rgba(26,122,74,0.14), inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -16px 24px rgba(20,99,59,0.14);
}
.app-btn-success:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(26,122,74,0.90), rgba(20,99,59,0.68));
}

.app-btn-danger {
  background: linear-gradient(145deg, rgba(185,28,28,0.82), rgba(153,27,27,0.60));
  color: rgba(255,255,255,0.96);
  border-color: rgba(255,255,255,0.34);
  box-shadow: 0 14px 30px rgba(185,28,28,0.14), inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -16px 24px rgba(153,27,27,0.14);
}
.app-btn-danger:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(185,28,28,0.90), rgba(153,27,27,0.68));
}

.app-btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   10. Utility helpers
   -------------------------------------------------------------------------- */
.app-hide { display: none !important; }
.app-w-full { width: 100%; }
