:root {
  --app-bg: #f4f7fb;
  --app-surface: #ffffff;
  --app-soft: #eef4fb;
  --app-border: #d8e2ed;
  --app-text: #172033;
  --app-muted: #64748b;
  --app-primary: #2563eb;
  --app-primary-dark: #1d4ed8;
  --app-accent: #0f766e;
  --app-danger: #dc2626;
  --app-warning: #d97706;
  --app-shadow: 0 14px 34px rgba(15, 23, 42, .10);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background: linear-gradient(180deg, #eef4fb 0%, var(--app-bg) 260px, #f8fafc 100%);
  color: var(--app-text);
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--app-primary);
}

nav {
  box-shadow: none;
}

nav,
nav.orange,
nav.orange.darken-2,
nav.blue,
nav.blue.darken-2 {
  background: #243b53 !important;
}

.app-site-header {
  min-height: 64px;
  background: #243b53 !important;
}

.app-site-header-inner {
  width: min(1180px, calc(100% - 28px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-site-brand {
  min-width: 0;
  overflow: hidden;
  color: #fff !important;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-site-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.app-header-languages {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-header-languages .flag-link {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.app-header-languages .flag-link.active {
  background: #fff;
  color: #243b53;
}

.app-header-logout,
.app-theme-toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  font-weight: 700;
  line-height: 1 !important;
}

.app-header-logout {
  gap: 8px;
  padding: 0 2px;
}

.app-header-logout .material-icons {
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  line-height: 1 !important;
}

.app-theme-toggle {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .13);
  cursor: pointer;
}

.app-theme-toggle:hover {
  background: rgba(255, 255, 255, .24);
}

.app-theme-toggle .material-icons {
  font-size: 20px;
}

body.dark-mode .app-site-header {
  background: #0b1f3a !important;
}

nav .brand-logo {
  position: static !important;
  left: auto !important;
  transform: none !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: 0;
}

nav .nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

nav .right {
  float: none !important;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

nav .right li {
  float: none;
  line-height: normal;
}

nav .right li > a {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  line-height: 1;
}

nav .right li > a .material-icons.left {
  float: none;
  margin: 0 8px 0 0;
}

nav .language-switcher {
  margin-right: 6px;
}

nav .flag-link {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

nav .flag-link.active {
  background: #fff;
  color: #243b53;
}

.container {
  width: min(1180px, calc(100% - 28px));
}

.btn,
.btn-small,
.btn-large,
.btn-flat {
  border-radius: 8px;
  text-transform: none;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: none;
}

.btn:hover,
.btn-small:hover,
.btn-large:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, .16);
}

.btn.blue,
.btn-small.blue,
.btn-large.blue {
  background: var(--app-primary) !important;
}

.btn.blue:hover,
.btn-small.blue:hover,
.btn-large.blue:hover {
  background: var(--app-primary-dark) !important;
}

.btn.green,
.btn-small.green {
  background: var(--app-accent) !important;
}

.btn.red,
.btn-small.red {
  background: var(--app-danger) !important;
}

.btn.grey,
.btn-small.grey {
  background: #64748b !important;
}

.card,
.card-panel,
.modal {
  border-radius: 8px;
}

.card,
.card-panel {
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow);
}

table.striped {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--app-shadow);
}

table.striped thead {
  background: #243b53 !important;
  color: #fff !important;
}

table.striped th {
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

table.striped td {
  border-bottom: 1px solid #edf2f7;
}

.modal {
  box-shadow: 0 26px 80px rgba(15, 23, 42, .28);
}

.modal .modal-footer {
  border-top: 1px solid var(--app-border);
}

input:not([type]),
input[type=text],
input[type=password],
input[type=email],
input[type=url],
input[type=time],
input[type=date],
input[type=datetime],
input[type=datetime-local],
input[type=tel],
input[type=number],
input[type=search],
textarea.materialize-textarea,
select.browser-default {
  color: #111827;
}

.language-switcher {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.flag-link {
  min-width: 34px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e8eef5;
  color: #1f2937;
  font-size: .78rem;
  font-weight: 800;
}

.flag-link.active {
  background: var(--app-primary);
  color: #fff;
}

.app-site-footer,
.app-admin-footer {
  width: min(1180px, calc(100% - 28px));
  margin: 34px auto 24px;
  padding: 16px 18px;
  border-top: 1px solid var(--app-border);
  color: var(--app-muted);
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
}

.app-site-footer a,
.app-admin-footer a {
  color: var(--app-primary);
  font-weight: 800;
}

.app-site-footer .footer-separator,
.app-admin-footer .footer-separator {
  margin: 0 10px;
  color: #94a3b8;
}

body.login-page .modal-overlay,
body.login-page .sidenav-overlay,
body.login-page .drag-target {
  display: none !important;
  pointer-events: none !important;
}

@media (max-width: 600px) {
  .container {
    width: min(100% - 20px, 1180px);
  }

  nav .nav-wrapper {
    gap: 8px;
    padding: 0 10px;
  }

  .app-site-header-inner {
    width: 100%;
    padding: 0 10px;
    gap: 8px;
  }

  .app-site-brand {
    flex: 1 1 auto;
    max-width: 42vw;
    font-size: 1rem;
  }

  .app-site-actions {
    gap: 5px;
  }

  .app-header-languages {
    gap: 4px;
  }

  .app-header-logout {
    gap: 4px;
    padding: 0;
    font-size: .92rem;
  }

  .app-header-logout span {
    display: none;
  }

  nav .brand-logo {
    flex: 1 1 auto;
    max-width: 42vw;
    font-size: 1rem !important;
  }

  nav .right {
    gap: 5px;
  }

  nav .language-switcher {
    gap: 4px;
    margin-right: 2px;
  }

  nav .flag-link {
    min-width: 38px;
    height: 30px;
    padding: 0 9px;
  }

  nav .right a {
    padding: 0 6px;
    font-size: .92rem;
  }

  nav .right li > a {
    min-height: 56px;
  }

  .app-admin-footer {
    width: min(100% - 20px, 1180px);
    margin-top: 24px;
  }

  .app-admin-footer span {
    display: block;
  }

  .app-admin-footer .footer-separator {
    display: none;
  }
}
