/* ═══════════════════════════════════════════════════
   NIS – Shared Styles
   ═══════════════════════════════════════════════════ */

:root {
  --bg: #f5efe4;
  --bg-accent: #e7dcc6;
  --panel: #fffdf7;
  --text: #1f2a1f;
  --muted: #5f6e61;
  --line: #d6ccb7;
  --brand: #2f7f63;
  --brand-soft: #d8efe6;
  --warn: #a34c3a;
  --ok: #1f7a4f;
  --shadow: 0 12px 30px rgba(31, 42, 31, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, rgba(47, 127, 99, 0.16), transparent 35%),
    radial-gradient(circle at 85% 20%, rgba(163, 76, 58, 0.14), transparent 34%),
    linear-gradient(180deg, var(--bg) 0%, #efe6d6 100%);
  padding: 24px;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  position: relative;
  animation: reveal 360ms ease-out;
}

/* ── Hero / Header ──────────────────────────────── */

.hero {
  padding: 24px;
  background: linear-gradient(135deg, rgba(255, 253, 247, 0.94), rgba(255, 253, 247, 0.78));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.8vw, 2.1rem);
  letter-spacing: 0.02em;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.hero.hidden { display: none; }

.header-collapsed .hero { display: none; }

/* ── Floating Corner Actions ────────────────────── */

.floating-corner-actions {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.floating-header-toggle,
.floating-home-link {
  width: 36px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.95);
  color: #3f4f42;
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  text-decoration: none;
  transform: translate(-50%, -50%);
}

.floating-header-toggle::before,
.floating-home-link::before {
  content: "";
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex-shrink: 0;
}

.floating-header-toggle::before {
  background-image: url("/img/menu-burger.png");
}

.floating-home-link::before {
  background-image: url("/img/home.png");
}

/* ── Buttons ────────────────────────────────────── */

.btn {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn.brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ── Controls / Filters ─────────────────────────── */

.controls {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control label {
  font-size: 0.85rem;
  color: var(--muted);
}

.control input[type="search"] {
  width: 100%;
  font: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  min-height: 44px;
  padding: 0 12px;
}

.search { grid-column: span 8; }

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--panel);
}

.checkbox-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.checkbox-control span {
  font-size: 0.9rem;
}

/* ── Summary Chips ──────────────────────────────── */

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.83rem;
  color: var(--muted);
}

/* ── Panel / Table ──────────────────────────────── */

.panel {
  background: rgba(255, 253, 247, 0.92);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

thead th {
  position: sticky;
  top: 0;
  background: #f0e6d2;
  text-align: left;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3b4b3d;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  white-space: normal;
  user-select: none;
}

thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--brand); }

tbody tr {
  border-bottom: 1px solid rgba(214, 204, 183, 0.6);
  background: rgba(255, 253, 247, 0.5);
  transition: background-color 220ms ease, color 220ms ease;
}

tbody tr:hover { background: rgba(216, 239, 230, 0.35); }

td {
  padding: 10px;
  font-size: 0.92rem;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86rem;
}

/* ── Tags ───────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.76rem;
  border: 1px solid var(--line);
  background: #fff;
  white-space: nowrap;
}

.tag.ok {
  border-color: rgba(31, 122, 79, 0.35);
  color: var(--ok);
  background: rgba(31, 122, 79, 0.1);
}

.tag.warn {
  border-color: rgba(163, 76, 58, 0.35);
  color: var(--warn);
  background: rgba(163, 76, 58, 0.1);
}

/* ── Column Menu ────────────────────────────────── */

.summary-title {
  min-width: 0;
  font-weight: 700;
  font-size: 0.88rem;
  color: #3f4f42;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.column-menu {
  position: relative;
  flex-shrink: 0;
}

.column-menu-btn {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
  display: inline-grid;
  place-content: center;
  color: #3f4f42;
}

.column-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: min(92vw, 320px);
  z-index: 50;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  padding: 10px;
  display: none;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}

.column-menu.open .column-menu-panel { display: block; }

.column-menu-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 0.83rem;
  color: #3f4f42;
  cursor: pointer;
}

.column-menu-option input { margin: 0; }

/* ── Status / Spinner ───────────────────────────── */

.status {
  margin: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255, 253, 247, 0.9);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(47, 127, 99, 0.25);
  border-top-color: var(--brand);
  animation: spin 900ms linear infinite;
  flex-shrink: 0;
}

/* ── Floating Refresh Button ────────────────────── */

.floating-refresh {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1200;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.95);
  color: #3f4f42;
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 0.8rem;
  padding: 0 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(2px);
}

.floating-refresh::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7d8b80;
  flex-shrink: 0;
}

.floating-refresh.is-loading {
  border-color: rgba(47, 127, 99, 0.45);
  background: rgba(216, 239, 230, 0.95);
  color: #255f4b;
}

.floating-refresh.is-loading::before {
  background: var(--brand);
  animation: pulse 1s ease-in-out infinite;
}

.floating-refresh.is-success {
  border-color: rgba(31, 122, 79, 0.45);
  background: rgba(31, 122, 79, 0.12);
  color: #1f7a4f;
}

.floating-refresh.is-success::before { background: #1f7a4f; }

.floating-refresh.is-error {
  border-color: rgba(163, 76, 58, 0.45);
  background: rgba(163, 76, 58, 0.12);
  color: #a34c3a;
}

.floating-refresh.is-error::before { background: #a34c3a; }

/* ── Animations ─────────────────────────────────── */

@keyframes reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

/* ── Column Visibility Helpers ──────────────────── */

.always-visible-col { display: table-cell !important; }
.force-hidden-col { display: none !important; }
