:root {
  --ink: #172033;
  --muted: #647089;
  --line: #dfe6f1;
  --panel: #ffffff;
  --canvas: #f4f7fb;
  --soft: #f8fafd;
  --nav: #ffffff;
  --nav-2: #eef4ff;
  --teal: #06766f;
  --blue: #4a63f3;
  --cyan: #52bfd1;
  --amber: #b7791f;
  --danger: #b42318;
  --ok: #15803d;
  --shadow: 0 16px 40px rgba(42, 54, 83, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f7faff 0, #eef3f9 100%);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(232,239,251,0.9)),
    radial-gradient(circle at 18% 0%, rgba(74,99,243,0.18), transparent 34%);
}

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: var(--shadow);
  padding: 28px;
  border-radius: var(--radius);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--nav);
  color: #fff;
  font-weight: 800;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

.side-logo {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 10px 22px rgba(74,99,243,0.18));
}

.brand-mark h1,
.brand-mark p {
  margin: 0;
}

.brand-mark h1 {
  font-size: 24px;
}

.brand-mark p {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 11px;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
}

.primary {
  background: linear-gradient(135deg, var(--teal), #089d91);
  color: #fff;
}

.secondary {
  background: linear-gradient(135deg, var(--blue), #6377ff);
  color: #fff;
}

.danger {
  background: var(--danger);
  color: #fff;
}

.ghost {
  background: #eef3fb;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button-link {
  text-decoration: none;
}

.error {
  color: var(--danger);
  min-height: 22px;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.side {
  background: var(--nav);
  color: var(--ink);
  padding: 24px 20px;
  border-right: 1px solid var(--line);
}

.side .brand-mark {
  margin: 0 0 30px;
}

.side .brand-icon {
  background: #edf3ff;
}

.side p {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #2b3548;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-list button.active,
.nav-list button:hover {
  background: #eef4ff;
  color: var(--blue);
}

.nav-icon,
.panel-icon,
.ui-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  position: relative;
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #f2f5fb;
  color: #6b7690;
}

.nav-list button.active .nav-icon,
.nav-list button:hover .nav-icon {
  background: #dfe7ff;
  color: var(--blue);
}

.nav-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.nav-icon.library::before {
  border-radius: 2px;
  border-top-width: 5px;
}

.nav-icon.records::before {
  width: 11px;
  height: 14px;
  border-radius: 2px;
}

.nav-icon.people::before {
  border-radius: 50%;
  width: 9px;
  height: 9px;
}

.nav-icon.email::before {
  width: 13px;
  height: 9px;
  border-radius: 2px;
  transform: skewY(-8deg);
}

.nav-icon.settings::before,
.nav-icon.integrations::before {
  border-radius: 50%;
}

.nav-icon.audit::before {
  width: 13px;
  height: 9px;
}

.content {
  min-width: 0;
}

.topbar {
  height: 76px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
}

.topbar input {
  width: min(520px, 52vw);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: #f9fbfe;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  padding: 24px 32px 36px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title h2,
.section-title p {
  margin: 0;
}

.section-title p {
  color: var(--muted);
}

.section-title.compact {
  align-items: center;
  margin-bottom: 12px;
}

.section-title.compact h3,
.section-title.compact p {
  margin: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(42, 54, 83, 0.045);
}

.stat {
  padding: 20px;
  min-height: 132px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  font-size: 32px;
  margin-top: 6px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.quick-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.wide {
  grid-column: 1 / -1;
}

.panel-headline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-headline h3,
.panel-headline p {
  margin: 0;
}

.panel-headline p {
  color: var(--muted);
  font-size: 13px;
}

.panel-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #eef4ff;
  color: var(--blue);
}

.panel-icon::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.panel-icon.upload::before {
  border-radius: 3px;
  border-top-width: 7px;
}

.panel-icon.shield::before {
  border-radius: 9px 9px 12px 12px;
}

.panel-icon.access::before {
  width: 16px;
  height: 12px;
  border-radius: 2px;
}

.panel-icon.firm::before {
  width: 16px;
  height: 18px;
  border-radius: 2px;
}

.panel-icon.backup::before {
  width: 18px;
  height: 14px;
  border-radius: 6px;
  border-top-width: 6px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  margin: 8px 0 14px;
}

.soft-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin: 10px 0;
  padding: 0;
}

.soft-details > summary,
.nested-details > summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  padding: 11px 12px;
  list-style: none;
}

.soft-details > summary::-webkit-details-marker,
.nested-details > summary::-webkit-details-marker {
  display: none;
}

.soft-details > summary::after,
.nested-details > summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.soft-details[open] > summary::after,
.nested-details[open] > summary::after {
  content: "-";
}

.soft-details > :not(summary) {
  margin-left: 12px;
  margin-right: 12px;
}

.inline-details {
  background: var(--soft);
}

.inline-details[open] {
  padding-bottom: 10px;
}

.nested-details {
  border-top: 1px solid var(--line);
  margin: 8px 0;
}

.nested-details > :not(summary) {
  margin-left: 4px;
  margin-right: 4px;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(42, 54, 83, 0.04);
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fbfe;
  padding: 10px;
  margin-bottom: 10px;
}

.toggle-row span,
.toggle-row small {
  display: block;
}

.toggle-row small {
  color: var(--muted);
  margin-top: 2px;
}

.legal-details {
  margin: 16px 0;
}

.file-manager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.fm-main,
.fm-properties {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  min-height: 420px;
  box-shadow: 0 10px 26px rgba(23, 33, 43, 0.06);
}

.fm-main {
  padding: 14px;
}

.fm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.fm-search {
  flex: 1 1 260px;
  position: relative;
}

.fm-search .ui-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.ui-icon.search::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.ui-icon.search::after {
  content: "";
  width: 7px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
  position: absolute;
  right: -4px;
  bottom: 2px;
}

.fm-toolbar input,
.fm-toolbar select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.fm-toolbar input {
  width: 100%;
  padding-left: 36px;
}

.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 20px 18px;
  align-items: start;
}

.fm-tile {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-height: 118px;
  padding: 10px 8px;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  text-align: center;
}

.fm-tile:hover,
.fm-tile.selected {
  background: #e9f7f6;
  outline: 1px solid rgba(15, 118, 110, 0.32);
}

.fm-icon {
  width: 48px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, #9aa4ad, #777f87);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: inset 0 1px rgba(255,255,255,0.25);
  position: relative;
}

.fm-icon::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 7px;
  width: 20px;
  height: 7px;
  border-radius: 4px 4px 0 0;
  background: inherit;
}

.fm-icon.pdf {
  background: linear-gradient(180deg, #dc2626, #991b1b);
}

.fm-icon.doc {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

.fm-icon.image {
  background: linear-gradient(180deg, #0f766e, #115e59);
}

.fm-icon.text {
  background: linear-gradient(180deg, #64748b, #475569);
}

.fm-icon.locked {
  background: linear-gradient(180deg, #b7791f, #92400e);
}

.fm-name {
  max-width: 120px;
  word-break: break-word;
  font-size: 13px;
}

.fm-meta {
  color: var(--muted);
  font-size: 11px;
}

.fm-properties {
  padding: 16px;
  position: sticky;
  top: 84px;
}

.fm-properties h3,
.fm-properties h4 {
  margin: 0 0 12px;
}

.fm-prop-head {
  display: flex;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.fm-prop-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.fm-action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.property-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.property-grid > div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.property-grid strong,
.property-grid span {
  display: block;
}

.property-grid strong {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.property-line {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.property-line strong,
.property-line span {
  display: block;
}

.property-line strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.property-line span {
  margin-top: 3px;
  word-break: break-word;
}

.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.fm-security {
  padding-top: 12px;
  margin-top: 12px;
}

.fm-security .field input,
.fm-security .field select,
.fm-security .field textarea {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.acl-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 52px 72px 52px;
  gap: 7px;
  align-items: center;
  font-size: 12px;
  margin: 10px 0 14px;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.mini-list > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--soft);
}

.empty {
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 20px;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px;
  background: var(--soft);
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.empty-state.compact {
  padding: 18px;
}

pre.small {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 240px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f7fafc;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  background: #e8eef2;
}

.pill.ok {
  color: var(--ok);
  background: #dcfce7;
}

.pill.warn {
  color: var(--amber);
  background: #fef3c7;
}

.pill.danger {
  color: var(--danger);
  background: #fee2e2;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item strong,
.item span {
  display: block;
}

.item span {
  color: var(--muted);
  margin-top: 2px;
}

.small {
  color: var(--muted);
  font-size: 13px;
}

.tab-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.active-tab {
  background: #d9f3f1;
  color: var(--teal);
  outline: 1px solid rgba(15, 118, 110, 0.28);
}

.progress-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.48);
  backdrop-filter: blur(3px);
}

.progress-modal {
  width: min(460px, 100%);
  border: 1px solid rgba(255,255,255,0.48);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.98)),
    radial-gradient(circle at 18% 0%, rgba(82,191,209,0.22), transparent 34%);
  box-shadow: 0 24px 70px rgba(23, 33, 43, 0.28);
  padding: 20px;
}

.progress-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.progress-head h3,
.progress-head p {
  margin: 0;
}

.progress-head p {
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

.progress-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: #e7f7f6;
  color: var(--teal);
  position: relative;
}

.progress-icon::before {
  content: "";
  width: 20px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 5px;
  background: rgba(255,255,255,0.36);
}

.progress-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  top: 14px;
}

.progress-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe5ec;
  box-shadow: inset 0 1px 2px rgba(23, 33, 43, 0.1);
}

.progress-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--cyan));
  transition: width 0.18s ease;
}

.progress-backdrop.indeterminate .progress-meter span {
  width: 38%;
  animation: progress-slide 1.1s ease-in-out infinite;
}

.progress-backdrop.complete .progress-meter span {
  background: linear-gradient(90deg, var(--ok), #22c55e);
}

.progress-backdrop.failed .progress-meter span {
  width: 100%;
  background: linear-gradient(90deg, var(--danger), #ef4444);
}

.progress-status {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0 8px;
  color: var(--muted);
}

.progress-status strong {
  color: var(--ink);
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-110%);
  }
  50% {
    transform: translateX(80%);
  }
  100% {
    transform: translateX(280%);
  }
}

.cloud-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.device-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(82,191,209,0.14), transparent 32%),
    linear-gradient(180deg, #fff, #f8fbfc);
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(23, 33, 43, 0.06);
}

.device-card.inactive {
  opacity: 0.82;
  background: linear-gradient(180deg, #fff, #f3f6f8);
}

.device-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.device-card h3,
.device-card p {
  margin: 0;
}

.device-card-head p,
.device-reasons {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: #e8eef2;
  color: var(--muted);
}

.status-pill.ok {
  background: #dcfce7;
  color: var(--ok);
}

.status-pill.warn {
  background: #fef3c7;
  color: var(--amber);
}

.status-pill.bad {
  background: #fee2e2;
  color: var(--danger);
}

.device-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.device-metrics span {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 9px;
  min-width: 0;
}

.device-metrics strong,
.device-metrics small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-metrics strong {
  font-size: 12px;
  white-space: nowrap;
}

.device-metrics small {
  color: var(--muted);
  margin-top: 3px;
}

.device-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.device-manage-panel .quick-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
}

.empty-card {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  padding: 22px;
}

.directory-panel {
  padding-bottom: 13px;
}

.directory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.directory-search {
  flex: 1 1 340px;
  position: relative;
}

.directory-search .ui-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.directory-toolbar input,
.directory-toolbar select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.directory-toolbar input {
  width: 100%;
  padding-left: 36px;
}

.directory-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.contact-results {
  min-height: 420px;
}

.contact-side {
  position: sticky;
  top: 84px;
}

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

.contact-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f9fcfd);
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(23, 33, 43, 0.05);
}

.contact-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.contact-card-head strong,
.contact-card-head small {
  display: block;
}

.contact-card-head small {
  color: var(--muted);
  margin-top: 2px;
}

.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #e7f7f6;
  color: var(--teal);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.contact-lines {
  display: grid;
  gap: 7px;
}

.contact-lines span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 9px;
  color: var(--ink);
  word-break: break-word;
}

.contact-lines b {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.contact-card p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e8eef2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.blocklist-control {
  gap: 8px;
}

.blocklist-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fbfe;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.block-chip {
  min-height: 30px;
  background: #fee2e2;
  color: var(--danger);
}

.block-chip button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.blocklist-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.blocklist-add input {
  min-height: 34px;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.import-summary span {
  color: var(--muted);
}

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

  .side {
    position: static;
  }

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

  .stats,
  .grid-2,
  .file-manager,
  .quick-form,
  .settings-layout,
  .contact-layout,
  .device-detail-grid,
  .device-manage-panel .quick-form {
    grid-template-columns: 1fr;
  }

  .fm-properties,
  .contact-side {
    position: static;
  }

  .topbar {
    height: auto;
    padding: 14px;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar input {
    width: 100%;
  }

  .topbar-user,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

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