:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #eef3f6;
  --ink: #17212b;
  --muted: #667789;
  --line: #dbe3ea;
  --navy: #16324f;
  --teal: #176d6b;
  --green: #2f7d51;
  --amber: #b66a0a;
  --red: #b93535;
  --blue: #2863a6;
  --shadow: 0 18px 48px rgba(22, 50, 79, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

a {
  color: var(--teal);
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  background:
    linear-gradient(90deg, rgba(22, 50, 79, 0.92), rgba(22, 50, 79, 0.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900' viewBox='0 0 1200 900'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16'%3E%3Cpath d='M110 140h980v620H110z'/%3E%3Cpath d='M220 250h760M220 360h760M220 470h760M220 580h760'/%3E%3Cpath d='M350 140v620M600 140v620M850 140v620'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.25'%3E%3Ccircle cx='350' cy='250' r='8'/%3E%3Ccircle cx='600' cy='360' r='8'/%3E%3Ccircle cx='850' cy='470' r='8'/%3E%3Ccircle cx='350' cy='580' r='8'/%3E%3C/g%3E%3C/svg%3E") center / cover;
}

.login-panel {
  background: var(--panel);
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #ffffff;
  font-weight: 800;
}

.brand-logo-wrap {
  width: 112px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid rgba(17, 39, 62, 0.1);
  padding: 8px 10px;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: 100%;
  max-height: 30px;
  object-fit: contain;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

.brand p,
.login-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.quick-login {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: grid;
  gap: 10px;
}

.quick-login p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quick-login-buttons {
  display: grid;
  gap: 8px;
}

.quick-login-buttons .button {
  justify-content: flex-start;
  width: 100%;
}

.login-visual {
  display: grid;
  align-content: end;
  padding: 56px;
  color: #ffffff;
}

.login-visual h2 {
  max-width: 740px;
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: 0;
}

.login-visual p {
  max-width: 560px;
  margin: 18px 0 0;
  font-size: 18px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.84);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #11273e;
  color: #ffffff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar .brand {
  padding: 0 8px 12px;
}

.sidebar .brand-mark {
  background: #ffffff;
  color: var(--navy);
}

.sidebar .brand-logo-wrap {
  width: 92px;
  height: 38px;
  padding: 7px 9px;
  border-color: rgba(255, 255, 255, 0.18);
}

.sidebar .brand h1 {
  font-size: 17px;
}

.sidebar .brand p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 10px;
}

.user-block {
  display: grid;
  gap: 2px;
  font-size: 14px;
}

.user-block span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  text-transform: uppercase;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.button.danger {
  border-color: rgba(185, 53, 53, 0.34);
  color: var(--red);
}

.button.ghost {
  background: transparent;
  color: inherit;
}

.button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 104px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.two-col {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 17px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 190px));
  gap: 10px;
  margin: 0 0 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.check-title {
  font-size: 13px;
  font-weight: 700;
  color: #394957;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(23, 109, 107, 0.16);
  border-color: var(--teal);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 12px;
}

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

.card h3,
.card h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.muted {
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta.compact {
  margin-top: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--panel-2);
  color: #415160;
  font-size: 12px;
  font-weight: 800;
}

.badge.green {
  background: #e6f3ec;
  color: var(--green);
}

.badge.amber {
  background: #fff1d8;
  color: var(--amber);
}

.badge.red {
  background: #ffe6e6;
  color: var(--red);
}

.badge.blue {
  background: #e6f0fb;
  color: var(--blue);
}

.description {
  color: #455463;
  line-height: 1.45;
  white-space: pre-wrap;
}

.small-description {
  margin-top: 7px;
  font-size: 13px;
  max-width: 420px;
}

.kv {
  display: grid;
  gap: 7px;
  font-size: 14px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #edf1f5;
  padding-top: 7px;
}

.kv span {
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  border-bottom: 1px solid #edf1f5;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.table .wrap {
  min-width: 170px;
  white-space: normal;
}

.notifications-table th,
.notifications-table td {
  padding: 12px 10px;
}

.notification-title-cell {
  min-width: 260px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.empty {
  border: 1px dashed #bdc9d4;
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 39, 62, 0.44);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 30;
}

.modal {
  width: min(880px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.modal header {
  position: sticky;
  top: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.modal h3 {
  margin: 0;
  font-size: 20px;
}

.form-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

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

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

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

.recipient-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

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

.access-company {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
  display: grid;
  gap: 9px;
}

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

.access-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.check input {
  margin: 0;
}

.modal footer {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: #ffffff;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #11273e;
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 36px));
  z-index: 40;
}

.danger-text {
  color: var(--red);
}

@media (max-width: 980px) {
  .login {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 320px;
    padding: 32px;
    order: -1;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px;
  }

  .sidebar .brand,
  .sidebar-foot {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .nav button {
    min-width: max-content;
  }

  .content {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .actions {
    justify-content: flex-start;
  }

  .stats,
  .two-col,
  .filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-panel {
    padding: 26px;
  }

  .login-visual {
    padding: 26px;
  }

  .topbar h2 {
    font-size: 24px;
  }

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

  .cards {
    grid-template-columns: 1fr;
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .recipient-head,
  .recipient-row {
    grid-template-columns: 1fr;
  }

  .recipient-head {
    align-items: stretch;
  }
}
