:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;

  color: #1f2933;
  background: #f5f6f7;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #f5f6f7;
  color: #1f2933;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.admin-container {
  max-width: 1500px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

label {
  display: block;
  margin: 1rem 0;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem;
  font: inherit;
  border: 1px solid #aeb7c2;
  border-radius: 5px;
  background: #ffffff;
}

button {
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #222222;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
}

button:hover:not(:disabled) {
  opacity: 0.88;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid
    rgba(31, 111, 235, 0.3);
  outline-offset: 2px;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.secondary-button {
  background: #ffffff;
  color: #222222;
  border-color: #8a949f;
}

.danger-button {
  background: #a61b1b;
  border-color: #a61b1b;
}

.active-decrypt-button {
  background: #44505c;
  border-color: #44505c;
}

#status {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid #d7dce1;
  border-radius: 10px;
  background: #ffffff;
}

.admin-header h1 {
  margin-bottom: 0.25rem;
}

.admin-subtitle {
  margin-bottom: 0;
  color: #5d6874;
}

.admin-auth-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-auth-controls p {
  margin: 0;
  min-width: 100px;
  font-weight: 600;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border: 1px solid #d7dce1;
  border-radius: 10px;
  background: #ffffff;
}

.admin-tab {
  background: #ffffff;
  color: #27313b;
  border-color: #b9c1ca;
}

.admin-tab.active-tab {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.admin-section {
  padding: 1.25rem;
  border: 1px solid #d7dce1;
  border-radius: 10px;
  background: #ffffff;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading-row h2 {
  margin-bottom: 0.35rem;
}

.security-notice {
  margin-bottom: 0;
  color: #5d6874;
  font-size: 0.92rem;
  max-width: 950px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #cbd2d9;
  border-radius: 7px;
}

table {
  width: 100%;
  min-width: 1150px;
  border-collapse: collapse;
  background: #ffffff;
}

#activity-rows {
  min-width: 1250px;
}

th,
td {
  padding: 0.7rem;
  border-bottom:
    1px solid #dfe3e8;
  border-right:
    1px solid #e8ebee;
  text-align: left;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: none;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef1f4;
  color: #27313b;
  font-size: 0.9rem;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

.submission-row:hover,
#activity-rows tbody tr:hover {
  background: #fafbfc;
}

.id-cell {
  max-width: 190px;
  overflow-wrap: anywhere;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
  font-size: 0.82rem;
}

.actions-cell {
  min-width: 190px;
  white-space: nowrap;
}

.actions-cell button {
  margin:
    0 0.35rem 0.35rem 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}

.table-message {
  padding: 1.5rem;
  color: #5d6874;
  text-align: center;
}

.table-error {
  color: #991b1b;
  background: #fff3f3;
}

.activity-badge {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  background: #e8ecf0;
  color: #303943;
}

.activity-login {
  background: #e5f5e9;
  color: #1d6333;
}

.activity-logout {
  background: #eceff3;
  color: #44505c;
}

.activity-decrypt {
  background: #fff4d6;
  color: #795500;
}

.activity-delete {
  background: #fde8e8;
  color: #991b1b;
}

.decrypted-detail-row td {
  padding: 0;
  background: #f2f7f3;
}

.decrypted-panel {
  padding: 1.25rem;
  border-top:
    3px solid #2f6f45;
  border-bottom:
    3px solid #2f6f45;
}

.decrypted-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content:
    space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.decrypted-panel-header h3 {
  margin-bottom: 0.25rem;
  color: #204d31;
}

.decrypted-panel-header p {
  margin-bottom: 0;
  color: #4e5f54;
  font-size: 0.88rem;
}

.submission-id {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
}

.decrypted-content {
  padding: 1rem;
  border:
    1px solid #b9cdbf;
  border-radius: 7px;
  background: #ffffff;
}

.decrypting-message {
  margin: 0;
  font-weight: 600;
}

.decrypted-grid {
  display: grid;
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(240px, 1fr)
    );
  gap: 1rem;
}

.decrypted-field {
  min-width: 0;
}

.decrypted-label {
  margin-bottom: 0.35rem;
  color: #44505c;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.decrypted-value {
  min-height: 2.75rem;
  margin: 0;
  padding: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid #cbd2d9;
  border-radius: 5px;
  background: #f7f8f9;
  color: #111111;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
  font-size: 1rem;
}

.decrypted-warning {
  margin: 1rem 0 0;
  color: #8a4b08;
  font-size: 0.9rem;
  font-weight: 600;
}

.decrypted-error {
  padding: 1rem;
  border: 1px solid #e4aaaa;
  border-radius: 6px;
  background: #fff3f3;
  color: #8a1c1c;
}

.decrypted-error p {
  margin: 0.5rem 0 0;
}

@media (max-width: 760px) {
  .container {
    margin: 1rem auto;
  }

  .admin-header,
  .section-heading-row,
  .decrypted-panel-header {
    flex-direction: column;
  }

  .admin-auth-controls {
    justify-content:
      flex-start;
  }

  .admin-tabs {
    flex-direction: column;
  }

  .admin-tab {
    width: 100%;
  }

  .admin-section {
    padding: 0.85rem;
  }

  .decrypted-grid {
    grid-template-columns: 1fr;
  }
}