﻿:root {
  --bg-main: #f4f8fc;
  --bg-accent: #e9f2fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #d6e4f2;
  --line-strong: #c1d6ea;
  --text: #0f2740;
  --text-soft: #5d748c;
  --brand: #1a8e82;
  --brand-2: #177fcf;
  --brand-soft: #dff5f0;
  --danger: #c4414a;
  --warning: #d69a26;
  --success: #27a86b;
  --sidebar-start: #0b3156;
  --sidebar-mid: #0f4e84;
  --sidebar-end: #0a2742;
  --shadow-sm: 0 6px 16px rgba(12, 35, 61, 0.08);
  --shadow-md: 0 14px 34px rgba(8, 26, 47, 0.12);
  --radius-md: 14px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Be Vietnam Pro', 'Segoe UI', Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 560px at 2% -8%, rgba(106, 190, 255, 0.24), transparent 58%),
    radial-gradient(980px 460px at 98% 0%, rgba(112, 228, 189, 0.18), transparent 56%),
    linear-gradient(180deg, var(--bg-main), var(--bg-accent));
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 84px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(680px 360px at -20% -8%, rgba(130, 203, 255, 0.22), transparent 56%),
    radial-gradient(760px 360px at 110% -4%, rgba(95, 175, 255, 0.2), transparent 54%),
    linear-gradient(168deg, var(--sidebar-start), var(--sidebar-mid) 58%, var(--sidebar-end));
  color: #e8f4ff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  box-shadow: var(--shadow-sm);
}

.brand-logo-wrap {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 8px 18px rgba(6, 34, 56, 0.28);
  background: linear-gradient(180deg, #6cc8ff, #3f9ee8);
  flex: 0 0 46px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-text {
  display: grid;
  line-height: 1.2;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 13px;
  color: #cfe4fb;
}

.sidebar-toggle {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.26);
}

.menu {
  display: grid;
  gap: 6px;
}

.menu-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #ebf6ff;
  border-radius: var(--radius-md);
  padding: 10px 11px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.menu-btn:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
}

.menu-btn.active {
  background: linear-gradient(92deg, rgba(202, 235, 255, 0.42), rgba(173, 223, 255, 0.18));
  border-color: rgba(184, 228, 255, 0.82);
  box-shadow: inset 3px 0 0 #c8e9ff, 0 8px 20px rgba(0, 16, 31, 0.24);
}

.nav-ico {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 13px;
  flex: 0 0 24px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.ghost {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));
  color: #f0f8ff;
  padding: 10px 12px;
  font-size: 15px;
  cursor: pointer;
}

.ghost:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
}

.content {
  min-height: 100vh;
  padding: 12px;
  padding-bottom: 58px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(540px, 1.4fr);
  gap: 12px;
  align-items: center;
}

.topbar-left {
  display: grid;
  gap: 4px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.status-line {
  color: var(--text-soft);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
}

.topbar-right > *,
.software-toolbar > * {
  height: 42px;
}

.topbar-right.software-mode {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.software-toolbar {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(230px, 1fr) auto;
  gap: 10px;
  flex: 1 1 520px;
  min-width: 360px;
  max-width: 760px;
}

.quick-search,
.quick-filter,
.topbar-right input,
.topbar-right select {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  width: 100%;
  font-family: inherit;
}

.topbar-add-btn {
  min-width: 156px;
  font-weight: 700;
}

.topbar-category-btn {
  min-width: 128px;
}

.current-user-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f2f8ff);
  min-height: 42px;
  min-width: 0;
  max-width: 360px;
  flex: 0 0 auto;
}

.current-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #1a3c5c;
  background: linear-gradient(180deg, #eaf5ff, #d6eaff);
  border: 1px solid #bfd8ee;
  flex: 0 0 28px;
}

.current-user-meta {
  display: grid;
  line-height: 1.08;
  min-width: 0;
  max-width: 150px;
}

.current-user-name {
  font-size: 12px;
  font-weight: 700;
  color: #17314b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-user-role {
  font-size: 10px;
  color: #5f7890;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-user-box .action {
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.tab {
  display: none;
}

.tab.active {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
}

#tab-users .grid-2 {
  display: grid;
  grid-template-columns: minmax(500px, 1.25fr) minmax(360px, 0.75fr);
  gap: 12px;
}

#tab-maintenance .grid-2,
#tab-departments .grid-2,
.files-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.panel {
  min-width: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow-sm);
  padding: 10px;
}

.panel:hover {
  box-shadow: 0 10px 22px rgba(8, 26, 47, 0.11);
}

.panel h2 {
  margin: 0 0 10px;
  border-radius: 11px;
  border: 1px solid #dbe8f5;
  background: linear-gradient(180deg, #f8fcff, #edf6ff);
  padding: 9px 11px;
  font-size: 16px;
}

.panel h3 {
  margin: 0;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.inline-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat-card,
.users-summary-card,
.health-item,
.mini-stat {
  border: 1px solid #d9e7f5;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f5faff);
  box-shadow: 0 4px 12px rgba(13, 37, 60, 0.06);
}

.stat-card {
  padding: 10px;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ebf5ff;
  border: 1px solid #cee2f5;
}

.stat-label {
  font-size: 12px;
  color: var(--text-soft);
}

.stat-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 800;
}

.dashboard-bento {
  display: grid;
  grid-template-columns: minmax(460px, 1.28fr) minmax(320px, 0.72fr);
  gap: 12px;
}

.dashboard-bento > .panel:first-child {
  grid-column: 1 / -1;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(260px, 0.8fr);
  gap: 12px;
  background:
    radial-gradient(560px 160px at 2% 0%, rgba(127, 211, 255, 0.28), transparent 58%),
    linear-gradient(180deg, #fbfeff, #ecf5ff);
}

.hero-left {
  display: grid;
  gap: 10px;
}

.hero-left h2 {
  margin: 0;
  font-size: 23px;
}

.hero-left p {
  margin: 0;
  color: #547088;
}

.hero-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1;
  color: #2b4d67;
  border: 1px solid #cde2f4;
  border-radius: 999px;
  padding: 7px 12px;
  background: #edf6ff;
}

.hero-right {
  display: grid;
  gap: 8px;
}

.mini-stat {
  padding: 9px 10px;
}

.mini-stat-label {
  font-size: 12px;
  color: #59738a;
}

.mini-stat-value {
  font-size: 18px;
  font-weight: 800;
}

.download-health {
  display: grid;
  gap: 10px;
}

.health-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #43607b;
}

.health-bar {
  border-radius: 999px;
  border: 1px solid #d5e3f1;
  height: 12px;
  overflow: hidden;
  background: #eaf1f9;
}

.health-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2fb07a, #5cd8aa);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.health-item {
  padding: 9px;
  display: grid;
  gap: 3px;
}

.health-k {
  font-size: 12px;
  color: #60798f;
}

.health-v {
  font-size: 18px;
  font-weight: 700;
}

.ideas-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  color: #3e5b73;
}

.software-cards-panel {
  width: 100%;
}

.software-inner-nav {
  padding: 8px 10px;
  align-self: start;
}

.software-subtab-btn.active {
  background: linear-gradient(180deg, #1fa594, var(--brand));
  border-color: transparent;
  color: #fff;
}

.software-subtab-panel {
  display: none;
  grid-template-columns: 1fr;
  gap: 12px;
}

.software-subtab-panel.active {
  display: grid;
}

.software-cards-wrap {
  display: grid;
  gap: 12px;
}

.category-list {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.category-row {
  border: 1px solid #d8e7f4;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f5faff);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-name {
  font-size: 14px;
  font-weight: 700;
  color: #234663;
}

.category-meta {
  font-size: 12px;
  color: #5d748b;
}

.software-category-group {
  border: 1px solid #d8e7f4;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfeff, #f4f9ff);
  padding: 10px;
}

.software-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.software-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.software-card {
  border: 1px solid #cfe2f3;
  border-radius: 16px;
  background:
    radial-gradient(220px 120px at 0% 0%, rgba(164, 216, 255, 0.18), transparent 58%),
    linear-gradient(180deg, #ffffff, #f5faff);
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: 0 9px 18px rgba(11, 33, 56, 0.08);
}

.software-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px rgba(11, 33, 56, 0.13);
}

.software-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.software-card-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(180deg, #f4f9ff, #e4f1ff);
  border: 1px solid #c6ddef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.software-card-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.software-card-icon-fallback {
  font-size: 13px;
  font-weight: 700;
  color: #2b4864;
}

.software-card-name-wrap {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.software-card-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #173652;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.software-card-sub {
  font-size: 12px;
  color: #607a92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.software-card-version {
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid #c7dff1;
  background: #eaf5ff;
  color: #234f73;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
}

.software-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.software-stat-item {
  border: 1px solid #d8e8f5;
  border-radius: 11px;
  background: #f8fcff;
  padding: 7px 9px;
  display: grid;
  gap: 2px;
}

.software-stat-label {
  font-size: 11px;
  color: #627d94;
}

.software-stat-value {
  font-size: 15px;
  font-weight: 800;
  color: #173a58;
}

.software-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.software-chip {
  border: 1px solid #d0e1ef;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: #345d7d;
  background: #f0f8ff;
}

.software-card .actions {
  display: flex;
  justify-content: flex-end;
}

.users-summary-strip,
.files-summary-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.users-summary-card {
  padding: 10px 12px;
  display: grid;
  gap: 5px;
}

.users-summary-k {
  font-size: 12px;
  color: #5f788f;
}

.users-summary-v {
  font-size: 18px;
  font-weight: 800;
}

.users-summary-selected {
  border-color: #b8d7ef;
  background: linear-gradient(180deg, #ecf7ff, #e2f1ff);
}

.table-wrap {
  border: 1px solid #dce8f3;
  border-radius: 12px;
  overflow: auto;
  max-height: 500px;
  background: #fff;
}

.users-token-panel {
  margin-top: 2px;
}

.token-table-wrap {
  max-height: 420px;
}

.token-table {
  table-layout: fixed;
  min-width: 1120px;
}

.token-table th,
.token-table td {
  white-space: nowrap;
}

.token-table .token-code {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: #223f57;
  background: #eef5fc;
  border: 1px solid #d4e3f1;
  border-radius: 8px;
  padding: 2px 6px;
}

.token-table .token-countdown {
  display: inline-flex;
  min-width: 84px;
  justify-content: center;
  font-weight: 700;
  color: #1f4f72;
  background: #ebf6ff;
  border: 1px solid #cbe1f4;
  border-radius: 999px;
  padding: 2px 8px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.table th,
.table td {
  border-bottom: 1px solid #e3edf6;
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f8ff;
  color: #2e4c66;
}

.table tr:hover td {
  background: #f8fcff;
}

.table tr.selected td {
  background: #e7f4ff;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  border: 1px solid #c6d8e9;
  background: #edf5fd;
  color: #2f526f;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 8px 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 6px;
}

.form-grid label {
  color: var(--text-soft);
  font-size: 12px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.icon-editor {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.icon-preview {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid #c5dbed;
  background: linear-gradient(180deg, #eef6ff, #dcecff);
  object-fit: contain;
  padding: 6px;
}

.icon-editor-fields {
  display: grid;
  gap: 6px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.form-actions.inline {
  margin-top: 10px;
}

.upload-progress {
  border: 1px solid #d3e4f3;
  border-radius: 12px;
  background: #f3f9ff;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #365b79;
}

.upload-progress-track {
  height: 10px;
  border: 1px solid #c9dff1;
  border-radius: 999px;
  background: #e6f1fb;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1d90cc, #28b89a);
  transition: width 0.2s ease;
}

button.primary,
button.danger,
button.action,
button.mini {
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

button.primary {
  background: linear-gradient(180deg, #1fa594, var(--brand));
  color: #fff;
  font-weight: 600;
  padding: 8px 12px;
}

button.primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button.danger {
  background: #ffeff1;
  border-color: #f3c5c9;
  color: #a32f39;
  padding: 8px 12px;
}

button.action,
button.mini {
  background: #e8f5ff;
  border-color: #c7deef;
  color: #265a7c;
  padding: 6px 9px;
  font-size: 12px;
}

button.action-danger {
  background: #fff1f2;
  border-color: #efc6c9;
  color: #9d3139;
}

.is-hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 24, 39, 0.48);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid #d6e4f2;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: 0 24px 52px rgba(8, 25, 45, 0.2);
  padding: 12px;
}

.modal-card.modal-small {
  width: min(520px, 100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.app-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 284px;
  height: 42px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #e4f0fb;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(90deg, rgba(8, 39, 63, 0.94), rgba(15, 68, 107, 0.9));
  backdrop-filter: blur(4px);
}

.app-footer-left {
  font-weight: 600;
}

.app-footer-right {
  font-size: 12px;
  opacity: 0.9;
}

.toast-container {
  position: fixed;
  right: 14px;
  bottom: 54px;
  z-index: 70;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 20px));
}

.toast {
  border-radius: 12px;
  border: 1px solid #cde0f0;
  background: #f7fbff;
  color: #11324f;
  box-shadow: 0 10px 24px rgba(12, 32, 52, 0.18);
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  animation: toast-in 0.2s ease;
}

.toast-title {
  font-size: 12px;
  font-weight: 700;
}

.toast-message {
  font-size: 13px;
}

.toast.success {
  border-color: #bde7cf;
  background: #ecfbf3;
  color: #175f3e;
}

.toast.error {
  border-color: #f0c2c6;
  background: #fff2f3;
  color: #892631;
}

.toast.warning {
  border-color: #f0ddb2;
  background: #fff8e9;
  color: #7a5311;
}

body.sidebar-collapsed .sidebar {
  padding: 14px 10px;
}

body.sidebar-collapsed .brand {
  justify-content: space-between;
  gap: 6px;
  padding: 8px 6px;
}

body.sidebar-collapsed .brand-logo-wrap {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-footer .ghost {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  position: static;
  width: 24px;
  height: 24px;
  margin-left: 0;
  flex: 0 0 24px;
  font-size: 12px;
}

body.sidebar-collapsed .menu-btn {
  justify-content: center;
  padding: 9px 6px;
  min-height: 42px;
  font-size: 0;
}

body.sidebar-collapsed .menu-btn .nav-ico + * {
  display: none;
}

body.sidebar-collapsed .app-footer {
  left: 84px;
}

@media (max-width: 1360px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-right,
  .topbar-right.software-mode {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .software-toolbar {
    grid-template-columns: 1fr;
    min-width: 0;
    max-width: none;
  }

  .current-user-box {
    max-width: 100%;
  }

  .dashboard-bento {
    grid-template-columns: 1fr;
  }

  .dashboard-bento > .panel:first-child {
    grid-column: auto;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  #tab-users .grid-2,
  #tab-maintenance .grid-2,
  #tab-departments .grid-2,
  .files-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid #cfe0ef;
  }

  .content {
    min-height: auto;
  }

  .users-summary-strip,
  .files-summary-strip,
  .stats-grid,
  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-footer,
  body.sidebar-collapsed .app-footer {
    left: 0;
  }
}

@media (max-width: 760px) {
  .users-summary-strip,
  .files-summary-strip,
  .stats-grid,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .brand-title {
    font-size: 24px;
  }
}

.badge.success {
  border-color: #b9e8d0;
  background: #e7f9ef;
  color: #1f8152;
}

.badge.danger {
  border-color: #f0c3c7;
  background: #fff1f2;
  color: #a23640;
}

.folder-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.folder-chip {
  border: 1px solid #d0e0ee;
  background: #f2f8ff;
  color: #335770;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}

.folder-chip.active {
  border-color: #95c5e6;
  background: #dff1ff;
  color: #174665;
  font-weight: 700;
}

.perm-software-name {
  font-weight: 600;
  color: #1a3e5c;
}

.perm-software-id {
  font-size: 11px;
  color: #60798f;
}

.empty-state {
  border: 1px dashed #c9dbec;
  border-radius: 12px;
  padding: 18px 14px;
  background: linear-gradient(180deg, #fbfeff, #f3f9ff);
  text-align: center;
  display: grid;
  gap: 6px;
}

.empty-state-icon {
  font-size: 20px;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: #234663;
}

.empty-state-desc {
  font-size: 12px;
  color: #5e7890;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.skeleton-card {
  border: 1px solid #d8e6f3;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  display: grid;
  gap: 8px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #eaf1f8;
  border-radius: 8px;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  animation: shimmer 1.3s infinite;
}

.skeleton-line {
  height: 12px;
}

.skeleton-line.w-30 { width: 30%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-70 { width: 70%; }

.skeleton-label {
  font-size: 12px;
  color: #6a8298;
}

.tab.active > .panel {
  animation: panel-in 0.28s ease both;
}

.tab.active > .panel:nth-child(2) { animation-delay: 0.03s; }
.tab.active > .panel:nth-child(3) { animation-delay: 0.06s; }
.tab.active > .panel:nth-child(4) { animation-delay: 0.09s; }

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
