:root {
  --accent: #ffd400;
  --text: #111111;
  --muted: #687280;
  --line: #e8ebf0;
  --panel: #ffffff;
  --page: #f7f8fa;
  --desk-radius: 10px;
  --desk-sidebar: 188px;
  --desk-topbar: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font: 14px/1.35 Roboto, Arial, sans-serif;
}
button, input, select, textarea, table { font-family: Roboto, Arial, sans-serif; }

.desk-layout {
  height: 100%;
  display: grid;
  grid-template-columns: var(--desk-sidebar) minmax(0, 1fr);
  background: var(--page);
}

.desk-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.desk-side-top {
  height: var(--desk-topbar);
  flex: 0 0 var(--desk-topbar);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}
.desk-menu-mark { color: #5d6673; font-size: 22px; line-height: 1; }
.desk-logo {
  color: var(--text);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -1px;
  text-decoration: none;
}
.desk-logo-accent { color: #e7b900; }
.desk-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 10px;
}
.desk-nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #222;
  font-weight: 600;
  text-decoration: none;
}
.desk-nav-item:hover {
  background: #fff7d4;
  border-color: #ffe78a;
  color: #111111;
}
.desk-nav-item.active {
  background: #fff7d4;
  border-color: #ffe78a;
  color: #111111;
}
.desk-nav-item:hover .desk-nav-icon,
.desk-nav-item.active .desk-nav-icon,
.desk-nav-item:hover > span,
.desk-nav-item.active > span { color: #111111; }
.desk-nav-icon {
  width: 20px;
  flex: 0 0 20px;
  color: #647080;
  text-align: center;
  font-weight: 500;
}
.desk-side-bottom {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: #7a8491;
  font-size: 12px;
}

.desk-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--desk-topbar) minmax(0, 1fr);
}
.desk-topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.desk-page-title { font-size: 21px; font-weight: 800; white-space: nowrap; }
.desk-top-spacer { flex: 1; }
.desk-search {
  width: 250px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #56606d;
}
.desk-search:focus { outline: 2px solid rgba(255, 212, 0, .35); border-color: #e6c100; }
.desk-global-search { position: relative; }

.desk-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(460px, 80vw);
  max-height: 420px;
  overflow: auto;
  z-index: 1200;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
}

.desk-search-result {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.desk-search-result:hover,
.desk-search-result:focus {
  background: #f6f7f9;
  outline: none;
}

.desk-search-result span,
.desk-search-result small {
  color: #6b7280;
  font-size: 12px;
}

.desk-search-result strong {
  color: #171a1f;
  font-size: 14px;
}

.desk-search-state {
  padding: 12px;
  color: #6b7280;
  font-size: 13px;
}

.desk-search-recent-title {
  padding: 7px 10px 5px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.desk-search-recent {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #171a1f;
  text-align: left;
  cursor: pointer;
}

.desk-search-recent:hover,
.desk-search-recent:focus {
  background: #f6f7f9;
  outline: none;
}

.desk-top-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5e6875;
  font-size: 18px;
  text-decoration: none;
}
.desk-top-icon:hover { background: #f7f8fa; }
.desk-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 7px 5px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.desk-user:hover { background: #f7f8fa; }
.desk-user:focus-visible { outline: 2px solid rgba(112, 87, 215, .35); outline-offset: 2px; }
.desk-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #efeaff;
  color: #7057d7;
  font-weight: 800;
}
.desk-user-meta { line-height: 1.1; }
.desk-user-meta b { display: block; font-size: 12px; }
.desk-user-meta span { color: #7b8490; font-size: 11px; }

.desk-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}
#app.desk-content {
  width: 100%;
  margin: 0;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
}
.desk-placeholder {
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--desk-radius);
  box-shadow: 0 1px 2px rgba(20, 28, 40, .03);
  text-align: center;
}
.desk-placeholder-inner { max-width: 520px; }
.desk-placeholder-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 10px;
  background: #fff7d4;
  border: 1px solid #ffe78a;
  font-size: 20px;
}
.desk-placeholder h1 { margin: 0 0 8px; font-size: 24px; }
.desk-placeholder p { margin: 0; color: var(--muted); }
.desk-placeholder-note { margin-top: 7px !important; font-size: 12px; }

/* Existing Desk screens remain rendered by the established app.js. */
.desk-content > .loading-screen,
.desk-content > .error { min-height: 240px; }
.desk-content .page-head { margin-top: 0; }
.desk-content .dialogs-shell { min-height: calc(100vh - 113px); }

.attachment-viewer { z-index: 100; }
.toast { z-index: 110; }

@media (max-width: 1250px) {
  :root { --desk-sidebar: 160px; }
  .desk-search { width: 210px; }
  .desk-side-top { padding: 0 16px; }
}
@media (max-width: 860px) {
  :root { --desk-sidebar: 72px; }
  .desk-side-top { justify-content: center; padding: 0; }
  .desk-menu-mark, .desk-logo { font-size: 0; }
  .desk-logo::after { content: "D"; font-size: 23px; font-weight: 900; }
  .desk-nav-item { justify-content: center; padding: 0; }
  .desk-nav-item > :not(.desk-nav-icon), .desk-side-bottom { font-size: 0; }
  .desk-user-meta, .desk-user-caret, .desk-search { display: none; }
  #app.desk-content { padding: 14px; }
}

.desk-login-remember {
  display: flex !important;
  align-items: center;
  align-self: end;
  gap: 8px !important;
  min-height: 38px;
  white-space: nowrap;
}
.desk-login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex: 0 0 16px;
}
