/* =========================================================================
   Data table component (Land Availability) — search, filters, sort, columns, pagination
   ========================================================================= */
.av { position: relative; }
.av-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.avs { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.avs::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); }
.avs-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 25px; color: #fff; flex: none; background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: 0 14px 22px -12px var(--c1), inset 0 2px 0 rgba(255,255,255,.35); }
.avs b { display: block; font-family: var(--font-head); font-size: 1.7rem; line-height: 1.05; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; } .avs small { color: var(--text-muted); font-size: .78rem; line-height: 1.3; display: block; }
.avs-win { color: var(--success); }

.dt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow-lg); overflow: visible; position: relative; }
.dt-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 16px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.dt-search { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; max-width: 520px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--bg-alt); border: 1px solid var(--border); transition: border-color .25s, box-shadow .25s, background .25s; }
.dt-search:focus-within { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.dt-search i { color: var(--text-muted); font-size: 18px; } .dt-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--text); }
.dt-x { border: 0; background: var(--border); color: var(--text); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0; } .dt-x[hidden] { display: none; }
.dt-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-fbtn em { font-style: normal; background: var(--primary); color: #fff; border-radius: 99px; font-size: .68rem; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; } .dt-fbtn em[hidden] { display: none; }
.dt-menu { position: relative; }
.dt-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 270px; max-height: 360px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-lg); display: grid; gap: 2px; } .dt-pop[hidden] { display: none; }
.dt-pop .check { padding: 6px 8px; border-radius: 8px; } .dt-pop .check:hover { background: var(--bg-alt); }
.dt-presets { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px dashed var(--border); } .dt-presets button { border: 1px solid var(--border); background: var(--bg-alt); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: .74rem; font-weight: 600; cursor: pointer; color: var(--text); } .dt-presets button:hover { border-color: var(--primary); color: var(--primary); }
.dt-dens button { padding: 0 10px; }

.dt-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg-alt) 55%, transparent); }
.dt-f { display: grid; gap: 4px; font-size: .72rem; font-weight: 700; color: var(--text-muted); letter-spacing: .03em; text-transform: uppercase; } .dt-f .select, .dt-f .input { height: 40px; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .86rem; }
.dt-rng { display: flex; align-items: center; gap: 6px; } .dt-rng .input { min-width: 0; width: 100%; } .dt-rng i { font-style: normal; color: var(--text-muted); }
.dt-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px; } .dt-chips:not(:empty) { padding: 12px 18px 2px; }
.dt-chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); color: var(--text); border-radius: 99px; padding: 5px 8px 5px 12px; font: inherit; font-size: .78rem; cursor: pointer; transition: background .25s; } .dt-chip:hover { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); } .dt-chip b { color: var(--primary); font-weight: 700; } .dt-chip i { font-size: 15px; }
.dt-clear { border: 0; background: none; color: var(--primary); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; text-decoration: underline; padding: 5px 6px; }

.dt-wrap { overflow: auto; max-height: min(72vh, 760px); position: relative; margin-top: 12px; border-top: 1px solid var(--border); scrollbar-width: thin; }
.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; } .dt[hidden] { display: none; }
.dt thead th { position: sticky; top: 0; z-index: 3; background: color-mix(in srgb, var(--bg-alt) 92%, var(--surface)); color: var(--text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; text-align: left; padding: 13px 14px; white-space: nowrap; border-bottom: 1px solid var(--border); user-select: none; }
.dt thead th.num, .dt td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt th.sortable { cursor: pointer; transition: color .2s, background .2s; } .dt th.sortable:hover { color: var(--primary); background: var(--primary-50); }
.dt th.sortable i { margin-left: 5px; font-size: 14px; vertical-align: -2px; opacity: .45; } .dt th.sorted { color: var(--primary); } .dt th.sorted i { opacity: 1; }
.dt td { padding: 12px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); vertical-align: middle; white-space: nowrap; }
.dt tbody tr { transition: background .2s; } .dt tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.dt tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-alt) 40%, transparent); } .dt tbody tr:nth-child(even):hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.dt.tight td { padding: 7px 12px; } .dt.tight th { padding: 9px 12px; }
.dt th:nth-child(1), .dt td:nth-child(1) { width: 56px; color: var(--text-muted); }
.dt th:nth-child(2), .dt td:nth-child(2) { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); } .dt thead th:nth-child(2) { z-index: 4; background: color-mix(in srgb, var(--bg-alt) 92%, var(--surface)); }
.dt tbody tr:hover td:nth-child(2) { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.dt-ia b { display: block; font-size: .88rem; line-height: 1.2; max-width: 280px; overflow: hidden; text-overflow: ellipsis; } .dt-ia small { display: flex; gap: 4px; align-items: center; color: var(--text-muted); font-size: .72rem; margin-top: 2px; }
.dt-plot { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-weight: 700; font-size: .8rem; background: var(--bg-alt); border: 1px solid var(--border); padding: 3px 9px; border-radius: 8px; }
.pol { font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 99px; } .pol-green { background: #DCFCE7; color: #166534; } .pol-orange { background: #FFEDD5; color: #9A3412; } .pol-red { background: #FEE2E2; color: #991B1B; } .pol-white { background: #F1F5F9; color: #334155; } .pol-blue { background: #DBEAFE; color: #1E40AF; }
[data-theme="midnight"] .pol { filter: brightness(.9); }
.dt-act { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.dt-ib { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); font-size: 16px; transition: background .25s, color .25s, transform .25s; } .dt-ib:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.dt-empty { display: grid; justify-items: center; gap: 6px; padding: 52px 16px; text-align: center; color: var(--text-muted); } .dt-empty[hidden] { display: none; } .dt-empty i { font-size: 44px; color: var(--primary); } .dt-empty b { color: var(--text); font-size: 1.05rem; }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); font-size: .84rem; color: var(--text-muted); }
.dt-pp { display: inline-flex; align-items: center; gap: 8px; } .dt-pp .select { width: auto; height: 36px; padding-block: 0; }
.dt-info b { color: var(--text); } .dt-info em { font-style: normal; opacity: .8; }
.dt-pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dt-pager button { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .84rem; cursor: pointer; display: inline-grid; place-items: center; transition: background .2s, color .2s, border-color .2s, transform .2s; }
.dt-pager button:hover:not(:disabled):not(.on) { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); } .dt-pager button.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 16px -8px var(--primary); } .dt-pager button:disabled { opacity: .4; cursor: not-allowed; } .dt-pager .gap { padding: 0 4px; }

/* ---- responsive ---- */
.dt-fbtn { display: none; }
@media (max-width: 1000px) { .av-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .av-stats { gap: 10px; } .avs { padding: 12px; gap: 10px; border-radius: 18px; } .avs-ic { width: 42px; height: 42px; font-size: 20px; border-radius: 13px; } .avs b { font-size: 1.3rem; } .avs small { font-size: .68rem; }
  .dt-card { border-radius: 20px; } .dt-top { padding: 12px; } .dt-search { max-width: none; flex-basis: 100%; }
  .dt-tools { width: 100%; justify-content: space-between; } .dt-tools .btn span { display: none; } .dt-dens { display: none; }
  .dt-fbtn { display: inline-flex; }
  .dt-filters { display: none; grid-template-columns: 1fr 1fr; padding: 12px; } .dt-filters.open { display: grid; }
  .dt-chips:not(:empty) { padding: 10px 12px 0; } .dt-pop { right: auto; left: 0; width: min(280px, 86vw); }
  /* table → cards */
  .dt-wrap { max-height: none; border-top: 0; overflow: visible; margin-top: 10px; padding: 0 12px; }
  .dt, .dt tbody { display: block; } .dt thead { display: none; }
  .dt tbody tr, .dt tbody tr:nth-child(even) { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding: 14px 14px 10px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
  .dt td, .dt td:nth-child(1), .dt td:nth-child(2) { display: block; position: static; width: auto; padding: 6px 0; border: 0; box-shadow: none; background: none; white-space: normal; text-align: left !important; }
  .dt td::before { content: attr(data-label); display: block; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 1px; }
  .dt td:nth-child(1) { display: none; } .dt td:nth-child(2) { grid-column: 1 / -1; padding-bottom: 8px; border-bottom: 1px dashed var(--border); margin-bottom: 4px; } .dt td:nth-child(2)::before { display: none; }
  .dt td:last-child { grid-column: 1 / -1; padding-top: 10px; border-top: 1px dashed var(--border); margin-top: 6px; } .dt td:last-child::before { display: none; } .dt td:last-child .dt-act { justify-content: space-between; } .dt td:last-child .btn { flex: 1; justify-content: center; }
  .dt-ia b { max-width: none; font-size: 1rem; }
  .dt-foot { flex-direction: column; align-items: stretch; text-align: center; } .dt-pp { justify-content: center; } .dt-pager { justify-content: center; }
}
