* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #0a3db8;
  --blue2: #072f8d;
  --dark: #08142f;
  --text: #111827;
  --muted: #5d667a;
  --soft: #f3f7ff;
  --line: #d8e3f3;
  --white: #fff;
  --danger: #d93025;
  --ok: #118b4f;
  --warn: #b26a00;

  --card-bg:
    radial-gradient(circle at top right, rgba(37, 99, 235, .045), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, .99), rgba(248, 251, 255, .97));

  --card-border: rgba(165, 185, 220, .76);

  --card-shadow:
    0 16px 42px rgba(8, 20, 47, .115),
    inset 0 1px 0 rgba(255, 255, 255, .96);

  --card-shadow-soft:
    0 12px 32px rgba(8, 20, 47, .09),
    inset 0 1px 0 rgba(255, 255, 255, .95);

  --shadow: 0 24px 70px rgba(20, 88, 255, .14);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------------- ZÁKLAD ---------------- */

body {
  font-family: "Segoe UI", Roboto, Arial, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(10, 61, 184, .14), transparent 38%),
    radial-gradient(circle at bottom right, rgba(7, 47, 141, .09), transparent 36%),
    linear-gradient(135deg, #edf4ff 0%, #dde9fb 100%);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------------- LOGIN ---------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(440px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 30px;
  padding: 34px;
}

.smart-login-card {
  width: min(480px, 100%);
  padding: 38px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 30px;
}

.login-logo img {
  width: 260px;
  max-width: 100%;
  height: auto;
  display: block;
}

.logo-mark,
.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 27px;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  box-shadow: 0 12px 30px rgba(10, 61, 184, .25);
}

.brand-icon,
.logo-mark {
  display: none !important;
}

.login-logo strong,
.brand strong {
  font-size: 24px;
  color: #17325f;
  display: block;
  font-weight: 700;
}

.login-logo span,
.brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.smart-login-card .lead {
  font-size: 16px;
  line-height: 1.55;
  margin-top: 12px;
  margin-bottom: 26px;
}

/* ---------------- NADPISY ---------------- */

h1 {
  font-size: 34px;
  color: var(--dark);
  line-height: 1.05;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 22px;
  color: var(--dark);
  font-weight: 700;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.page-title h1,
.login-card h1 {
  letter-spacing: -0.04em;
  color: #08142f;
}

.login-card h1 span {
  color: #0a3db8;
}

.lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 22px;
  font-weight: 400;
}

/* ---------------- FORMULÁŘE ---------------- */

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  color: #1c2945;
  font-weight: 600;
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(170, 190, 225, .78);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 400;
  outline: none;
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 4px 12px rgba(8, 20, 47, .035);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow:
    0 0 0 4px rgba(10, 61, 184, .09),
    inset 0 1px 0 rgba(255, 255, 255, .95);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

/* ---------------- BUTTONY ---------------- */

.btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  font-weight: 650;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: .15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0a3db8, #072f8d);
  color: #fff;
  box-shadow: 0 14px 34px rgba(20, 88, 255, .25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(20, 88, 255, .32);
}

.btn-light {
  background:
    linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  color: var(--blue);
  border: 1px solid rgba(165, 185, 220, .70);
  box-shadow: 0 8px 20px rgba(8, 20, 47, .06);
}

.btn-danger {
  background: #fff0f0;
  color: var(--danger);
  border: 1px solid rgba(255, 190, 190, .9);
}

.btn-full {
  width: 100%;
}

.btn:hover {
  transform: translateY(-1px);
}

/* ---------------- ALERTY ---------------- */

.alert {
  padding: 13px 15px;
  border-radius: 16px;
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 22px rgba(8, 20, 47, .055);
}

.alert-error {
  background: #fff0f0;
  color: #9f1d14;
  border: 1px solid #ffd2d2;
}

.alert-ok {
  background: #effaf4;
  color: #0d6d3e;
  border: 1px solid #ccefdc;
}

/* ---------------- LAYOUT ---------------- */

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    radial-gradient(circle at top left, rgba(10, 61, 184, .12), transparent 38%),
    linear-gradient(180deg, #eef5ff 0%, #dce9fb 48%, #cbdaf2 100%);
  border-right: 1px solid rgba(150, 175, 215, .55);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow:
    12px 0 38px rgba(8, 20, 47, .10),
    inset -1px 0 0 rgba(255, 255, 255, .55);
}

.content {
  padding: 24px 26px;
  overflow: auto;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------------- BRAND / STARÉ MENU ---------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.system-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 14px 0;
  text-decoration: none;
}

.system-brand img {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.logout {
  padding: 13px 14px;
  border-radius: 15px;
  color: #19233d;
  font-weight: 650;
  transition: .2s ease;
}

.nav a:hover,
.logout:hover {
  background: rgba(255, 255, 255, .72);
  color: var(--blue);
  box-shadow: 0 8px 18px rgba(8, 20, 47, .06);
}

.nav a:hover {
  transform: translateX(2px);
}

.logout {
  color: var(--danger);
}

/* ---------------- USER BOX ---------------- */

.sidebar-user {
  margin-top: auto;
  border: 1px solid rgba(165, 185, 220, .72);
  border-radius: 20px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .06), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 251, 255, .94));
  box-shadow: var(--card-shadow-soft);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: #eaf1ff;
  color: #0a3db8;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.sidebar-user strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.sidebar-user span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* ---------------- KARTY ---------------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.stat {
  min-height: 132px;
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #eef4ff 0%, #dce9ff 100%);
  color: #0a3db8;
  display: grid;
  place-items: center;
  font-size: 28px;
  margin-bottom: 18px;
  border: 1px solid rgba(165, 185, 220, .70);
  box-shadow:
    0 10px 24px rgba(10, 61, 184, .10),
    inset 0 1px 0 rgba(255, 255, 255, .90);
}

.stat strong {
  display: block;
  font-size: 34px;
  color: var(--dark);
  font-weight: 750;
}

.stat span {
  color: var(--muted);
  font-weight: 600;
}

/* ---------------- TABULKY ---------------- */

.table-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

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

th,
td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(216, 227, 243, .95);
  vertical-align: middle;
}

th {
  background:
    linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
  color: #5d667a;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
}

td {
  font-size: 14px;
  font-weight: 400;
}

.table-card table tr:hover td {
  background: rgba(238, 245, 255, .62);
}

td.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---------------- BADGE ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid rgba(255, 255, 255, .65);
}

.badge-ok {
  background: #eafaf1;
  color: var(--ok);
}

.badge-off {
  background: #eef1f6;
  color: var(--muted);
}

.badge-warn {
  background: #fff4df;
  color: var(--warn);
}

.badge-admin {
  background: #fff1d6;
  color: #9a6200;
}

/* ---------------- FORM KARTY ---------------- */

.form-card {
  max-width: 820px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

/* ---------------- SCHRÁNKY VE SCHÉMATU ---------------- */

.house-layout {
  display: grid;
  gap: 10px;
  margin-top: 15px;
  padding: 14px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .045), transparent 34%),
    linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  border: 1px solid rgba(165, 185, 220, .70);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 10px 26px rgba(8, 20, 47, .06);
}

.mailbox-tile {
  border: 1px solid rgba(180, 200, 230, .78);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .045), transparent 35%),
    linear-gradient(180deg, #fff, #f8fbff);
  border-radius: 18px;
  min-height: 82px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: .18s ease;
  box-shadow:
    0 8px 20px rgba(8, 20, 47, .055),
    inset 0 1px 0 rgba(255, 255, 255, .92);
}

.mailbox-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(10, 61, 184, .14);
  border-color: rgba(10, 61, 184, .38);
}

.mailbox-tile strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: #eef4ff;
  color: #0a3db8;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid rgba(165, 185, 220, .65);
}

.mailbox-tile span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.25;
}

.mailbox-tile.empty-box {
  opacity: .45;
}

.mailbox-tile.mailbox-inactive {
  background: #eef1f6;
  border-color: #d6dce8;
  opacity: .66;
}

.mailbox-tile.mailbox-inactive strong {
  background: #e1e6ef;
  color: #8791a5;
}

.mailbox-tile.mailbox-inactive span {
  color: #98a1b2;
}

.mailbox-tile.mailbox-inactive:hover {
  opacity: .85;
}

.mailbox-tile.mailbox-empty {
  background: linear-gradient(180deg, #ffffff, #f4f7fc);
  border-style: dashed;
}

.mailbox-tile.mailbox-inactive.mailbox-empty {
  background: #edf0f5;
  border-style: dashed;
}

/* ---------------- META BLOKY ---------------- */

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.meta {
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
  border: 1px solid rgba(175, 195, 225, .72);
  border-radius: 16px;
  padding: 13px;
  box-shadow:
    0 8px 20px rgba(8, 20, 47, .055),
    inset 0 1px 0 rgba(255, 255, 255, .95);
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.meta strong {
  display: block;
  margin-top: 4px;
  color: var(--dark);
  font-weight: 650;
}

.codebox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #08142f;
  color: #e8f0ff;
  border-radius: 16px;
  padding: 14px;
  overflow: auto;
  font-size: 13px;
  box-shadow: 0 14px 34px rgba(8, 20, 47, .16);
}

/* ---------------- SIDEBAR BADGES ---------------- */

.nav-with-badges a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-with-badges a span {
  min-width: 0;
}

.nav-badge {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef1f6;
  color: #5d667a;
  font-style: normal;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.nav-badge-green {
  background: #eafaf1;
  color: #118b4f;
}

.nav-badge-red {
  background: #fff0f0;
  color: #d93025;
}

.nav-badge-blue {
  background: #eaf1ff;
  color: #0a3db8;
}

/* ---------------- DŮLEŽITÉ OBJEDNÁVKY V MENU ---------------- */

.nav-with-badges a.nav-important {
  background: #effaf4;
  color: #0d7a43;
  border: 1px solid #ccefdc;
}

.nav-with-badges a.nav-important:hover {
  background: #e5f8ee;
  color: #0d7a43;
}

.nav-badge-pulse {
  animation: badgePulse 1.2s infinite;
  box-shadow: 0 0 0 0 rgba(17, 139, 79, .45);
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(17, 139, 79, .45);
  }

  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 9px rgba(17, 139, 79, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(17, 139, 79, 0);
  }
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .content {
    padding: 22px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  th,
  td {
    padding: 12px 13px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 18px;
    border-right: none;
    border-bottom: 1px solid rgba(229, 235, 245, .95);
  }

  .content {
    padding: 20px;
  }

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

@media (max-width: 700px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .page-title {
    display: block;
    margin-bottom: 18px;
  }

  .page-title .btn {
    margin-top: 14px;
  }

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

  .card,
  .table-card {
    border-radius: 20px;
  }

  .card {
    padding: 18px;
  }

  .content {
    padding: 16px;
  }
}

@media (max-width: 620px) {
  .login-page {
    padding: 16px;
  }

  .login-card,
  .smart-login-card {
    padding: 26px;
    border-radius: 24px;
  }

  .login-logo img {
    width: 220px;
  }

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

  .form-actions .btn {
    width: 100%;
  }

  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 14px;
  }

  th,
  td {
    padding: 11px 10px;
    font-size: 13px;
  }

  .btn {
    padding: 12px 15px;
    font-size: 14px;
  }

  .badge {
    font-size: 11px;
    padding: 5px 8px;
  }
}

/* ---------------- FONT WEIGHT TUNING ---------------- */

body {
    font-weight: 400;
}

h1,
.dashboard-head h1 {
    font-weight: 650;
    letter-spacing: -0.025em;
}

h2,
.dash-card-head h2 {
    font-weight: 650;
}

.smart-nav-text strong {
    font-weight: 650;
}

.smart-nav-text small {
    font-weight: 500;
}

.smart-nav-badge {
    font-weight: 650;
}

.metric-label {
    font-weight: 550;
}

.metric-body strong {
    font-weight: 700;
}

.dash-card-head p,
.dashboard-head p,
.lead {
    font-weight: 400;
}

.mini-summary span {
    font-weight: 500;
}

.mini-summary strong {
    font-weight: 700;
}

.dash-link {
    font-weight: 650;
}

.dash-table th {
    font-weight: 650;
}

.dash-table td strong {
    font-weight: 650;
}

.btn {
    font-weight: 600;
}

.badge {
    font-weight: 600;
}

.smart-user-info strong {
    font-weight: 650;
}

.smart-user-info span {
    font-weight: 600;
}

.smart-logout {
    font-weight: 650;
}