:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --pane: #ffffff;
  --line: #d9dee7;
  --line-strong: #b8c1cf;
  --text: #172033;
  --muted: #667085;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --brand-green: #8bc53f;
  --brand-gold: #f3c542;
  --blue: #1d4ed8;
  --amber: #b45309;
  --red: #b42318;
  --red-dark: #912018;
  --field: #ffffff;
  --shadow: 0 14px 38px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 0.74fr) minmax(360px, 1fr);
  background: #eef3f1;
}

.login-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 34px;
  min-height: 100vh;
  padding: 42px;
  background:
    linear-gradient(140deg, rgba(15, 118, 110, 0.96), rgba(7, 77, 73, 0.98)),
    #115e59;
  color: #ffffff;
  overflow: hidden;
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(255, 255, 255, 0.12) 44% 45%, transparent 45%),
    repeating-linear-gradient(155deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 34px);
  opacity: 0.38;
}

.login-panel::after {
  content: "AGROADM";
  position: absolute;
  right: -18px;
  bottom: 96px;
  color: rgba(255, 255, 255, 0.055);
  font-size: 88px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  writing-mode: vertical-rl;
}

.login-panel > * {
  position: relative;
  z-index: 1;
}

.login-panel-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-panel-logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.login-panel-brand {
  display: grid;
  gap: 2px;
}

.login-panel-brand strong {
  font-size: 20px;
  line-height: 1;
}

.login-panel-brand span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-showcase {
  align-self: center;
  display: grid;
  gap: 24px;
  max-width: 430px;
}

.login-panel-copy {
  display: grid;
  gap: 8px;
  max-width: 360px;
}

.login-panel-copy span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-panel-copy strong {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.1;
}

.showcase-board {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.showcase-card {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
}

.showcase-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.showcase-card strong {
  font-size: 19px;
}

.showcase-card.is-main {
  border-left: 5px solid var(--brand-green);
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.showcase-grid .showcase-card:first-child {
  border-left: 5px solid var(--brand-gold);
}

.showcase-grid .showcase-card:last-child {
  border-left: 5px solid #ef7f62;
}

.showcase-path {
  height: 3px;
  width: calc(100% - 44px);
  justify-self: center;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-gold), #ef7f62);
}

.login-panel-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.login-panel-footer span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 800;
}

.login-card {
  width: min(430px, calc(100% - 36px));
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(23, 32, 51, 0.14);
}

.login-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  margin-bottom: 2px;
}

.login-card h1 {
  font-size: 30px;
}

.login-copy,
.login-foot {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover {
  background: #eef3f1;
  color: var(--teal-dark);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
}

.login-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.login-foot {
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 5px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.topbar-actions,
.pane-heading,
.form-actions,
.send-row,
.payroll-form,
.drive-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status,
.count,
.current-user {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}

.status {
  max-width: 520px;
  padding: 5px 9px;
}

.count {
  min-width: 34px;
  justify-content: center;
  padding: 4px 8px;
  font-weight: 700;
}

.current-user {
  padding: 5px 9px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  padding: 18px;
}

.pane {
  min-width: 0;
  background: var(--pane);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workers-pane,
.roles-pane,
.mail-pane,
.users-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.users-pane {
  grid-column: 1 / -1;
}

.pane-heading {
  justify-content: space-between;
}

.compact-heading h2 {
  font-size: 16px;
}

.payroll-panel,
.drive-panel {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.payroll-form,
.drive-form {
  align-items: end;
}

.payroll-form {
  flex-wrap: wrap;
}

.payroll-form label,
.drive-form label {
  flex: 1;
  min-width: 0;
}

.payroll-form label {
  min-width: 150px;
}

.stacked-form,
.assignment-grid,
.smtp-grid,
.users-grid,
.worker-grid,
.details-grid {
  display: grid;
  gap: 12px;
}

.worker-grid,
.assignment-grid,
.users-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.worker-editor-head,
.worker-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.worker-editor-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.worker-search {
  flex: 1;
  min-width: 0;
}

.worker-active {
  align-self: end;
}

.worker-details {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fcfcfd;
}

.worker-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.details-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 12px;
}

.smtp-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 2px;
}

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-help {
  display: block;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.field-hint.ok {
  color: var(--teal-dark);
}

.field-hint.error {
  color: var(--red);
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--text);
}

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

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

.button.primary:hover {
  background: var(--teal-dark);
}

.button.quiet {
  color: var(--muted);
  background: #f8fafc;
}

.button.danger {
  border-color: var(--red-dark);
  background: var(--red);
  color: #ffffff;
}

.button.danger:hover {
  background: var(--red-dark);
}

.icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.selection-status {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.selection-status strong {
  color: var(--teal-dark);
  font-size: 18px;
}

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

.table-wrap.compact {
  max-height: 430px;
  overflow-x: hidden;
}

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

th,
td {
  min-height: 44px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

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

.select-col {
  width: 54px;
}

.workers-pane table {
  table-layout: fixed;
}

.worker-col {
  width: 34%;
}

.contact-col {
  width: auto;
}

.actions-col {
  width: 104px;
}

.select-cell {
  text-align: center;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

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

.cell-label,
.preview-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.worker-email {
  display: block;
  overflow-wrap: anywhere;
}

.worker-name {
  display: block;
  overflow-wrap: anywhere;
}

.worker-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.worker-status {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 800;
}

.worker-status.active {
  background: #d1fae5;
  color: #065f46;
}

.worker-status.inactive {
  background: #fee2e2;
  color: var(--red-dark);
}

.is-inactive {
  background: #fffafa;
}

.worker-row-actions {
  display: grid;
  gap: 7px;
}

.worker-row-actions .button {
  width: 100%;
  justify-content: center;
}

.check-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
}

.check-row input,
td input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.send-row {
  justify-content: space-between;
  flex-wrap: wrap;
}

.smtp-help {
  display: grid;
  gap: 4px;
  margin: 4px 0 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.35;
}

.smtp-help a {
  color: #1d4ed8;
  font-weight: 800;
}

.send-results {
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.send-results.error,
.payroll-results.error,
.drive-results.error,
.user-results.error {
  color: var(--red);
}

.send-results.ok,
.payroll-results.ok,
.drive-results.ok,
.user-results.ok {
  color: var(--teal-dark);
}

.payroll-results,
.drive-results,
.user-results {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.preview-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.preview-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.preview-head {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.preview-head strong,
.preview-head span {
  overflow-wrap: anywhere;
}

.preview-body {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  color: #243044;
  font-family: inherit;
  line-height: 1.45;
}

.preview-html {
  overflow: auto;
  padding: 12px;
}

.preview-html table {
  min-width: 520px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

  .mail-pane {
    grid-column: 1 / -1;
  }
}

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

  .login-panel {
    min-height: auto;
    padding: 24px;
    gap: 18px;
  }

  .login-panel::after {
    display: none;
  }

  .login-panel-top {
    align-items: flex-start;
  }

  .login-panel-logo {
    width: 72px;
    height: 72px;
  }

  .login-panel-copy strong {
    font-size: 24px;
  }

  .login-showcase {
    gap: 16px;
    max-width: none;
  }

  .showcase-board {
    padding: 14px;
  }

  .showcase-card {
    min-height: 58px;
    padding: 12px;
  }

  .showcase-card strong {
    font-size: 17px;
  }

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

  .showcase-path {
    width: calc(100% - 24px);
  }

  .login-panel-footer {
    padding-top: 10px;
  }

  .login-card {
    width: calc(100% - 24px);
    margin: 12px 0 24px;
    padding: 24px;
  }

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

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .status,
  .topbar-actions .button {
    width: 100%;
    justify-content: center;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .assignment-grid,
  .worker-grid,
  .details-grid,
  .users-grid,
  .smtp-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .form-actions,
  .send-row,
  .payroll-form,
  .drive-form,
  .worker-list-head,
  .selection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-actions {
    justify-content: stretch;
  }

  .selection-actions .button {
    width: 100%;
  }
}
