* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f8;
  color: #16181d;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 26px 18px;
  background: #111318;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  color: #111318;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #9096a2;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 7px;
}

nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: #aeb4bf;
  text-decoration: none;
  font-size: 14px;
}

nav a:hover,
nav a.active {
  background: #242832;
  color: #fff;
}

.main {
  margin-left: 250px;
  padding: 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

h1 {
  margin: 0 0 5px;
  font-size: 28px;
}

.topbar p,
.panel-title p {
  margin: 0;
  color: #7a808b;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #dfe3e8;
  border-radius: 30px;
  background: #fff;
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #25a55f;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 25px;
}

.stat-card,
.panel {
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  background: #fff;
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  display: block;
  margin-bottom: 12px;
  color: #747b86;
  font-size: 13px;
}

.stat-card strong {
  font-size: 27px;
}

.panel {
  overflow: hidden;
}

.panel-title {
  padding: 22px 24px;
  border-bottom: 1px solid #e7e9ed;
}

.panel-title h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

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

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

th,
td {
  padding: 15px 24px;
  border-bottom: 1px solid #edf0f2;
  text-align: left;
  font-size: 14px;
}

th {
  background: #fafbfc;
  color: #646b75;
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #e8f7ef;
  color: #167846;
}

.badge.off {
  background: #f3f3f3;
  color: #777;
}

@media (max-width: 1000px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: 100%;
  }

  .main {
    margin-left: 0;
    padding: 20px;
  }

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

  .topbar {
    align-items: flex-start;
    gap: 15px;
    flex-direction: column;
  }
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #111318;
}

.login-card {
  width: min(420px, 100%);
  padding: 36px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
}

.login-logo {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: #111318;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}

.login-card h1 {
  margin-bottom: 4px;
}

.login-subtitle {
  margin: 0 0 28px;
  color: #7a808b;
}

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

.login-form label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}

.login-form input:focus {
  border-color: #7a808b;
}

.login-form button {
  margin-top: 12px;
  padding: 13px;
  border: 0;
  border-radius: 8px;
  background: #111318;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.login-error {
  margin-bottom: 18px;
  padding: 11px 13px;
  border-radius: 8px;
  background: #fff0f0;
  color: #a52727;
  font-size: 13px;
}

.success-message {
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid #ccebd9;
  border-radius: 10px;
  background: #ecf9f1;
  color: #167846;
  font-size: 14px;
}

.assistant-grid {
  display: grid;
  gap: 22px;
}

.assistant-card {
  overflow: hidden;
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  background: #fff;
}

.assistant-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid #e7e9ed;
}

.assistant-card-header h2 {
  margin: 5px 0 4px;
  font-size: 20px;
}

.assistant-card-header p {
  margin: 0;
  color: #7a808b;
  font-size: 13px;
}

.assistant-brand {
  color: #747b86;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.assistant-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-group {
  display: grid;
  gap: 7px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  background: #fff;
  color: #16181d;
  font-family: inherit;
  font-size: 14px;
}

.form-group textarea {
  resize: vertical;
  line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #8b929d;
  outline: none;
}

.form-group input:disabled {
  background: #f4f5f6;
  color: #7a808b;
}

.form-group small {
  color: #7a808b;
  font-size: 12px;
}

.assistant-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 4px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
}

.switch-row input {
  width: 18px;
  height: 18px;
}

.primary-button {
  padding: 11px 17px;
  border: 0;
  border-radius: 8px;
  background: #111318;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  background: #242832;
}

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

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

  .primary-button {
    width: 100%;
  }
}

.knowledge-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  background: #fff;
}

.knowledge-toolbar label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-toolbar select,
.form-group select {
  min-width: 220px;
  padding: 11px 12px;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

.knowledge-brand-label {
  color: #656c76;
  font-size: 14px;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(500px, 1.6fr);
  gap: 22px;
  align-items: start;
}

.knowledge-column {
  display: grid;
  gap: 22px;
}

.knowledge-main {
  align-content: start;
}

.knowledge-create {
  overflow: hidden;
}

.knowledge-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.knowledge-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.knowledge-heading p {
  margin: 0;
  color: #7a808b;
  font-size: 13px;
}

.knowledge-entry {
  overflow: hidden;
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  background: #fff;
}

.knowledge-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.knowledge-entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.category-form {
  display: flex;
  gap: 10px;
  padding: 20px 24px;
}

.category-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  font-size: 14px;
}

.secondary-button {
  padding: 11px 15px;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  background: #fff;
  color: #16181d;
  font-weight: 700;
  cursor: pointer;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 22px;
}

.category-chip {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 20px;
  background: #eef0f3;
  color: #555d68;
  font-size: 12px;
  font-weight: 700;
}

.delete-form {
  padding: 0 24px 24px;
}

.danger-button {
  padding: 9px 13px;
  border: 1px solid #efc9c9;
  border-radius: 8px;
  background: #fff7f7;
  color: #a52727;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.knowledge-empty {
  padding: 45px 25px;
  border: 1px dashed #d6dae0;
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.knowledge-empty h3 {
  margin: 0 0 8px;
}

.knowledge-empty p,
.empty-text {
  margin: 0;
  color: #7a808b;
  font-size: 13px;
}

.knowledge-error {
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid #efcaca;
  border-radius: 10px;
  background: #fff1f1;
  color: #a52727;
  font-size: 14px;
}

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

@media (max-width: 760px) {
  .knowledge-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .knowledge-toolbar select,
  .form-group select {
    width: 100%;
    min-width: 0;
  }

  .knowledge-entry-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .category-form {
    flex-direction: column;
  }
}
