:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #d7dce5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --shadow: 0 18px 45px rgba(22, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.secondary {
  background: #e8eefc;
  color: #1e3a8a;
}

button.secondary:hover {
  background: #dbe7ff;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-dark);
}

.app-header {
  align-items: center;
  background: #0f172a;
  color: #fff;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem);
}

.eyebrow {
  color: #93c5fd;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

.header-actions,
.form-actions,
.row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

main {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 2rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem;
}

.muted {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 1180px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475467;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

code {
  background: #eef2ff;
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
}

.empty {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-RUNNING {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-SUCCESS {
  background: #dcfce7;
  color: #166534;
}

.status-ERROR {
  background: #fee2e2;
  color: #991b1b;
}

.status-DISABLED {
  background: #e5e7eb;
  color: #374151;
}

.status-IDLE {
  background: #fef3c7;
  color: #92400e;
}

.enabled-yes {
  color: #166534;
  font-weight: 800;
}

.enabled-no {
  color: #991b1b;
  font-weight: 800;
}

.message-cell {
  max-width: 280px;
  word-break: break-word;
}

.job-form {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  color: #344054;
  display: grid;
  font-weight: 700;
  gap: 0.4rem;
}

.checkbox-label {
  align-content: center;
  display: flex;
  gap: 0.55rem;
  padding-top: 1.5rem;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem;
  width: 100%;
}

textarea {
  font-family: Consolas, Monaco, monospace;
  resize: vertical;
}

.message-log {
  display: grid;
  gap: 0.5rem;
}

.notice {
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.notice.info {
  background: #dbeafe;
  color: #1e3a8a;
}

.notice.error {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 800px) {
  .app-header,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

.hidden {
  display: none !important;
}

.login-view {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 1.25rem;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
  margin: 0 auto;
  max-width: 420px;
  padding: 2rem;
  width: 100%;
}

.header-subtitle {
  color: #cbd5e1;
  margin: 0.35rem 0 0;
}

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  padding: 1rem;
}

.company-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.company-card h3,
.company-card p {
  margin: 0 0 0.45rem;
}
.admin-layout,
.admin-block,
.admin-form,
.admin-company-list,
.admin-company-card,
.credentials-grid {
  display: grid;
  gap: 1rem;
}

.admin-layout {
  padding: 1rem;
}

.admin-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.admin-block-heading,
.admin-company-title {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.admin-block h3,
.admin-company-card h4,
.admin-company-card h5 {
  margin: 0;
}

.admin-form {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.compact-form {
  max-width: 560px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0;
  padding: 0.85rem;
}

legend {
  color: #344054;
  font-weight: 700;
  padding: 0 0.35rem;
}

.checkbox-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.compact-checkbox {
  padding: 0;
}

.admin-table {
  min-width: 900px;
}

.admin-company-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.admin-company-details {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
}

.inline-secret-form {
  align-items: end;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.credential-form .muted {
  grid-column: 1 / -1;
  margin: -0.25rem 0 0;
}

@media (max-width: 900px) {
  .admin-block-heading,
  .admin-company-title {
    flex-direction: column;
  }

  .admin-company-details,
  .inline-secret-form {
    grid-template-columns: 1fr;
  }
}
.top-nav {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.top-nav a {
  border-radius: 999px;
  color: #dbeafe;
  font-weight: 800;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a[aria-current="page"],
.top-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.compact-actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.admin-table .row-actions,
td .row-actions {
  gap: 0.35rem;
}

.admin-table button,
td button,
.inline-secret-form button {
  border-radius: 7px;
  padding: 0.42rem 0.58rem;
}

@media (min-width: 1000px) {
  .app-header {
    align-items: center;
    grid-template-columns: 1fr auto auto;
  }
}

@media (max-width: 800px) {
  .top-nav,
  .header-actions {
    width: 100%;
  }

  .header-actions {
    align-items: stretch;
  }

  .header-actions button,
  .header-actions .status-pill,
  .top-nav a {
    text-align: center;
  }

  .compact-actions {
    flex-wrap: wrap;
  }
}
/* Timing configuration page */
.top-nav a[aria-current="page"] {
  background: rgba(255,255,255,0.18);
}
.timing-main {
  gap: 1rem;
}
.timing-toolbar {
  padding: 1rem;
}
.compact-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.sync-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 1rem;
}
.batch-bar {
  border-top: 1px solid var(--line);
  padding: 0.75rem 1rem;
}
.batch-bar input[type="number"],
.batch-bar select {
  max-width: 220px;
}
.compact-table {
  font-size: 0.88rem;
  min-width: 1120px;
}
.compact-table th,
.compact-table td {
  padding: 0.45rem 0.55rem;
  vertical-align: middle;
}
.compact-table input,
.compact-table select {
  border-radius: 6px;
  padding: 0.35rem;
}
.timing-table code {
  white-space: nowrap;
}
.checkbox-label.inline {
  align-items: center;
  padding-top: 0;
  white-space: nowrap;
}
.header-subtitle {
  color: #cbd5e1;
  margin: 0.25rem 0 0;
}
@media (max-width: 900px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }
  .header-actions,
  .top-nav {
    justify-content: flex-start;
  }
}
.button-link {
  border-radius: 8px;
  display: inline-block;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  text-decoration: none;
}
.button-link.secondary {
  background: #e8eefc;
  color: #1e3a8a;
}
.button-link.secondary:hover {
  background: #dbe7ff;
}