:root {
  --bg: #f3efe6;
  --card: #fffdf8;
  --line: #ded6c7;
  --text: #1e3038;
  --muted: #5d7078;
  --main: #0f8c7d;
  --main-strong: #0b6d61;
  --warn: #b67818;
  --danger: #b64031;
  --ok: #187a57;
  --info: #2f5ea8;
  --shadow: 0 18px 38px rgba(16, 38, 54, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #f8f3e8 0%, #efe6d6 44%, #eadfcb 100%);
  padding: 1rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
}

p {
  margin: 0;
}

code {
  background: #efe6d6;
  border-radius: 0.4rem;
  padding: 0.05rem 0.35rem;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(26px);
  pointer-events: none;
  z-index: -1;
}

.bg-a {
  width: 20rem;
  height: 20rem;
  right: -5rem;
  top: -5rem;
  background: rgba(15, 140, 125, 0.24);
}

.bg-b {
  width: 22rem;
  height: 22rem;
  left: -6rem;
  bottom: -6rem;
  background: rgba(202, 116, 83, 0.24);
}

.topbar,
.layout {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.link-btn {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
}

.layout {
  margin-top: 1rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.login-card {
  width: min(520px, 100%);
  margin: 0 auto;
}

.form-grid,
.create-grid {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.7rem;
}

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

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.5rem 0.6rem;
  background: #fff;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.52rem 0.8rem;
  font-weight: 600;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.btn-main {
  border-color: var(--main);
  background: var(--main);
  color: #fff;
}

.btn-main:hover {
  background: var(--main-strong);
}

.btn-soft {
  background: #e5f5f1;
  border-color: #b6d9d0;
}

.btn-danger {
  border-color: #e2b7b0;
  background: #f9ebe9;
  color: var(--danger);
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.small {
  font-size: 0.78rem;
}

.app-grid {
  display: grid;
  gap: 0.9rem;
}

.app-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.head-actions {
  display: flex;
  gap: 0.55rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filters input,
.filters select {
  min-width: 10.5rem;
}

.check-inline {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  background: #fff;
  font-size: 0.82rem;
}

.check-inline input {
  width: auto;
  margin: 0;
}

.create-panel {
  margin-bottom: 0.8rem;
  border: 1px dashed var(--line);
  border-radius: 0.8rem;
  padding: 0.65rem;
  background: #fff;
}

.create-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.create-grid {
  margin-top: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
}

.role-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.role-card {
  border: 1px solid #e2d8c8;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.55rem 0.6rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.08rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.role-pill.super_admin {
  color: #1e365d;
  background: #eaf1ff;
  border-color: #b9c8ee;
}

.role-pill.admin {
  color: #184f7a;
  background: #edf7ff;
  border-color: #b8d8ed;
}

.role-pill.accounting {
  color: #6d4a14;
  background: #fff6e6;
  border-color: #e6cda1;
}

.role-pill.viewer {
  color: #42535b;
  background: #f2f5f7;
  border-color: #d4dee3;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.btn-quick {
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  background: #fff;
  border-color: #d6cebf;
  font-size: 0.81rem;
}

.btn-quick:hover {
  background: #f6f2e8;
}

.btn-quick.is-active {
  background: #153744;
  border-color: #153744;
  color: #fff;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #dcd2c0;
  border-radius: 0.75rem;
  background: #fdfaf3;
}

.bulk-count {
  font-size: 0.82rem;
  color: #42535b;
  font-weight: 600;
  margin-right: 0.25rem;
}

.bulk-field {
  display: grid;
  gap: 0.18rem;
  min-width: 10.2rem;
}

.bulk-field span {
  font-size: 0.72rem;
  color: var(--muted);
}

.bulk-field select {
  min-width: 8.6rem;
}

.cell-check {
  width: 2.2rem;
  text-align: center;
}

.cell-check input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: #153744;
  cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.5rem;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.inline-select {
  min-width: 8rem;
}

.inline-select.compact {
  min-width: 7rem;
  padding: 0.36rem 0.45rem;
  border-radius: 0.55rem;
}

.inline-input {
  min-width: 11.5rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.36rem 0.45rem;
  background: #fff;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  margin-bottom: 0.3rem;
}

.status.submitted {
  color: var(--warn);
  background: #fff8e9;
  border-color: #e8cf9c;
}

.status.in_review {
  color: var(--info);
  background: #eef4ff;
  border-color: #bfd0f0;
}

.status.waiting_info {
  color: #9a5c12;
  background: #fff4e5;
  border-color: #e9c79b;
}

.status.approved,
.status.active {
  color: var(--ok);
  background: #ebf7f1;
  border-color: #b2dcc8;
}

.status.rejected,
.status.inactive {
  color: var(--danger);
  background: #f9ece9;
  border-color: #e4b8b1;
}

.entity-line {
  margin-bottom: 0.15rem;
}

.note-row {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.note-label {
  color: #3f4f56;
  font-weight: 600;
}


.users-wrap {
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: #fff;
  max-height: min(58vh, 36rem);
  overflow: auto;
}

.users-table {
  min-width: 980px;
}

.users-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f2e8;
}

.users-table tbody tr:nth-child(even) {
  background: #fcfaf5;
}

.users-table tbody tr:hover {
  background: #f2f8f7;
}

.users-table tbody tr.is-selected,
.users-table tbody tr.is-selected:nth-child(even),
.users-table tbody tr.is-selected:hover {
  background: #e3f2ef;
}

.cell-user {
  min-width: 16.5rem;
}

.user-name-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.18rem;
}

.user-name {
  font-weight: 600;
  color: #17343d;
}

.user-id {
  border: 1px solid #d8d1c4;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.04rem 0.45rem;
}

.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.user-meta-pill {
  border: 1px solid #e0d8ca;
  border-radius: 999px;
  background: #fffdf8;
  color: #5b6c74;
  font-size: 0.74rem;
  padding: 0.04rem 0.45rem;
}

.user-meta-pill.today {
  background: #e9f6f3;
  border-color: #afd7cb;
  color: #0f6e61;
  font-weight: 600;
}

.user-email-link {
  color: #214f8d;
  text-decoration: none;
  font-weight: 500;
  word-break: break-all;
}

.user-email-link:hover {
  text-decoration: underline;
}

.select-stack {
  display: grid;
  gap: 0.35rem;
  align-items: start;
}

.select-caption {
  font-size: 0.74rem;
  color: var(--muted);
}

.user-role-current,
.user-status-current {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  font-size: 0.76rem;
  border: 1px solid var(--line);
  width: fit-content;
}

.user-role-current {
  color: var(--info);
  background: #eef4ff;
  border-color: #bfd0f0;
  font-weight: 600;
}

.user-status-current.active {
  color: var(--ok);
  background: #ebf7f1;
  border-color: #b2dcc8;
}

.user-status-current.inactive {
  color: var(--danger);
  background: #f9ece9;
  border-color: #e4b8b1;
}

.row-actions.user-actions {
  display: grid;
  gap: 0.35rem;
  min-width: 9.5rem;
}

.row-actions.user-actions .btn {
  width: 100%;
}

.cell-company {
  max-width: 14rem;
}
.hidden {
  display: none !important;
}

@media (max-width: 800px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .head-actions {
    width: 100%;
  }

  .bulk-actions {
    align-items: stretch;
  }

  .bulk-field {
    min-width: 9rem;
    flex: 1 1 9rem;
  }

  .role-legend {
    grid-template-columns: 1fr;
  }

  .users-wrap {
    max-height: none;
  }

  .users-table {
    min-width: 760px;
  }

  .cell-user {
    min-width: 13rem;
  }
}







