:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #17212b;
  background: #f3f5f7;
  font-size: 15px;
  letter-spacing: 0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; letter-spacing: 0; }
button {
  border: 1px solid #006b45;
  border-radius: 5px;
  background: #007c50;
  color: #fff;
  padding: 9px 14px;
  min-height: 38px;
  cursor: pointer;
  font-weight: 650;
}
button:hover { background: #006440; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #fff; color: #24313d; border-color: #aeb8c1; }
button.secondary:hover { background: #f4f6f7; }
.button-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid #006b45;
  border-radius: 5px;
  background: #fff;
  color: #006b45;
  padding: 8px 13px;
  text-decoration: none;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel {
  width: min(430px, 100%);
  border: 1px solid #cfd6dc;
  border-top: 5px solid #007c50;
  border-radius: 7px;
  background: #fff;
  padding: 30px;
  box-shadow: 0 12px 30px rgba(19, 34, 46, .09);
}
.brand { color: #075e43; font-size: 23px; font-weight: 780; }
.brand span { color: #566673; font-size: 13px; font-weight: 600; }
.env {
  display: inline-block;
  margin-top: 7px;
  color: #694b00;
  background: #fff2c2;
  border: 1px solid #d8b64f;
  border-radius: 3px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 750;
}
h1 { font-size: 22px; margin: 24px 0 6px; }
p { color: #5d6a75; margin: 4px 0; }
label { display: grid; gap: 6px; color: #34424e; font-weight: 650; }
.login-panel form { display: grid; gap: 17px; margin-top: 25px; }
input, select {
  border: 1px solid #aeb8c1;
  border-radius: 4px;
  background: #fff;
  color: #17212b;
  min-height: 40px;
  padding: 8px 10px;
}
input:focus, select:focus, button:focus { outline: 3px solid rgba(0, 124, 80, .22); outline-offset: 1px; }
.error { color: #a32727; min-height: 21px; }
.privacy { border-top: 1px solid #e1e5e8; margin-top: 24px; padding-top: 16px; font-size: 13px; }
.app-shell > header {
  height: 72px;
  padding: 11px 26px;
  background: #fff;
  border-bottom: 1px solid #d5dbe0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.state { color: #35634e; font-size: 13px; }
nav {
  background: #20303c;
  display: flex;
  gap: 2px;
  padding: 0 24px;
  overflow-x: auto;
}
nav .tab {
  min-width: 130px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dfe7eb;
  padding: 14px 18px;
}
nav .tab.active { background: #fff; color: #17212b; box-shadow: inset 0 3px #25a26c; }
main { max-width: 1480px; margin: 0 auto; padding: 24px; }
.view { background: #fff; border: 1px solid #d8dee3; border-radius: 6px; }
.section-head {
  min-height: 76px;
  padding: 16px 20px;
  border-bottom: 1px solid #dfe4e7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.section-head h1 { margin: 0 0 3px; font-size: 20px; }
.toolbar { display: flex; gap: 8px; }
.controls {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(250px, 2fr) minmax(250px, 2fr);
  gap: 14px;
  border-bottom: 1px solid #e3e7ea;
}
.upload input { padding: 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #e2e6e9; padding: 10px 12px; text-align: left; vertical-align: top; }
th { background: #f5f7f8; color: #495865; font-size: 12px; text-transform: uppercase; white-space: nowrap; }
td { font-size: 13px; }
td.hash { max-width: 190px; overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 11px; color: #53616b; }
td input[type="checkbox"] { min-height: auto; width: 18px; height: 18px; }
.action-bar {
  position: sticky;
  bottom: 0;
  background: #f8faf9;
  border-top: 1px solid #cfd8d2;
  padding: 13px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notice, .pairing { margin: 14px 20px; padding: 12px; border-radius: 4px; }
.notice { background: #e8f5ee; border: 1px solid #8fc6a9; }
.agent-package-info { margin: 14px 20px; color: #5d6a75; font-size: 13px; }
.agent-package-info details { margin-top: 8px; }
.agent-package-info summary { cursor: pointer; }
.package-hash { margin-top: 8px; font-family: Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.pairing { background: #edf4fa; border: 1px solid #91b5d1; font-family: Consolas, monospace; font-size: 20px; }
.run {
  border-bottom: 1px solid #dfe4e7;
  padding: 16px 20px;
}
.run:last-child { border-bottom: 0; }
.run-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.run-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { border: 1px solid #aeb8c1; border-radius: 3px; padding: 3px 7px; font-size: 12px; font-weight: 700; background: #f5f7f8; }
.badge.passed, .badge.online { color: #17663e; border-color: #78b797; background: #eaf6ef; }
.badge.failed, .badge.offline, .badge.expired { color: #9d2c2c; border-color: #d59696; background: #fff0f0; }
.badge.sending, .badge.signing, .badge.encrypting, .badge.waiting_for_user { color: #775200; border-color: #d4b45e; background: #fff6d8; }
.badge.waiting_for_agent, .badge.approved_to_send, .badge.waiting_for_receipt { color: #225b87; border-color: #91b5d1; background: #edf4fa; }
.badge.online, .badge.offline { display: inline-flex; align-items: center; gap: 5px; }
.badge.online::before, .badge.offline::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.run-items { margin-top: 12px; }
.run-actions { display: flex; gap: 8px; }
.agent-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; padding: 0 20px 20px; }
.agent-card { border: 1px solid #d7dde1; border-radius: 5px; padding: 14px; }
.agent-card h2 { font-size: 16px; margin: 0 0 8px; }
.agent-card ul { padding-left: 18px; color: #465561; }
.agent-card code { overflow-wrap: anywhere; word-break: break-all; }
#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 440px;
  background: #17212b;
  color: #fff;
  border-radius: 5px;
  padding: 12px 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#toast.show { opacity: 1; }
@media (max-width: 800px) {
  .app-shell > header, main { padding-left: 14px; padding-right: 14px; }
  nav { padding: 0; }
  nav .tab { min-width: 115px; padding-left: 10px; padding-right: 10px; }
  .controls { grid-template-columns: 1fr; }
  .section-head, .action-bar, .run-head { align-items: stretch; flex-direction: column; }
  .header-actions .state { display: none; }
}
