:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  color-scheme: light;
  font-size: 16px;
  --canvas: #f3f5f5;
  --surface: #fff;
  --surface-soft: #f7f9f9;
  --text: #202a32;
  --muted: #52616b;
  --subtle: #5c6b75;
  --border: #dce3e5;
  --border-strong: #a4b3ba;
  --accent: #006b75;
  --accent-soft: #e5f7f6;
  --negative: #b42337;
  --negative-soft: #fff0f2;
  --positive: #187546;
  --spectrum: linear-gradient(100deg, #a47bff, #13b9ed 42%, #20d9c4 72%, #66edaf);
  --shadow: 0 3px 18px #203d4c05;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #152026;
  --surface: #1c2a31;
  --surface-soft: #223139;
  --text: #eff5f5;
  --muted: #b1c0c6;
  --subtle: #9baeb6;
  --border: #34454e;
  --border-strong: #677e89;
  --accent: #8be1d8;
  --accent-soft: #233f43;
  --negative: #ffabb7;
  --negative-soft: #442a35;
  --positive: #8bdeb0;
  --shadow: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100svh; display: flex; flex-direction: column; background: var(--canvas); color: var(--text); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--spectrum); z-index: 5; pointer-events: none; }
::selection { background: var(--accent-soft); color: var(--text); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; cursor: pointer; border: 0; transition: background .15s, border-color .15s; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
input, select { width: 100%; min-height: 47px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); color: var(--text); font-size: .875rem; }
input::placeholder { color: var(--subtle); opacity: 1; }
input:focus, select:focus { border-color: var(--accent); }
select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c6b75' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
label { font-size: .875rem; font-weight: 500; color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-weight: 550; letter-spacing: -.035em; }
p { line-height: 1.65; }
small { font-size: .75rem; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.symbol-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: 12px; left: 12px; transform: translateY(-150%); padding: 12px 18px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.skip-link:focus { transform: none; }

.site-header { min-height: 86px; display: flex; align-items: center; justify-content: space-between; padding: 20px 48px; border-bottom: 1px solid var(--border); background: var(--surface); gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; font-size: 1.375rem; font-weight: 650; letter-spacing: -.05em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; border-radius: 11px; background: linear-gradient(var(--surface),var(--surface)) padding-box, linear-gradient(100deg,#13b9ed,#20d9c4 60%,#66edaf) border-box; color: var(--accent); font-size: 1.5rem; font-weight: 750; font-style: italic; letter-spacing: -.08em; padding-right: 3px; }
.brand-home { margin-left: 8px; color: var(--accent); font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .13em; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.header-date { color: var(--muted); font-size: .875rem; }
.header-separator { height: 20px; width: 1px; background: var(--border); margin: 0 6px; }
.icon-button, .avatar-button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--muted); }
.icon-button:hover, .avatar-button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.avatar-button { font-size: .875rem; font-weight: 550; }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 0; background: none; color: var(--accent); font-size: .875rem; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button .icon { width: 16px; height: 16px; }

main { flex: 1; display: grid; align-items: center; padding: 72px 32px; }
main:focus { outline: none; }
.hub-shell { width: min(1040px, 100%); margin: 0 auto; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.greeting { display: block; color: var(--muted); font-size: .875rem; margin-bottom: 10px; }
.intro h1 { font-size: 2rem; margin: 0 0 10px; line-height: 1.2; }
.intro p { color: var(--muted); font-size: 1rem; margin: 0; }
.intro > .text-button { margin-bottom: 1px; }
.glass { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.apps-card { padding: 28px 30px 0; }
.apps-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 24px; }
.apps-title { display: flex; align-items: center; gap: 10px; }
.apps-title > .icon { color: var(--accent); width: 18px; height: 18px; }
.apps-title h2 { margin: 0; font-size: 1.125rem; }
.count-badge { padding: 3px 7px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: .75rem; }
.add-top { width: 32px; height: 32px; }
.add-top .icon { width: 17px; height: 17px; }
.search-wrap { position: relative; width: min(370px,100%); }
.search-wrap > .icon { position: absolute; top: 14px; left: 13px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-wrap input { padding-left: 40px; padding-right: 35px; background: var(--surface-soft); border-color: var(--border); min-height: 44px; }
.search-wrap kbd { position: absolute; right: 12px; top: 12px; width: 18px; height: 21px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 4px; color: var(--subtle); font-size: .75rem; pointer-events: none; }
.search-wrap:focus-within kbd { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 10px; }
.filter { padding: 8px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: .875rem; white-space: nowrap; }
.filter:hover { background: var(--surface-soft); }
.filter[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb,var(--accent) 15%,var(--border)); }
.app-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); column-gap: 12px; row-gap: 16px; padding: 22px 0 30px; }
.app-link { min-width: 0; display: flex; align-items: center; flex-direction: column; padding: 16px 5px; border-radius: 9px; transition: background .15s; }
.app-link:hover { background: var(--surface-soft); }
.app-link img { width: 58px; height: 58px; border-radius: 13px; object-fit: cover; }
.app-name { margin-top: 14px; max-width: 100%; color: var(--text); font-size: .875rem; font-weight: 500; text-align: center; overflow-wrap: anywhere; }
.app-domain { max-width: 100%; margin-top: 6px; font-size: .75rem; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apps-footer { border-top: 1px solid var(--border); padding: 14px 0; display: flex; justify-content: flex-end; }
.apps-footer .text-button { font-size: .875rem; }
.empty-state { padding: 44px 12px; text-align: center; color: var(--muted); }
.empty-state > .icon { width: 28px; height: 28px; margin-bottom: 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 1.125rem; }
.empty-state p { font-size: 1rem; margin-bottom: 10px; }
.site-footer { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 48px; color: var(--subtle); font-size: .75rem; }
.footer-domain { position: absolute; left: 50%; transform: translateX(-50%); }
.logout-button { color: var(--muted); font-size: .875rem; }

.login-shell { width: min(365px,100%); margin: auto; }
.eyebrow { color: var(--accent); font-size: .75rem; font-weight: 550; letter-spacing: .16em; }
.login-card h1 { font-size: 1.875rem; line-height: 1.2; margin: 18px 0 12px; }
.login-card > p { color: var(--muted); font-size: 1rem; margin-bottom: 32px; }
.login-card form { display: grid; gap: 10px; }
.login-card form > label:not(:first-child) { margin-top: 13px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-toggle { position: absolute; right: 4px; top: 4px; width: 38px; height: 39px; border-color: transparent; background: transparent; }
.password-toggle .icon { width: 18px; height: 18px; }
.login-submit { width: 100%; margin-top: 16px; }
.private-caption { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--subtle); font-size: .75rem; border-top: 1px solid var(--border); padding-top: 24px; margin-top: 28px; }
.private-caption .icon { width: 14px; height: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 47px; padding: 12px 20px; font-size: .875rem; font-weight: 550; line-height: 1.3; border: 1px solid transparent; border-radius: 7px; }
.button .icon { width: 17px; height: 17px; }
.primary { color: var(--text); border: 1.5px solid transparent; background: linear-gradient(var(--surface),var(--surface)) padding-box,var(--spectrum) border-box; }
.primary:hover { background: linear-gradient(var(--accent-soft),var(--accent-soft)) padding-box,var(--spectrum) border-box; }
.secondary { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.secondary:hover { border-color: var(--accent); background: var(--surface-soft); }
.small { min-height: 38px; padding: 9px 12px; font-size: .875rem; }
.danger { color: var(--negative); border-color: color-mix(in srgb,var(--negative) 40%,var(--border)); background: var(--negative-soft); }
.danger:hover { border-color: var(--negative); }
.form-error { padding: 10px 12px; border: 1px solid color-mix(in srgb,var(--negative) 30%,var(--border)); background: var(--negative-soft); color: var(--negative); border-radius: 7px; font-size: .875rem; line-height: 1.5; margin: 7px 0; }
.loading-screen { margin: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .875rem; }
.loader { width: 21px; height: 21px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.connection-error { width: min(480px,100%); margin: auto; padding: 32px; }
.connection-error h1 { font-size: 1.5rem; }
.connection-error p { color: var(--muted); }

.modal { width: min(650px,calc(100% - 32px)); max-height: calc(100svh - 48px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 28px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 28px 90px #203d4c2b; }
.modal::backdrop { background: #20313d59; }
body:has(dialog[open]) { overflow: hidden; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.modal-header h2 { font-size: 1.5rem; margin: 0; line-height: 1.5; }
.modal-header .eyebrow { display: none; }
.modal-header .icon-button { margin: -4px -4px 0 0; border-color: transparent; }
.settings-tabs { display: flex; gap: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.settings-tabs button { position: relative; background: none; color: var(--muted); font-size: .875rem; padding: 0 0 14px; }
.settings-tabs button[aria-selected="true"] { color: var(--accent); }
.settings-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading p { color: var(--muted); font-size: .875rem; margin: 0; }
.manage-list { display: flex; flex-direction: column; max-height: 400px; overflow-y: auto; }
.manage-item { display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--border); padding: 14px 0; }
.manage-item:last-child { border: 0; }
.manage-item img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; }
.manage-name { min-width: 0; flex: 1; }
.manage-name strong { display: block; font-size: .875rem; font-weight: 500; overflow-wrap: anywhere; }
.manage-name small { display: block; margin-top: 5px; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-actions { display: flex; gap: 2px; }
.manage-actions .icon-button { width: 31px; height: 36px; border-color: transparent; }
.manage-actions .icon { width: 16px; height: 16px; }
.manage-actions .delete-button:hover { color: var(--negative); background: var(--negative-soft); border-color: transparent; }
.settings-note { color: var(--subtle); font-size: .75rem; margin: 20px 0 0; line-height: 1.5; }
.tab-content h3 { font-size: 1.125rem; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: .875rem; }
.theme-options { display: flex; gap: 15px; margin: 24px 0 30px; }
.theme-option { flex: 1; min-width: 0; background: none; padding: 0; }
.theme-swatch { display: flex; align-items: center; justify-content: center; gap: 9px; height: 86px; border: 1px solid var(--border-strong); border-radius: 7px; margin-bottom: 12px; }
.theme-option[aria-pressed="true"] .theme-swatch { outline: 2px solid var(--accent); outline-offset: 3px; }
.swatch-dark { background: #152026; }
.swatch-light { background: #f3f5f5; }
.swatch-system { background: linear-gradient(110deg,#f3f5f5 50%,#152026 50%); }
.theme-swatch i { width: 22px; height: 22px; border: 1px solid #a4b3ba; border-radius: 4px; background: #ffffff80; }
.theme-option > span:last-child { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: .875rem; color: var(--muted); }
.theme-option .icon { width: 16px; height: 16px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 24px; border-top: 1px solid var(--border); }
.switch-row strong { display: block; font-size: .875rem; font-weight: 500; color: var(--text); }
.switch-row small { display: block; font-size: .75rem; line-height: 1.5; margin-top: 7px; color: var(--muted); }
.switch-row input { appearance: none; flex-shrink: 0; min-height: 24px; width: 42px; height: 24px; padding: 0; position: relative; border-radius: 20px; background: var(--surface-soft); cursor: pointer; }
.switch-row input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch-row input:checked { background: var(--accent); border-color: var(--accent); }
.switch-row input:checked::before { background: var(--surface); transform: translateX(17px); }
.stack-form, .link-form { display: flex; flex-direction: column; gap: 9px; }
.stack-form > label, .link-form > label { margin-top: 8px; }
.stack-form .button { align-self: flex-start; margin-top: 15px; }
.stack-form > small { margin: 0; font-size: .75rem; }
.link-modal { width: min(470px,calc(100% - 32px)); }
.icon-editor { display: flex; align-items: center; gap: 18px; padding: 0 0 14px; }
.icon-editor > img { width: 64px; height: 64px; border-radius: 13px; object-fit: cover; }
.icon-editor > div { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.icon-editor small { color: var(--muted); font-size: .75rem; }
.upload-label { cursor: pointer; }
.file-input { position: absolute; width: 1px; height: 1px; min-height: 1px; opacity: 0; padding: 0; }
.icon-editor:has(.file-input:focus-visible) .upload-label { outline: 2px solid var(--accent); outline-offset: 3px; }
.icon-editor .text-button { padding: 0; font-size: .75rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.delete-modal { width: min(400px,calc(100% - 32px)); }
.delete-symbol { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 9px; color: var(--negative); background: var(--negative-soft); margin-bottom: 20px; }
.delete-modal h2 { font-size: 1.35rem; }
.delete-modal p { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); width: max-content; padding: 14px 18px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 6px 24px #203d4c12; font-size: .875rem; }
.toast .icon { color: var(--positive); width: 18px; height: 18px; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1000px) {
  .app-grid { grid-template-columns: repeat(3,minmax(0,1fr)); row-gap: 8px; }
  .app-domain { max-width: 180px; }
  .hub-shell { max-width: 780px; }
}
@media (max-width: 680px) {
  .site-header { min-height: 74px; padding: 18px 22px; }
  .brand { font-size: 1.2rem; gap: 9px; }
  .brand-mark { width: 32px; height: 32px; font-size: 1.25rem; border-radius: 9px; }
  .brand-home { font-size: .75rem; margin-left: 6px; }
  .header-actions { gap: 7px; }
  .header-date, .header-separator { display: none; }
  .header-actions .icon-button, .avatar-button { width: 33px; height: 33px; }
  main { padding: 38px 20px; }
  .intro { gap: 12px; margin-bottom: 24px; align-items: center; }
  .intro h1 { font-size: 1.75rem; margin-bottom: 9px; }
  .intro p { font-size: .875rem; }
  .intro > .text-button { font-size: 0; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
  .intro > .text-button .icon { width: 18px; height: 18px; }
  .apps-card { padding: 22px 17px 0; }
  .apps-heading { margin-bottom: 20px; }
  .search-wrap { width: 100%; }
  .filters { gap: 2px; margin-top: 18px; }
  .filter { padding: 8px 9px; }
  .app-grid { gap: 12px 3px; padding: 18px 0 26px; }
  .app-link { padding: 13px 3px; }
  .app-link img { width: 54px; height: 54px; border-radius: 12px; }
  .app-name { margin-top: 12px; }
  .app-domain { display: none; }
  .apps-footer { justify-content: center; padding: 12px 0; }
  .site-footer { padding: 18px 22px; min-height: 64px; }
  .footer-domain { display: none; }
  .login-shell { max-width: 365px; }
  .login-card h1 { font-size: 1.75rem; }
  .modal { padding: 23px 20px; }
  .modal-header h2 { font-size: 1.35rem; }
  .settings-tabs { gap: 20px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { max-width: 145px; }
  .section-heading .button { white-space: nowrap; }
  .manage-item { gap: 9px; }
  .manage-item img { width: 34px; height: 34px; }
  .manage-actions { gap: 0; }
  .manage-actions .icon-button { width: 29px; min-height: 38px; }
  .manage-name small { max-width: 115px; }
  .manage-list { max-height: 50svh; }
  .theme-options { gap: 10px; }
  .theme-swatch { gap: 5px; height: 74px; }
  .theme-swatch i { width: 18px; height: 18px; }
}
@media (max-width: 360px) {
  .section-heading { flex-direction: column; }
  .section-heading p { max-width: none; }
  .manage-item { flex-wrap: wrap; }
  .manage-actions { width: 100%; justify-content: flex-end; }
  .manage-name small { max-width: 170px; }
  .theme-option > span:last-child { gap: 4px; font-size: .8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
