* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fa;
  color: #17202a;
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  border: 0;
  background: #165d8f;
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #d9e2ec;
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
}

.nav {
  align-items: center;
  display: flex;
  gap: 12px;
}

.nav a {
  color: #165d8f;
  font-weight: 700;
  text-decoration: none;
}

.nav form {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  background: #fff;
  border-right: 1px solid #d9e2ec;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 12px 16px;
}

.sidebar-toggle {
  display: none;
}

.sidebar-menu {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.app-brand {
  color: #165d8f;
  display: block;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
  padding: 0 12px 24px;
  text-decoration: none;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-home,
.sidebar-group a {
  border-radius: 6px;
  color: #28384d;
  display: block;
  font-weight: 600;
  padding: 10px 12px;
  text-decoration: none;
}

.sidebar-home {
  background: #165d8f;
  color: #fff;
}

.sidebar-home:hover,
.sidebar-home:focus {
  background: #0f4f7c;
}

.sidebar-group {
  border-top: 1px solid #d9e2ec;
  padding-top: 14px;
}

.sidebar-group summary {
  color: #506176;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 12px 6px;
  text-transform: uppercase;
}

.sidebar-group a:hover,
.sidebar-group a:focus {
  background: #eaf4ff;
  color: #165d8f;
  outline: 0;
}

.sidebar-logout {
  border-top: 1px solid #d9e2ec;
  margin: auto 0 0;
  padding: 16px 0 0;
}

.sidebar-logout button {
  background: transparent;
  color: #506176;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.sidebar-logout button:hover,
.sidebar-logout button:focus {
  background: #eaf4ff;
  color: #165d8f;
  outline: 0;
}

.app-shell .shell {
  margin: 0;
  max-width: none;
  min-width: 0;
}

@media (min-width: 761px) {
  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .app-sidebar {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell > main {
    min-height: 0;
    overflow-y: auto;
  }
}

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.2;
}

.dashboard-header p {
  color: #506176;
  margin: 8px 0 0;
}

.dashboard-kpis {
  gap: 18px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.status-grid .dashboard-kpi {
  align-items: center;
  display: flex;
  gap: 14px;
  min-height: 112px;
  padding: 18px;
}

.dashboard-kpi > i {
  color: #165d8f;
  flex: 0 0 auto;
  font-size: 2rem;
  line-height: 1;
}

.dashboard-kpi div,
.dashboard-signal-grid div {
  min-width: 0;
}

.dashboard-kpi.success > i {
  color: #23804a;
}

.dashboard-kpi.danger > i {
  color: #b42318;
}

.dashboard-kpi strong {
  color: #17202a;
  font-size: 1.75rem;
}

.dashboard-signal-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  margin-top: 18px;
}

.dashboard-signal-grid article {
  align-items: center;
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  padding: 14px 16px;
}

.dashboard-signal-grid i {
  color: #b26a00;
  font-size: 1.2rem;
}

.dashboard-signal-grid span {
  color: #68778d;
  display: block;
  font-size: 0.86rem;
  margin-bottom: 3px;
}

.dashboard-signal-grid strong {
  font-size: 1.1rem;
}

.dashboard-context-grid article {
  min-height: 142px;
}

.dashboard-table-panel {
  border-color: #d5e0ea;
}

.dashboard-table-panel h2 {
  color: #17202a;
}

@media (max-width: 1180px) {
  .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    min-height: auto;
    padding: 16px 12px;
    position: relative;
  }

  .app-brand {
    padding: 0;
  }

  .sidebar-toggle {
    align-items: center;
    background: #165d8f;
    color: #fff;
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
    padding: 9px 12px;
  }

  .sidebar-toggle:hover,
  .sidebar-toggle:focus {
    background: #0f4f7c;
    outline: 0;
  }

  .sidebar-toggle-icon,
  .sidebar-toggle-icon::before,
  .sidebar-toggle-icon::after {
    background: currentColor;
    display: block;
    height: 2px;
    width: 18px;
  }

  .sidebar-toggle-icon {
    position: relative;
  }

  .sidebar-toggle-icon::before,
  .sidebar-toggle-icon::after {
    content: '';
    left: 0;
    position: absolute;
  }

  .sidebar-toggle-icon::before {
    top: -6px;
  }

  .sidebar-toggle-icon::after {
    top: 6px;
  }

  .sidebar-menu {
    background: #fff;
    border-bottom: 1px solid #d9e2ec;
    box-shadow: 0 10px 18px rgba(26, 48, 72, 0.16);
    display: none;
    left: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 12px;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 10;
  }

  .app-sidebar.menu-open .sidebar-menu {
    display: flex;
  }

  .sidebar-group[open] summary {
    margin-bottom: 4px;
  }

  .sidebar-logout {
    margin-top: 16px;
  }

  .dashboard-kpis,
  .dashboard-signal-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header.with-action {
    align-items: flex-start;
    flex-direction: column;
  }
}

.button,
.button-secondary {
  border-radius: 6px;
  display: inline-block;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  text-decoration: none;
}

.button {
  background: #165d8f;
  color: #fff;
}

.button-secondary {
  background: #e8eef5;
  color: #17202a;
}

.muted {
  color: #68778d;
  margin-left: 8px;
}

.shell {
  margin: 0 auto;
  max-width: 1120px;
  padding: 32px 24px;
}

.auth-panel {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  margin: 48px auto;
  max-width: 420px;
  padding: 28px;
}

.auth-panel form {
  display: grid;
  gap: 10px;
}

.auth-panel input {
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  padding: 0.7rem;
  width: 100%;
}

.auth-page {
  background: #fff;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(360px, 42%) 1fr;
  margin: 0;
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

.auth-context {
  align-items: center;
  background: #f5f7fa;
  border-right: 1px solid #d9e2ec;
  display: flex;
  padding: 48px;
}

.auth-context-content {
  max-width: 480px;
}

.auth-product-name {
  color: #165d8f;
  font-size: clamp(1.6rem, 2.5vw, 2.45rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 34px;
}

.auth-context h1 {
  color: #165d8f;
  font-size: 1.45rem;
  margin: 0 0 26px;
}

.auth-context p:last-child {
  color: #43536a;
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0;
  max-width: 31rem;
}

.auth-form-area {
  align-items: center;
  display: flex;
  padding: 48px clamp(32px, 8vw, 144px);
}

.auth-form-content {
  max-width: 640px;
  width: 100%;
}

.visually-hidden {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  clip: rect(0, 0, 0, 0);
}

.auth-form-content form {
  display: grid;
  gap: 24px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field label {
  font-size: 1rem;
  font-weight: 700;
}

.auth-field input {
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  min-height: 48px;
  padding: 0.7rem 0.8rem;
  width: 100%;
}

.auth-field input:focus {
  border-color: #165d8f;
  box-shadow: 0 0 0 3px #eaf4ff;
  outline: 0;
}

.auth-form-content button {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 8px;
  min-height: 52px;
  width: 100%;
}

.auth-security-note {
  color: #165d8f;
  margin: 28px 0 0;
  text-align: center;
}

.auth-form-content .errorlist {
  font-size: 0.9rem;
  list-style: none;
  padding: 0;
}

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

  .auth-context {
    border-bottom: 1px solid #d9e2ec;
    border-right: 0;
    min-height: auto;
    padding: 36px 24px;
  }

  .auth-product-name {
    margin-bottom: 22px;
  }

  .auth-context h1 {
    display: none;
  }

  .auth-form-area {
    align-items: flex-start;
    padding: 40px 24px;
  }
}

.page-title {
  margin-bottom: 28px;
}

.with-action {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.page-title h1 {
  margin-bottom: 8px;
}

.status-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.status-grid article {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
}

.status-grid span {
  color: #68778d;
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.status-grid strong {
  font-size: 1.2rem;
}

.notice {
  background: #eaf4ff;
  border: 1px solid #b9dcff;
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 12px;
}

.form-panel,
.table-panel {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 20px;
}

.form-panel {
  display: grid;
  gap: 14px;
  max-width: 760px;
}

.compact-form {
  max-width: 520px;
}

.smtp-test-panel {
  max-width: 760px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  align-items: center;
  display: flex;
  gap: 6px;
  font-weight: 700;
}

.tooltip {
  align-items: center;
  background: #fff;
  border: 1.5px solid #165d8f;
  border-radius: 999px;
  color: #165d8f;
  cursor: help;
  display: inline-flex;
  height: 18px;
  justify-content: center;
  line-height: 1;
  width: 18px;
}

.tooltip .bi {
  font-size: 0.78rem;
  line-height: 1;
}

.tooltip:hover,
.tooltip:focus {
  background: #eaf4ff;
}

.field input,
.field select,
.field textarea {
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  padding: 0.65rem;
  width: 100%;
}

.field ul {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.field li label {
  align-items: center;
  display: flex;
  gap: 8px;
}

.field input[type="checkbox"] {
  width: auto;
}

.field input[type="time"] {
  max-width: 180px;
  width: 180px;
}

.checkbox-field {
  align-items: center;
  display: flex;
  gap: 8px;
}

.checkbox-field input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0;
}

.checkbox-field label {
  margin: 0;
}

.checkbox-field .errorlist {
  flex-basis: 100%;
}

.field small {
  color: #68778d;
}

.errorlist {
  color: #9b1c1c;
  margin: 0;
}

.actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.registration-title {
  margin-bottom: 20px;
}

.registration-form {
  display: block;
  max-width: 1040px;
  padding: 28px;
}

.registration-fields {
  display: grid;
  gap: 20px 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.registration-field {
  min-width: 0;
}

.registration-field:first-child,
.registration-field--full {
  grid-column: 1 / -1;
}

.registration-form .field {
  gap: 8px;
}

.registration-form .field input,
.registration-form .field select,
.registration-form .field textarea {
  min-height: 44px;
}

.registration-form .field textarea {
  min-height: 132px;
  resize: vertical;
}

.registration-form .registration-field--short-textarea textarea {
  height: 66px;
  min-height: 66px;
}

.registration-form .registration-field--compact-textarea textarea {
  height: 44px;
  min-height: 44px;
}

.registration-form .registration-field--weekdays ul,
.registration-form .registration-field--weekdays > div[id] {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.registration-form .registration-field--weekdays li,
.registration-form .registration-field--weekdays > div[id] > div {
  flex: 0 0 auto;
  margin: 0;
}

.registration-actions {
  background: #fff;
  border-top: 1px solid #e1e8f0;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  position: sticky;
  bottom: 0;
}

@media (max-width: 760px) {
  .registration-form {
    padding: 20px;
  }

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

  .registration-field,
  .registration-field:first-child,
  .registration-field--full {
    grid-column: auto;
  }

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

  .registration-actions > * {
    flex: 1;
    text-align: center;
  }
}

.table-panel {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e1e8f0;
  padding: 12px;
  text-align: left;
}

th {
  color: #506176;
  font-size: 0.9rem;
}

.inline {
  display: inline;
}

.inline button {
  margin-left: 8px;
  padding: 0.35rem 0.55rem;
}

.inline .link-button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  margin-left: 8px;
  padding: 0;
  text-decoration: underline;
}

.inline .link-button:hover,
.inline .link-button:focus {
  color: inherit;
}

td.actions > a,
td.actions > a:visited,
td.actions .link-button {
  color: #165d8f;
}

td.actions > a:hover,
td.actions > a:focus,
td.actions .link-button:hover,
td.actions .link-button:focus {
  color: #0f4f7c;
}

td.log-actions {
  vertical-align: middle;
  white-space: nowrap;
}

td.log-actions form {
  margin: 0;
}

.row-actions-cell {
  min-width: 170px;
  white-space: nowrap;
}

.row-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions form {
  margin: 0;
}

.icon-action {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #165d8f;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  text-decoration: none;
  width: 34px;
}

.icon-action svg {
  fill: none;
  height: 18px;
  pointer-events: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.icon-action:hover,
.icon-action:focus {
  background: #eaf4ff;
}

.icon-action.danger {
  color: #9b1c1c;
}

.icon-action.danger:hover,
.icon-action.danger:focus {
  background: #fdecec;
}

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-grid article {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
}

.detail-grid span {
  color: #68778d;
  display: block;
  margin-bottom: 8px;
}

.detail-grid p {
  margin: 8px 0 0;
}

.spaced {
  margin-top: 24px;
}

.table-panel h2 {
  font-size: 1.1rem;
  margin: 0 0 14px;
}

.log-box {
  background: #111827;
  border-radius: 6px;
  color: #f9fafb;
  max-height: 280px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.log-box.error {
  background: #7f1d1d;
}

.filter-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-bar input,
.filter-bar select {
  border: 1px solid #b8c4d2;
  border-radius: 6px;
  padding: 0.55rem;
}

.schedule-filter-bar {
  margin-bottom: 20px;
}

.schedule-filter-bar input,
.schedule-filter-bar select,
.schedule-filter-bar button {
  height: 44px;
  min-height: 44px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.86rem;
}

.checksum {
  max-width: 150px;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.path-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
