﻿:root {
  --sidebar-bg: #1c2a39;
  --page-bg: #2c3f55;
  --band-bg: #3a5371;
  --border: rgba(255, 255, 255, .12);
  --text-light: #fff;
  --text-muted-light: #c9d4e0;
  --card-bg: #fff;
  --card-title: #555f6b;
  --card-text: #2b2f33;
  --primary: #1d4fb8;
  --primary-dark: #163d8f;
  --sidebar-width: 280px;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text-light);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

/* Shell */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.25rem 4rem;
  background: #142130;
}

.brand-logo img {
  width: 76px;
  border-radius: 4px;
  background: #fff;
  padding: 4px;
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: -3rem;
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #1f5d99;
  border: 6px solid var(--sidebar-bg);
  color: #fff;
}

.avatar .icon {
  width: 2.5rem;
  height: 2.5rem;
}

.avatar-sm {
  width: 40px;
  height: 40px;
  border: 0;
}

.avatar-sm .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.store-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  color: var(--text-light);
}

.store-row > .icon {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
}

.store-switcher {
  position: relative;
  flex: 1;
  min-width: 0;
}

.store-current {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #fff;
  color: var(--primary);
  list-style: none;
  flex: 1;
  min-width: 0;
}

.store-switcher .store-current {
  cursor: pointer;
}

.store-current::-webkit-details-marker {
  display: none;
}

.store-switcher[open] .store-current,
.store-switcher .store-current:focus-visible {
  border-color: var(--primary);
  outline: none;
}

.store-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.store-current .store-text strong,
.store-current .store-text small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.store-text small {
  color: #555;
}

.store-caret {
  margin-left: auto;
  flex: none;
  display: grid;
  transition: transform .15s;
}

.store-switcher[open] .store-caret {
  transform: rotate(180deg);
}

.store-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: .25rem 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.store-option {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem .75rem;
  border: 0;
  background: none;
  color: var(--primary);
  text-align: left;
  cursor: pointer;
}

.store-option:hover,
.store-option:focus-visible {
  background: #eef2f8;
  outline: none;
}

.store-option.is-current {
  background: #f3f3f3;
  cursor: default;
}

.store-option.is-current small {
  color: var(--primary);
}

.store-option .icon {
  flex: none;
  margin-left: auto;
  width: 1.5rem;
  height: 1.5rem;
}

.store-menu.is-busy {
  opacity: .6;
  pointer-events: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .7rem 1.5rem;
  color: var(--text-light);
  font-weight: 600;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus-visible {
  background: rgba(255, 255, 255, .06);
  border-left-color: #4a90e2;
}

.sidebar-backdrop {
  display: none;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 1.5rem;
  background: var(--sidebar-bg);
}

.user-box {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
  line-height: 1.2;
}

.user-box div:last-child {
  display: flex;
  flex-direction: column;
}

.user-box small {
  color: var(--text-muted-light);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  padding: .4rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-light);
}

.icon-button:hover {
  background: rgba(255, 255, 255, .1);
}

main {
  flex: 1;
}

.footer {
  padding: 1rem 1.5rem;
  color: var(--text-muted-light);
  font-size: .85rem;
}

/* Home */
.welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: var(--band-bg);
}

.welcome h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.welcome p {
  margin: 0;
}

.page-body {
  padding: 1.5rem 2rem;
}

.notice {
  display: flex;
  gap: 1.25rem;
  padding: 1.75rem 2rem;
  border-radius: 8px;
  background: linear-gradient(110deg, #0e2638 0%, #124a5c 55%, #17808a 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
}

.notice h2 {
  margin: 0 0 .5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.notice p {
  margin: 0 0 .35rem;
  color: var(--text-muted-light);
}

.signature {
  font-style: italic;
}

.section-title {
  margin: 1.75rem 0 1rem;
  font-size: 1.5rem;
  font-weight: 400;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 1rem 1.1rem;
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--card-text);
  transition: transform .15s, box-shadow .15s;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}

.app-card header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.app-card h3 {
  margin: 0;
  color: var(--card-title);
  font-size: 1.3rem;
  font-weight: 400;
}

.app-card header .icon {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--primary);
}

.app-card p {
  flex: 1;
  margin: 1.25rem 0;
  font-size: .95rem;
}

.btn-portal-outline,
.btn-light-outline,
.btn-portal {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  align-self: flex-start;
  border-radius: 4px;
}

.btn-portal-outline {
  min-width: 120px;
  justify-content: space-between;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-portal-outline .icon {
  width: .9em;
  height: .9em;
}

.btn-portal-outline:hover,
.btn-portal-outline:focus {
  background: var(--primary);
  color: #fff;
}

.btn-light-outline {
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
}

.btn-light-outline:hover {
  background: #e9f0fb;
  color: var(--primary-dark);
}

.btn-portal {
  background: var(--primary);
  color: #fff;
  padding: .5rem 2rem;
}

.btn-portal:hover {
  background: var(--primary-dark);
  color: #fff;
}

.empty {
  color: var(--text-muted-light);
}

/* Signed-out page */
.guest {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  max-width: 520px;
  padding: 2.5rem;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--card-text);
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}

.login-logo {
  width: 110px;
  margin-bottom: 1.5rem;
}

.login-card h1 {
  margin-bottom: 1rem;
  color: var(--sidebar-bg);
  font-size: 1.6rem;
  font-weight: 700;
}

.login-card .btn-portal {
  align-self: center;
  margin-top: .5rem;
}

/* Mobile: sidebar becomes an off-canvas drawer */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1030;
    background: rgba(0, 0, 0, .5);
  }

  .welcome,
  .page-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .notice {
    padding: 1.25rem;
  }
}
