:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #60706c;
  --line: #dce6e3;
  --accent: #0f766e;
  --accent-dark: #0a5f58;
  --warn: #b45309;
  --bad: #b42318;
  --good: #13795b;
  --soft: #e8f3f1;
  --shadow: 0 18px 40px rgba(23, 33, 31, 0.08);
  font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 6vw, 44px);
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 17px;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 6px 0 16px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf0ee;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.tab.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(23, 33, 31, 0.08);
}

.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel.is-active {
  display: block;
}

.panel[hidden] {
  display: none;
}

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

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

.section-head p,
.identity-card p,
.summary-grid span {
  color: var(--muted);
  margin-top: 4px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.identity-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 900;
}

.check-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.summary-grid {
  grid-template-columns: repeat(3, 1fr);
}

.summary-grid div,
.guard-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfdfc;
}

.summary-grid strong {
  display: block;
  font-size: 22px;
}

.primary-action,
.secondary-action {
  min-height: 86px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  padding: 14px;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.secondary-action {
  background: #183b56;
  color: #fff;
}

.primary-action span,
.secondary-action span {
  display: block;
  font-size: 24px;
  font-weight: 900;
}

.primary-action small,
.secondary-action small {
  display: block;
  margin-top: 6px;
  opacity: 0.86;
}

.guard-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.login-panel {
  max-width: 520px;
  margin: 30px auto 0;
}

.auth-form {
  background: transparent;
  border: 0;
  padding: 0;
}

.thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.file-button {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  cursor: pointer;
  font-weight: 800;
}

.file-button input {
  display: none;
}

.table-input {
  width: 180px;
  min-height: 36px;
  margin: 0 0 6px;
  padding: 7px 9px;
}

.table-input.narrow {
  width: 82px;
}

.table-input.money-input {
  width: 150px;
}

.small-button {
  min-height: 34px;
  margin-bottom: 6px;
  padding: 0 10px;
}

.guard-item strong,
.guard-item span {
  display: block;
}

.guard-item span {
  margin-top: 5px;
  color: var(--muted);
}

.guard-item.good {
  border-color: rgba(19, 121, 91, 0.35);
  background: #edf8f4;
}

.guard-item.bad {
  border-color: rgba(180, 35, 24, 0.3);
  background: #fff1f0;
}

.guard-item.warn {
  border-color: rgba(180, 83, 9, 0.3);
  background: #fff7ed;
}

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

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 8px 0 22px;
}

.login-row {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.login-row .field {
  margin-bottom: 0;
}

.primary-button,
.outline-button,
.icon-button {
  min-height: 42px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
}

.outline-button,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.mini-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.mini-form h3 {
  margin-bottom: 12px;
}

.password-form {
  margin: 0 0 18px;
}

.compact-grid {
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

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

tr:last-child td {
  border-bottom: 0;
}

.danger-link {
  border: 0;
  background: transparent;
  color: var(--bad);
  cursor: pointer;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  width: min(520px, calc(100% - 28px));
  transform: translate(-50%, 120%);
  border-radius: 8px;
  padding: 12px 14px;
  background: #17211f;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

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

  .panel {
    padding: 14px;
  }

  .check-grid,
  .guard-list,
  .summary-grid,
  .form-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

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

  .button-row button,
  .header-actions button,
  .primary-button,
  .outline-button {
    width: 100%;
  }

  table {
    min-width: 560px;
  }
}
