@import url("https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;600;700&display=swap");

:root {
  --blue-900: #0d3a6b;
  --blue-800: #155a9c;
  --blue-700: #1d6fbd;
  --blue-600: #2b86d6;
  --blue-500: #4ea2e6;
  --blue-200: #cfe6f8;
  --blue-100: #e7f3fb;
  --blue-50: #f4f9fd;
  --bg: #e8f1f8;
  --card: #ffffff;
  --line: #c5d8ea;
  --text: #16324f;
  --muted: #5a7a96;
  --acc: #1d6fbd;
  --ok: #1b7a4a;
  --bad: #c0392b;
  --sidebar: #1460a8;
  --sidebar-2: #0f4f8c;
  --side-w: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.demo-bar {
  background: #d6eaf8;
  color: var(--blue-900);
  border-bottom: 1px solid var(--line);
  padding: 8px 18px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.demo-bar a { color: var(--blue-800); font-weight: 600; }

.demo-creds {
  background: var(--blue-100);
  border: 1px solid var(--blue-200);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
  color: var(--muted);
}
.demo-creds code { color: var(--blue-900); }

body.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: var(--side-w);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: .02em;
}
.brand span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: .85;
}

.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
  display: block;
  color: #eaf4ff;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-weight: 600;
}
.sidebar nav a:hover { background: rgba(255,255,255,.12); }
.sidebar nav a.active {
  background: #fff;
  color: var(--blue-800);
}

.side-user {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255,255,255,.18);
  font-size: 13px;
}
.side-user a { color: #fff; }

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

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--blue-900);
}

main {
  padding: 20px 22px 32px;
  max-width: none;
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(21, 90, 156, .06);
}

input, button, select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #9fc0dd;
  background: #fff;
  color: var(--text);
}
input:focus {
  outline: 2px solid var(--blue-200);
  border-color: var(--blue-600);
}
input { width: 100%; max-width: 420px; }

button, .btn {
  background: var(--blue-700);
  color: #fff;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  width: auto;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--blue-800); }
button.danger { background: var(--bad); }
button.danger:hover { background: #9b2e23; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.row input { width: auto; min-width: 220px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { background: var(--blue-100); color: var(--blue-900); font-weight: 600; }
tr:hover td { background: var(--blue-50); }
a { color: var(--blue-800); }

.muted { color: var(--muted); }
.flash { background: #e5f7ec; color: var(--ok); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; border: 1px solid #b7e0c5; }
.error { background: #fdecea; color: #8a2218; padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; border: 1px solid #f5c2bc; }
pre {
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  padding: 10px;
  border-radius: 6px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

body.login-page { background: linear-gradient(180deg, #d4e8f7 0%, #eef5fb 55%, #e8f1f8 100%); }
.login {
  max-width: 420px;
  margin: 8vh auto;
  border-top: 4px solid var(--blue-700);
}
.login input { max-width: none; }
.login h1 { margin-top: 10px; margin-bottom: 8px; color: var(--blue-900); font-size: 22px; line-height: 1.3; }
.login-brand { text-align: center; }
.login-logo { width: 96px; height: 96px; object-fit: contain; display: block; margin: 0 auto 8px; }
.side-logo { width: 56px; height: 56px; object-fit: contain; display: block; margin-bottom: 10px; background: rgba(255,255,255,.12); border-radius: 10px; padding: 6px; }

.hint-bubble {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 280px;
  max-width: calc(100vw - 36px);
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px 18px 6px 18px;
  box-shadow: 0 10px 28px rgba(13, 58, 107, .18);
  padding: 14px 16px 12px;
  z-index: 40;
  font-size: 13px;
  line-height: 1.45;
}
.hint-bubble:before {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -10px;
  border: 10px solid transparent;
  border-top-color: #fff;
  filter: drop-shadow(0 2px 0 var(--line));
}
.hint-bubble h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--blue-800);
}
.hint-bubble p { margin: 0 0 8px; }
.hint-bubble code {
  background: var(--blue-100);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--blue-900);
}
.hint-note { color: var(--muted); font-size: 12px; margin-bottom: 0 !important; }

@media (max-width: 900px) {
  .hint-bubble { right: 10px; bottom: 10px; width: min(280px, calc(100vw - 20px)); }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar nav { display: flex; gap: 8px; padding: 8px; }
  .sidebar nav a { flex: 1; text-align: center; }
}
