:root {
  --bg: #f4f7fd;
  --bg-soft: #edf3ff;
  --card: #ffffff;
  --border: #dbe6fb;
  --text: #173f8a;
  --text-soft: #6f87b3;
  --primary: #1664d9;
  --primary-strong: #0f4eb7;
  --success: #1f9d62;
  --warning: #c98900;
  --danger: #d14343;
  --shadow: 0 12px 35px rgba(25, 78, 160, 0.08);
  --sidebar-width: 290px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
html, body {
  min-height: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  color: var(--text);
  font-family: 'Alexandria', Tahoma, Arial, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { color: var(--primary-strong); }

img { max-width: 100%; height: auto; }

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
}

.app-sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  max-width: 100%;
}

.light-sidebar {
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(20, 76, 169, 0.06);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.brand-box {
  padding: 28px 24px 18px;
  border-bottom: 1px solid #e7efff;
}
.brand-eyebrow {
  color: #5b86c9;
  font-size: 12px;
  margin: 0 0 8px;
}
.brand-title {
  color: #1452b5;
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}
.brand-subtitle {
  color: #7b92ba;
  font-size: 12px;
  margin-top: 8px;
}

.sidebar-close,
.sidebar-toggle {
  display: none;
}

.menu { padding: 0.5rem 0.75rem; }
.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu-list li + li { margin-top: 4px; }
.menu-list a {
  color: #2264cf;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 6px;
  transition: 0.2s ease;
}
.menu-list a:hover,
.menu-list a.is-active {
  background: #eaf2ff;
  color: #0f4eb7;
}
.menu-list i {
  width: 18px;
  text-align: center;
}

.app-content {
  flex: 1 1 auto;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.topbar-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.topbar-title {
  color: #154391;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.2;
  margin: 0 0 6px !important;
}
.topbar-subtitle,
.topbar-user p,
.has-text-grey,
.field-help {
  color: var(--text-soft);
  margin: 0;
  font-size: 13px;
}
.topbar-user {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(25, 78, 160, 0.05);
}

.panel-card,
.stat-card,
.login-box {
  background: var(--card);
  border: 1px solid #dce8ff;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.panel-card { padding: 20px; }

.title {
  color: #153f89 !important;
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 1rem;
}
.title.is-5 { font-size: 1.15rem; }
.label {
  color: #153f89 !important;
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.input,
.select select,
.textarea {
  appearance: none;
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid #d6e4ff;
  background: #fff;
  box-shadow: none;
  padding: 0.7rem 0.95rem;
  font: inherit;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.textarea {
  min-height: 110px;
  resize: vertical;
}
.select {
  position: relative;
  display: block;
}
.select.is-fullwidth { width: 100%; }
.select::after {
  content: "";
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid #7c92bb;
  border-bottom: 2px solid #7c92bb;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select select {
  padding-inline-start: 2.2rem;
}
.input:focus,
.select select:focus,
.textarea:focus {
  outline: none;
  border-color: #8ab4ff;
  box-shadow: 0 0 0 4px rgba(22, 100, 217, 0.1);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  transition: 0.2s ease;
}
.button.is-small {
  min-height: 34px;
  padding: 0.45rem 0.8rem;
  font-size: 0.84rem;
}
.button.is-medium {
  min-height: 48px;
  padding: 0.8rem 1.15rem;
}
.button.is-fullwidth {
  width: 100%;
}
.button.is-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.button.is-link:hover { background: var(--primary-strong); }
.button.is-light {
  background: #eff5ff;
  border-color: #d5e4ff;
  color: var(--primary-strong);
}
.button.is-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.is-success { background: var(--success); border-color: var(--success); color: #fff; }
.button.is-warning { background: #fff4da; border-color: #ffe4a0; color: var(--warning); }
.button.is-danger.is-light {
  background: #fff0f0;
  border-color: #ffd3d3;
  color: #c33131;
}
.button.is-success.is-light {
  background: #eefaf4;
  border-color: #ccefdc;
  color: #1d8a57;
}
.button.is-link.is-light {
  background: #edf4ff;
  border-color: #d4e4ff;
  color: #1452b5;
}
.button:hover { transform: translateY(-1px); }

.notification {
  border-radius: 16px;
  padding: 0.95rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #d6e2ff;
}
.notification.is-success { background: #ecf9f2; color: #1a7f50; border-color: #c8edd8; }
.notification.is-danger { background: #fff1f1; color: #b83434; border-color: #ffd1d1; }
.notification.is-warning { background: #fff8e6; color: #9d7100; border-color: #ffe5a5; }
.notification.is-light { box-shadow: none; }

.table-wrap {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: transparent;
}
.table th,
.table td {
  padding: 0.9rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #eef4ff;
  text-align: right;
  color: var(--text);
  overflow-wrap: anywhere;
}
.table thead th {
  color: #153f89 !important;
  font-weight: 800;
  white-space: nowrap;
}
.table.is-hoverable tbody tr:hover {
  background: #f8fbff;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.tag.is-link { background: #edf4ff; color: #1452b5; border-color: #d6e5ff; }
.tag.is-success { background: #eefaf4; color: #1d8a57; border-color: #ccefdc; }
.tag.is-warning { background: #fff8e7; color: #9d7100; border-color: #ffe7af; }
.tag.is-danger { background: #fff0f0; color: #c33131; border-color: #ffd3d3; }
.tag.is-light { background: #f6f9ff; color: var(--text-soft); border-color: #e2ebff; }

.columns {
  display: flex;
  flex-wrap: wrap;
  margin: -0.6rem;
}
.column {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.6rem;
}
.column.is-2 { flex-basis: 16.6667%; max-width: 16.6667%; }
.column.is-3 { flex-basis: 25%; max-width: 25%; }
.column.is-4 { flex-basis: 33.3333%; max-width: 33.3333%; }
.column.is-6 { flex-basis: 50%; max-width: 50%; }
.column.is-8 { flex-basis: 66.6667%; max-width: 66.6667%; }
.column.is-12 { flex-basis: 100%; max-width: 100%; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card { padding: 18px; }
.stat-card .label {
  color: #6f88b0 !important;
  font-size: 12px;
}
.stat-card .value {
  color: #0e4cb0;
  font-size: 26px;
  font-weight: 800;
}
.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.quick-actions,
.actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.quick-actions {
  justify-content: space-between;
  margin-bottom: 14px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #f4f8ff, #e7efff);
}
.login-box {
  width: 100%;
  max-width: 520px;
  padding: 32px;
}
.login-title {
  color: #154391;
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 8px;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2rem !important; }
.px-3 { padding-inline: 0.75rem !important; }
.py-2 { padding-block: 0.5rem !important; }

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1215px) {
  .column.is-2,
  .column.is-3,
  .column.is-4 {
    flex-basis: 50%;
    max-width: 50%;
  }
}

@media (max-width: 1023px) {
  .app-content {
    width: 100%;
    padding: 20px 16px;
  }

  .light-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(88vw, 320px);
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .light-sidebar {
    transform: translateX(0);
  }

  .sidebar-close,
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #f5f8ff;
    color: var(--primary-strong);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }

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

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 22, 52, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: 0.25s ease;
    z-index: 30;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .topbar {
    align-items: stretch;
  }

  .topbar-main {
    width: 100%;
  }

  .topbar-user {
    width: 100%;
    justify-content: space-between;
  }

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

@media (max-width: 767px) {
  .column,
  .column.is-2,
  .column.is-3,
  .column.is-4,
  .column.is-6,
  .column.is-8,
  .column.is-12 {
    flex-basis: 100%;
    max-width: 100%;
  }

  .panel-card,
  .login-box {
    border-radius: 18px;
  }

  .panel-card {
    padding: 16px;
  }

  .topbar-user {
    padding: 12px;
  }

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

  .table {
    min-width: 640px;
  }

  .button,
  .input,
  .select select,
  .textarea {
    font-size: 16px;
  }
}
