:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --ink: #182025;
  --muted: #62717b;
  --line: #d8e0e4;
  --panel: #ffffff;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #b45309;
  --soft: #edf7f5;
  --danger: #b42318;
}
.topbar h1,
.topbar .eyebrow {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  letter-spacing: 1px;
  color: black;
  text-transform: uppercase;
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
#oficiotitle {
  text-align: center;
}
#logintitle {
  text-align: center;
}
#loginForm {
   font-family: "Oswald", sans-serif;
}
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #17313b;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.auth-card .eyebrow {
  color: var(--primary);
}

.auth-card form,
.stack-form {
  display: grid;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px clamp(16px, 4vw, 44px) 24px 280px;
  background-color: #17313b;
  background-image: url("/images/logoctrack.png");
  background-repeat: no-repeat;
  background-position: 20px center;
  background-size: 230px auto;
  color: white;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  color: #a9d8d2;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
}

h2 {
  font-size: 18px;
}

.user-box {
  min-width: min(320px, 100%);
  color: black;
}

.session-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  color: #d8ece9;
  text-align: right;
}

.session-box span {
  font-size: 12px;
  color: #a9d8d2;
  text-transform: uppercase;
  font-weight: 700;
}

.session-box strong {
  color: white;
}

.session-box a {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 6px;
  color: white;
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 44px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(27, 42, 51, 0.06);
}

.form-panel {
  padding: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #2b3b43;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--primary);
}

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

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
  color: white;
  background: var(--primary);
  cursor: pointer;
}

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

button:disabled,
button:disabled:hover {
  color: #7a8a94;
  background: #e8eef1;
  cursor: not-allowed;
}

button.secondary {
  color: var(--ink);
  background: #e8eef1;
}

button.light-button {
  min-height: 34px;
  color: #17313b;
  background: #d8ece9;
}

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

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

button.danger-button:hover {
  background: #8f1f16;
}

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

.status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.status.error {
  color: var(--danger);
}

.edit-banner {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #f1c27d;
  border-radius: 6px;
  color: #7a4100;
  background: #fff7ed;
  font-weight: 700;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.export-actions a {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 6px;
  color: white;
  background: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.file-link {
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: white;
  background: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.side-head span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 14px;
  color: var(--primary-dark);
  background: var(--soft);
  font-weight: 700;
}

.list {
  display: grid;
  gap: 10px;
  padding: 14px;
  max-height: 620px;
  overflow: auto;
}

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

.reference {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.reference strong {
  font-size: 15px;
}

.reference small {
  color: var(--muted);
  line-height: 1.4;
}

.reference button {
  justify-self: start;
  min-height: 34px;
  padding: 0 12px;
  background: var(--accent);
}

.records {
  margin: 0 clamp(16px, 4vw, 44px) 28px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 44px);
}

.single-layout {
  padding: 18px clamp(16px, 4vw, 44px);
}

.subtle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#search {
  max-width: 360px;
}

.table-wrap {
  overflow: auto;
}

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

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

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

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

th {
  color: #41515a;
  background: #f8fafb;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #233139;
}

.pending-list {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.pending-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

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

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

.pending-head strong,
.pending-head small {
  display: block;
}

.pending-head small {
  margin-top: 4px;
  color: var(--muted);
}

.badge {
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 14px;
  color: var(--accent);
  background: #fff7ed;
  font-size: 12px;
  font-weight: 700;
}

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

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.execution-form {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 220px) auto minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.execution-form .status {
  margin: 0;
  align-self: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 30, 38, 0.58);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.read-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 16px;
}

.read-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.read-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.read-grid dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

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

  .admin-layout {
    grid-template-columns: 1fr;
  }

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

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

  .execution-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 130px 16px 18px;
    background-position: 16px 16px;
    background-size: 190px auto;
  }

  .session-box {
    justify-content: flex-start;
    text-align: left;
  }

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

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

  .actions,
  .side-head {
    align-items: stretch;
    flex-direction: column;
  }

  .pending-head {
    flex-direction: column;
  }

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

  .detail-grid,
  .execution-form,
  .read-grid {
    grid-template-columns: 1fr;
  }

  button,
  #search {
    width: 100%;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination span {
    text-align: center;
  }
}
#readModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

#readModal[hidden] {
  display: none;
}

.modal-box {
  background: white;
  width: min(900px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

#readTitle {
  margin: 0;
  font-size: 24px;
}

#readSubtitle {
  margin: 8px 0 20px 0;
  color: #666;
}

#readContent {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.template-preview {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  color: #111827;
  background: #f8fafc;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-x: auto;
}

#readContent .read-item {
  background: #f8fafc;
  border: 1px solid #dbe3ea;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

#readContent dt {
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  font-size: 14px;
}

#readContent dd {
  margin: 0;
  color: #111827;
  font-size: 15px;
  word-break: break-word;
}

.modal-footer {
  margin-top: 25px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#copyTemplate {
  background: var(--primary);
}

#copyTemplate:hover {
  background: var(--primary-dark);
}

#closeRead {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

#closeRead:hover {
  background: #1d4ed8;
}
