@font-face {
  font-family: "Graphik Web";
  src:
    url("/fonts/graphik/Graphik-Regular-Web.woff2") format("woff2"),
    url("/fonts/graphik/Graphik-Regular-Web.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Graphik Web";
  src:
    url("/fonts/graphik/Graphik-Semibold-Web.woff2") format("woff2"),
    url("/fonts/graphik/Graphik-Semibold-Web.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Graphik Web";
  src:
    url("/fonts/graphik/Graphik-Bold-Web.woff2") format("woff2"),
    url("/fonts/graphik/Graphik-Bold-Web.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Graphik Web";
  src:
    url("/fonts/graphik/Graphik-Super-Web.woff2") format("woff2"),
    url("/fonts/graphik/Graphik-Super-Web.woff") format("woff");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font-sans: "Graphik Web", "Graphik", "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --attvin-purple: #5c3cb5;
  --attvin-purple-dark: #392080;
  --attvin-purple-light: #efecf8;
  --attvin-yellow: #ffd80a;
  --attvin-yellow-light: #fff4cc;
  --attvin-blue: #0065c1;
  --attvin-blue-light: #cce0f3;
  --attvin-red: #fd5443;
  --attvin-red-light: #f7d5d1;
  --attvin-green: #3fc564;
  --attvin-green-light: #d9f3e0;
  --attvin-black: #231f20;
  --bg: #efecf8;
  --surface: #ffffff;
  --surface-alt: #ded8f0;
  --ink: var(--attvin-black);
  --muted: rgba(35, 31, 32, 0.68);
  --accent: var(--attvin-purple);
  --accent-2: var(--attvin-yellow);
  --accent-3: var(--attvin-blue);
  --tool-accent: var(--attvin-purple);
  --tool-accent-dark: var(--attvin-purple-dark);
  --tool-accent-soft: rgba(92, 60, 181, 0.18);
  --tool-active-bg: var(--attvin-purple-light);
  --tool-border: rgba(92, 60, 181, 0.18);
  --tool-ring: 0 0 0 3px rgba(92, 60, 181, 0.24);
  --danger: #c71d0c;
  --success: #25763c;
  --shadow: 0 20px 50px rgba(57, 32, 128, 0.18);
  --radius: 18px;
  --radius-lg: 28px;
  --ring: var(--tool-ring);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 10%, rgba(0, 101, 193, 0.12), transparent 42%),
    radial-gradient(circle at 12% 88%, rgba(255, 216, 10, 0.18), transparent 44%),
    linear-gradient(132deg, #efecf8 16%, #ded8f0 58%, #fff4cc 100%);
}

body[data-tool="portal"] {
  --tool-accent: var(--attvin-blue);
  --tool-accent-dark: #004382;
  --tool-accent-soft: rgba(0, 101, 193, 0.2);
  --tool-active-bg: rgba(204, 224, 243, 0.88);
  --tool-border: rgba(0, 101, 193, 0.2);
  --tool-ring: 0 0 0 3px rgba(0, 101, 193, 0.24);
}

body[data-tool="avfallsportal"] {
  --tool-accent: #25763c;
  --tool-accent-dark: #1a542b;
  --tool-accent-soft: rgba(63, 197, 100, 0.22);
  --tool-active-bg: rgba(217, 243, 224, 0.92);
  --tool-border: rgba(63, 197, 100, 0.26);
  --tool-ring: 0 0 0 3px rgba(63, 197, 100, 0.24);
}

body[data-tool="lager"] {
  --tool-accent: var(--attvin-purple);
  --tool-accent-dark: var(--attvin-purple-dark);
  --tool-accent-soft: rgba(92, 60, 181, 0.2);
  --tool-active-bg: rgba(239, 236, 248, 0.92);
  --tool-border: rgba(92, 60, 181, 0.2);
  --tool-ring: 0 0 0 3px rgba(92, 60, 181, 0.24);
}

body[data-tool="access"] {
  --tool-accent: var(--attvin-red);
  --tool-accent-dark: #c71d0c;
  --tool-accent-soft: rgba(253, 84, 67, 0.2);
  --tool-active-bg: rgba(247, 213, 209, 0.9);
  --tool-border: rgba(253, 84, 67, 0.24);
  --tool-ring: 0 0 0 3px rgba(253, 84, 67, 0.24);
}

body[data-tool="avtalesok"] {
  --tool-accent: var(--attvin-green);
  --tool-accent-dark: #25763c;
  --tool-accent-soft: rgba(63, 197, 100, 0.22);
  --tool-active-bg: rgba(217, 243, 224, 0.92);
  --tool-border: rgba(63, 197, 100, 0.24);
  --tool-ring: 0 0 0 3px rgba(63, 197, 100, 0.24);
}

body[data-tool="basisadmin"] {
  --tool-accent: var(--attvin-blue);
  --tool-accent-dark: #004382;
  --tool-accent-soft: rgba(0, 101, 193, 0.22);
  --tool-active-bg: rgba(204, 224, 243, 0.88);
  --tool-border: rgba(0, 101, 193, 0.24);
  --tool-ring: 0 0 0 3px rgba(0, 101, 193, 0.24);
}

body[data-tool="basisoverview"] {
  --tool-accent: var(--attvin-green);
  --tool-accent-dark: #25763c;
  --tool-accent-soft: rgba(63, 197, 100, 0.22);
  --tool-active-bg: rgba(217, 243, 224, 0.9);
  --tool-border: rgba(63, 197, 100, 0.24);
  --tool-ring: 0 0 0 3px rgba(63, 197, 100, 0.24);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 28px;
}

.login-shell {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-sidebar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(35, 31, 32, 0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 24px;
  height: fit-content;
}

.sidebar-utility {
  margin-bottom: -6px;
}

.sidebar-home-link {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(35, 31, 32, 0.1);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--ink);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.sidebar-home-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(35, 31, 32, 0.08);
}

.sidebar-home-link.is-active {
  background: rgba(92, 60, 181, 0.12);
  border-color: rgba(92, 60, 181, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand.brand-system {
  justify-content: center;
}

.brand-system-logo {
  width: min(100%, 180px);
  height: auto;
  display: block;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--tool-accent);
  border: 1px solid rgba(239, 236, 248, 0.4);
  padding: 8px;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-title {
  font-size: 21px;
  font-weight: 700;
  font-family: var(--font-sans);
}

.brand-sub,
.muted {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.admin-nav {
  display: grid;
  gap: 10px;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-group-list {
  display: none;
  gap: 6px;
  padding-left: 10px;
}

.nav-group.is-open .nav-group-list {
  display: grid;
}

.nav-group-title {
  margin: 0;
}

.nav-item {
  border: none;
  background: rgba(35, 31, 32, 0.04);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-item-icon {
  width: 18px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: rgba(35, 31, 32, 0.74);
  opacity: 1;
}

.nav-sub-item {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 12px;
}

.nav-sub-item .nav-item-icon {
  width: 16px;
  min-width: 16px;
  height: 16px;
  font-size: 16px;
}

.nav-link {
  text-decoration: none;
}

.nav-section-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 2px 0;
}

.nav-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(35, 31, 32, 0.1);
}

.nav-item.is-active {
  background: var(--tool-active-bg);
  box-shadow:
    inset 0 0 0 1px var(--tool-border),
    0 8px 18px var(--tool-accent-soft);
}

.nav-item.is-disabled {
  opacity: 0.56;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.sidebar-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.sidebar-panel.note {
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

.account-panel {
  gap: 12px;
}

.account-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.account-meta {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.account-actions {
  display: grid;
  gap: 8px;
}

.account-avatar,
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(35, 31, 32, 0.1);
  border: 1px solid rgba(35, 31, 32, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 600;
  color: rgba(35, 31, 32, 0.72);
  font-size: 14px;
  text-transform: uppercase;
}

.account-avatar img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar img.is-hidden,
.profile-avatar img.is-hidden {
  display: none;
}

.profile-modal-card {
  width: min(640px, 95vw);
}

.internal-user-modal-card {
  width: min(760px, 95vw);
}

.profile-avatar-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.profile-avatar {
  width: 56px;
  height: 56px;
}

.profile-avatar-actions {
  display: grid;
  gap: 6px;
}

#profile-avatar-file.is-hidden {
  display: none !important;
}

.panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted);
  font-weight: 500;
}

.role-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(0, 101, 193, 0.15);
  color: #004382;
}

.role-pill.admin {
  background: rgba(92, 60, 181, 0.2);
  color: #392080;
}

.ghost-btn {
  border: 1px solid var(--tool-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  display: block;
  width: 100%;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.ghost-btn:hover {
  box-shadow: 0 8px 18px rgba(35, 31, 32, 0.11);
}

.ghost-btn.inline-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-btn {
  border: none;
  border-radius: 16px;
  background: var(--tool-accent);
  color: #fff;
  font-weight: 500;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(57, 32, 128, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tool-open-btn {
  min-width: 138px;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.btn-icon {
  font-size: 16px;
  line-height: 1;
}

.primary-btn:hover {
  background: var(--tool-accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px var(--tool-accent-soft);
}

.primary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary-btn.danger-btn {
  background: var(--attvin-red);
}

.primary-btn.danger-btn:hover {
  background: #c71d0c;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-top {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(92, 60, 181, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.admin-top h1 {
  margin: 4px 0 8px;
  font-size: clamp(2.1rem, 1.62rem + 1.85vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  font-weight: 700;
}

.admin-top p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 580px;
}

.admin-top .form-card {
  margin-top: 16px;
  max-width: 760px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 11px;
  color: var(--tool-accent-dark);
  font-weight: 500;
}

.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  background: #fff;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: inset 0 0 0 1px var(--tool-border);
}

.search input {
  border: none;
  outline: none;
  font-size: 15px;
  width: 220px;
  font-family: inherit;
}

.admin-view {
  background: rgba(255, 255, 255, 0.91);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--tool-border);
  display: grid;
  gap: 16px;
  animation: rise 0.55s ease;
}

.admin-view.is-hidden,
.role-hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal.is-hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(57, 32, 128, 0.48);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(980px, 95vw);
  max-height: 90vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.modal-form {
  margin: 0;
}

.modal-close-btn {
  width: auto;
}

.modal-alert {
  display: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(0, 101, 193, 0.12);
  color: #004382;
  border: 1px solid rgba(0, 101, 193, 0.24);
}

.modal-alert.is-visible {
  display: block;
}

.modal-alert.is-error {
  background: rgba(253, 84, 67, 0.12);
  color: #c71d0c;
  border-color: rgba(253, 84, 67, 0.28);
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.view-head h2,
.sub-head h3 {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  letter-spacing: -0.015em;
}

.view-head h2 {
  font-size: clamp(1.7rem, 1.32rem + 1.1vw, 2.4rem);
  line-height: 1.12;
  font-weight: 700;
}

.sub-head h3 {
  font-size: clamp(1.2rem, 1.06rem + 0.6vw, 1.6rem);
  line-height: 1.18;
  font-weight: 700;
}

.view-head p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.45;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.metric-card {
  background: rgba(239, 236, 248, 0.66);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 4px;
}

.metric-grid .metric-card:nth-child(5n + 1) {
  background: rgba(239, 236, 248, 0.75);
}

.metric-grid .metric-card:nth-child(5n + 2) {
  background: rgba(255, 244, 204, 0.75);
}

.metric-grid .metric-card:nth-child(5n + 3) {
  background: rgba(204, 224, 243, 0.75);
}

.metric-grid .metric-card:nth-child(5n + 4) {
  background: rgba(217, 243, 224, 0.76);
}

.metric-grid .metric-card:nth-child(5n + 5) {
  background: rgba(247, 213, 209, 0.72);
}

.metric-label {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 500;
}

.metric-value {
  font-size: clamp(1.45rem, 1.2rem + 0.7vw, 1.8rem);
  font-weight: 500;
  line-height: 1.15;
}

.metric-value .currency-suffix {
  font-size: 0.54em;
  font-weight: 400;
  margin-left: 0.18em;
  opacity: 0.75;
}

.metric-meta {
  font-size: 12px;
  color: var(--muted);
}

.form-card,
.sub-card {
  background: rgba(239, 236, 248, 0.88);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.movement-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  min-width: 0;
}

.form-field span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted);
  font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(92, 60, 181, 0.16);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
}

#movement-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-field textarea {
  min-height: 90px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  box-shadow: var(--ring);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(92, 60, 181, 0.22);
  background: #fff;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.chip:hover {
  background: rgba(92, 60, 181, 0.12);
}

.chip.is-active {
  background: var(--tool-active-bg);
  border-color: var(--tool-border);
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 16px;
  padding: 6px;
  box-shadow: inset 0 0 0 1px var(--tool-border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  text-align: left;
  font-size: 14px;
  line-height: 1.35;
  border-bottom: 1px solid rgba(92, 60, 181, 0.12);
  vertical-align: top;
}

.admin-table th {
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}

.admin-table td strong {
  font-weight: 400;
}

.admin-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}

.admin-table th.sortable-th::after {
  content: "↕";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: rgba(35, 31, 32, 0.45);
}

.admin-table th.sortable-th.is-sorted-asc::after {
  content: "↑";
  color: var(--accent);
}

.admin-table th.sortable-th.is-sorted-desc::after {
  content: "↓";
  color: var(--accent);
}

.admin-table tbody tr:hover {
  background: rgba(239, 236, 248, 0.7);
}

.candidate-row.is-selected td {
  background: rgba(204, 224, 243, 0.42);
}

.candidate-action-btn {
  white-space: nowrap;
}

.agreement-row.is-selected td {
  background: rgba(63, 197, 100, 0.16);
}

#calendar-toggle-btn.is-hidden {
  display: none !important;
}

.item-row {
  cursor: pointer;
}

.item-row.is-selected {
  background: rgba(92, 60, 181, 0.15) !important;
}

.item-detail-content.is-hidden {
  display: none;
}

.item-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.status.open {
  background: rgba(255, 216, 10, 0.25);
  color: #ccac08;
}

.status.closed {
  background: rgba(63, 197, 100, 0.2);
  color: var(--success);
}

.status.archived {
  background: rgba(0, 101, 193, 0.14);
  color: #004382;
}

.tag {
  display: inline-flex;
  margin: 2px 5px 2px 0;
  border-radius: 999px;
  background: rgba(222, 216, 240, 0.9);
  color: #392080;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
}

.image-thumb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  padding: 4px;
  border: 1px solid rgba(92, 60, 181, 0.15);
  background: #fff;
}

.icon-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  padding: 3px;
  border: 1px solid rgba(92, 60, 181, 0.18);
  background: #fff;
}

.image-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(92, 60, 181, 0.14);
}

.image-choice {
  border: 1px solid rgba(92, 60, 181, 0.18);
  background: #fff;
  border-radius: 10px;
  padding: 6px;
  display: grid;
  gap: 5px;
  cursor: pointer;
  text-align: left;
}

.image-choice img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.image-choice span {
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-choice.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(92, 60, 181, 0.22);
}

.image-upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.image-preview {
  width: min(100%, 360px);
  max-height: 220px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(92, 60, 181, 0.18);
  background: #fff;
  padding: 6px;
}

.image-preview.is-hidden {
  display: none;
}

.table-input,
.table-note {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(92, 60, 181, 0.16);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.table-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.table-input:focus,
.table-note:focus {
  outline: none;
  box-shadow: var(--ring);
}

.table-note {
  min-width: 180px;
}

.basis-split {
  display: grid;
  grid-template-columns: minmax(320px, 1.12fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.basis-list-wrap {
  display: grid;
  gap: 10px;
}

.basis-list {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--tool-border);
  max-height: 66vh;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.basis-row {
  border: 1px solid rgba(0, 101, 193, 0.18);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 8px;
}

.basis-row:hover {
  background: rgba(204, 224, 243, 0.35);
}

.basis-row.is-selected {
  background: rgba(204, 224, 243, 0.72);
  border-color: rgba(0, 101, 193, 0.42);
}

.basis-row-top,
.basis-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.basis-detail {
  display: grid;
  gap: 10px;
  align-content: start;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 4px;
}

.basis-detail-card {
  display: grid;
  gap: 10px;
}

.basis-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.basis-summary-main {
  display: grid;
  gap: 2px;
  min-width: 220px;
}

.basis-summary-main h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
}

.basis-summary-meta {
  font-size: 13px;
}

.basis-summary-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.basis-inline-files {
  display: grid;
  gap: 6px;
}

.basis-files-table th,
.basis-files-table td {
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12px;
}

.basis-detail-table td {
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 13px;
}

.basis-detail-table td.metric-label {
  width: 150px;
  white-space: nowrap;
}

.basis-detail-table td:last-child {
  word-break: break-word;
}

.basis-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.basis-kv-item {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--tool-border);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}

.basis-kv-item span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.basis-kv-item strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.basis-detail-actions {
  justify-content: flex-start;
  gap: 8px;
}

.basis-action-btn {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 18px rgba(35, 31, 32, 0.08);
}

.delete-confirm-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--tool-border);
  border-radius: 10px;
  padding: 10px 12px;
  width: fit-content;
}

.delete-confirm-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--attvin-red);
}

.delete-confirm-row span {
  font-size: 13px;
}

.basis-validity {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
}

.basis-validity.green {
  background: rgba(63, 197, 100, 0.2);
  color: #25763c;
}

.basis-validity.amber {
  background: rgba(255, 216, 10, 0.24);
  color: #a88a00;
}

.basis-validity.red {
  background: rgba(253, 84, 67, 0.2);
  color: #c71d0c;
}

.basis-validity.gray {
  background: rgba(35, 31, 32, 0.1);
  color: rgba(35, 31, 32, 0.75);
}

.tag.basis-status-approved {
  background: rgba(63, 197, 100, 0.2);
  color: #25763c;
}

.tag.basis-status-pending {
  background: rgba(0, 101, 193, 0.16);
  color: #004382;
}

.tag.basis-status-needs {
  background: rgba(255, 216, 10, 0.24);
  color: #8f7600;
}

.tag.basis-status-rejected {
  background: rgba(253, 84, 67, 0.2);
  color: #c71d0c;
}

.tag.basis-status-archived {
  background: rgba(35, 31, 32, 0.12);
  color: rgba(35, 31, 32, 0.78);
}

.action-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: rgba(92, 60, 181, 0.16);
  color: #392080;
}

.action-btn.secondary {
  background: rgba(0, 101, 193, 0.14);
  color: #004382;
}

.import-stats {
  font-size: 14px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #25763c;
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 40;
  max-width: min(90vw, 420px);
  font-size: 14px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.action-field.is-hidden {
  display: none !important;
}

.api-response {
  margin: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(92, 60, 181, 0.15);
  padding: 12px;
  overflow: auto;
  max-height: 420px;
  font-size: 12px;
  line-height: 1.45;
}

.stream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.source-card {
  min-height: 320px;
  align-content: start;
}

.source-card h3 {
  margin: 0;
}

.source-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status.status-pending {
  background: rgba(35, 31, 32, 0.1);
  color: rgba(35, 31, 32, 0.78);
}

.status.status-ok {
  background: rgba(63, 197, 100, 0.2);
  color: #25763c;
}

.status.status-skipped {
  background: rgba(255, 216, 10, 0.24);
  color: #8f7600;
}

.status.status-error {
  background: rgba(253, 84, 67, 0.2);
  color: #c71d0c;
}

.stream-raw {
  max-height: 280px;
}

.stream-log {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.stream-log-item {
  display: grid;
  gap: 6px;
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--tool-border);
}

.stream-log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.stream-log-payload {
  max-height: 180px;
}

.compose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.compose-top-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.compose-top-card .sub-head {
  min-height: 34px;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--tool-border);
  font-size: 13px;
}

.summary-row strong {
  font-weight: 500;
}

.compose-loading-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-radius: 10px;
  border: 1px solid var(--tool-border);
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  font-size: 13px;
}

.compose-loading-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--tool-accent);
  animation: composePulse 1s ease-in-out infinite;
}

@keyframes composePulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.raw-source-list {
  display: grid;
  gap: 10px;
}

.raw-source-item {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--tool-border);
  padding: 10px;
}

.raw-source-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.raw-source-item summary::-webkit-details-marker {
  display: none;
}

.compose-check-grid {
  grid-template-columns: 1fr;
}

.compose-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.waste-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  margin: 2px 6px 2px 0;
  background: rgba(239, 236, 248, 0.9);
  border: 1px solid var(--tool-border);
  font-size: 12px;
  white-space: nowrap;
}

.waste-pill img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.agreement-role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.agreement-role-pill.is-owner {
  background: #e7f7ea;
  border-color: #8fd3a0;
  color: #205f2d;
}

.agreement-role-pill.is-resident {
  background: #e6f2ff;
  border-color: #9cc6ef;
  color: #17446e;
}

.agreement-role-pill.is-shared {
  background: #f4ecff;
  border-color: #c9b0ef;
  color: #5e2d8b;
}

.consent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.consent-pill.is-granted {
  background: #e7f7ea;
  border-color: #8fd3a0;
  color: #205f2d;
}

.consent-pill.is-missing {
  background: #fdeceb;
  border-color: #e8a9a2;
  color: #8f2418;
}

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

@media (max-width: 1080px) {
  .admin-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .admin-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .search input {
    width: 100%;
    min-width: 220px;
  }
}

@media (max-width: 720px) {
  .admin-top h1 {
    font-size: 26px;
  }

  .admin-view {
    padding: 16px;
  }

  .form-grid,
  .movement-grid {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions > * {
    flex: 1;
    min-width: 120px;
  }

  .nav-group-list {
    padding-left: 6px;
  }

  .basis-split {
    grid-template-columns: 1fr;
  }

  .basis-detail {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .basis-list {
    max-height: 48vh;
  }
}
