
*,:after,:before{box-sizing:border-box;margin:0;padding:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}

:root {
    --dsm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --dsm-bg-glass: rgba(18, 24, 38, 0.78);
    --dsm-border-glass: rgba(255, 255, 255, 0.12);
    --dsm-primary: #0066cc;
    --dsm-primary-hover: #0052a3;
    --dsm-primary-glow: rgba(0, 102, 204, 0.35);
    --dsm-text: #f8fafc;
    --dsm-muted: #94a3b8;
    --dsm-success: #22c55e;
}

html, body, #syno-root {
    height: 100%;
    width: 100%;
    font-family: var(--dsm-font);
    color: var(--dsm-text);
    overflow: hidden;
    user-select: none;
    background: #090e17;
}

#syno-root {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Wallpaper Background */
.dsm-wallpaper {
    position: fixed;
    inset: 0;
    background: url('/assets/dsm_wallpaper.jpg') no-repeat center center / cover;
    z-index: 1;
    transition: background 0.4s ease, filter 0.4s ease;
}
.dsm-wallpaper.theme-abstract {
    background: radial-gradient(ellipse at 80% 20%, #153e68 0%, #081426 55%, #02050a 100%);
}
.dsm-wallpaper.theme-slate {
    background: linear-gradient(135deg, #0b1320 0%, #131c2c 50%, #090d15 100%);
}
.dsm-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(10, 15, 25, 0.2) 0%, rgba(5, 10, 18, 0.7) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Unified Top Taskbar */
.dsm-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.dsm-top-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dsm-top-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dsm-btn-base {
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}
.dsm-btn-base:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}
.dsm-btn-base.active {
    background: rgba(0, 102, 204, 0.35);
    border-color: rgba(0, 102, 204, 0.6);
    color: #38bdf8;
}
.dsm-icon-btn {
    width: 32px;
    padding: 0;
    position: relative;
}

.dsm-model-badge {
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: #cbd5e1;
    margin-left: 6px;
}
.dsm-dot-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dsm-success);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: dsmPulse 2s infinite;
}
@keyframes dsmPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.dsm-clock-box {
    text-align: right;
    padding-right: 8px;
    margin-right: 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.dsm-clock-time {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.dsm-clock-date {
    font-size: 10px;
    color: #94a3b8;
    line-height: 1.1;
    margin-top: 1px;
}
.dsm-badge-num {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}

/* Central Login Window - Perfectly centered in viewport */
.dsm-center {
    position: fixed;
    inset: 0;
    top: 44px;
    bottom: 32px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
}
.dsm-card {
    pointer-events: auto;
    width: 420px;
    max-width: 95vw;
    background: rgba(18, 24, 38, 0.78);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 38px 34px 28px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 1px 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dsm-card:hover {
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.85), 0 0 1px 1px rgba(255, 255, 255, 0.12);
}

.dsm-brand {
    text-align: center;
    margin-bottom: 24px;
}
.dsm-brand-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.4px;
    color: #ffffff;
}
.dsm-sub-title {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 3px;
}
.dsm-health-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-size: 11px;
    font-weight: 500;
    color: #4ade80;
    margin-top: 10px;
}

.dsm-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #fca5a5;
    margin-bottom: 18px;
    display: none;
    line-height: 1.4;
}

.dsm-field {
    margin-bottom: 16px;
}
.dsm-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 6px;
}
.dsm-input-box {
    position: relative;
    display: flex;
    align-items: center;
}
.dsm-input-icon {
    position: absolute;
    left: 12px;
    color: #64748b;
    pointer-events: none;
    display: flex;
    align-items: center;
}
.dsm-input {
    width: 100%;
    height: 42px;
    padding: 0 40px 0 38px;
    background: rgba(10, 15, 26, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s ease;
}
.dsm-input:focus {
    border-color: #0066cc;
    background: rgba(10, 15, 26, 0.95);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.25);
}
.dsm-input::placeholder {
    color: #64748b;
}

.dsm-eye-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}
.dsm-eye-btn:hover {
    color: #e2e8f0;
}
.dsm-caps-tip {
    display: none;
    position: absolute;
    top: -26px;
    right: 0;
    background: #d97706;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
}
.dsm-caps-tip:after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 12px;
    border-width: 4px 4px 0;
    border-style: solid;
    border-color: #d97706 transparent;
}

.dsm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 20px;
}
.dsm-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #cbd5e1;
    user-select: none;
}
.dsm-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    margin: 0;
}
.dsm-checkbox:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.12);
}
.dsm-checkbox:checked {
    background: #0066cc;
    border-color: #0066cc;
}
.dsm-checkbox:checked:after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.dsm-link {
    color: #38bdf8;
    text-decoration: none;
    cursor: pointer;
    font-weight: 400;
    transition: color 0.15s;
}
.dsm-link:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

/* Sign In Action Button */
.dsm-btn {
    width: 100%;
    height: 42px;
    background: #0066cc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0, 102, 204, 0.35);
    outline: none;
    font-family: inherit;
}
.dsm-btn:hover {
    background: #0052a3;
    box-shadow: 0 6px 18px rgba(0, 102, 204, 0.45);
}
.dsm-btn:active {
    background: #004080;
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.25);
}
.dsm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.dsm-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dsmSpin 0.75s linear infinite;
}
@keyframes dsmSpin {
    to { transform: rotate(360deg); }
}

.dsm-card-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Minimal Bottom Desktop Status Bar */
.dsm-bottom-footer {
    position: fixed;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: rgba(148, 163, 184, 0.75);
    z-index: 40;
    pointer-events: none;
    letter-spacing: 0.2px;
}
.dsm-bottom-footer span {
    pointer-events: auto;
}

/* Flyout Menus & Drawers */
.dsm-flyout {
    position: fixed;
    top: 56px;
    background: rgba(18, 26, 40, 0.94);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.75), 0 0 1px 1px rgba(255, 255, 255, 0.08);
    z-index: 150;
    display: none;
    animation: dsmFlyIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dsmFlyIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* App Drawer */
.dsm-menu-drawer {
    left: 16px;
    width: 380px;
    padding: 18px;
}
.dsm-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.dsm-drawer-title {
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}
.dsm-app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.dsm-app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.dsm-app-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}
.dsm-app-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.dsm-app-label {
    font-size: 11px;
    color: #e2e8f0;
    text-align: center;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Notifications Drawer */
.dsm-notif-drawer {
    right: 70px;
    width: 360px;
    padding: 16px;
}
.dsm-notif-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dsm-notif-card {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
}
.dsm-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dsm-notif-title {
    font-weight: 600;
    color: #f1f5f9;
}
.dsm-notif-desc {
    color: #94a3b8;
    margin-top: 2px;
    line-height: 1.3;
}
.dsm-notif-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}

/* Resource Monitor Panel */
.dsm-res-panel {
    right: 20px;
    width: 340px;
    padding: 20px;
}
.dsm-res-head {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dsm-res-metric {
    margin-bottom: 14px;
}
.dsm-res-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--dsm-muted);
    margin-bottom: 6px;
}
.dsm-res-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
.dsm-res-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modals with Native <dialog> */
dialog.dsm-dialog {
    border: none;
    background: transparent;
    padding: 0;
    color: inherit;
    max-width: 92vw;
    margin: auto;
}
dialog.dsm-dialog::backdrop {
    background: rgba(3, 7, 18, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.dsm-modal-box {
    width: 400px;
    background: rgba(18, 26, 40, 0.96);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.85);
}
.dsm-modal-head {
    height: 44px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
}
.dsm-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.dsm-modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}
.dsm-modal-body {
    padding: 18px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #cbd5e1;
}
.dsm-modal-foot {
    height: 50px;
    padding: 0 16px;
    background: rgba(10, 15, 26, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.dsm-dialog-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.dsm-dialog-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}
.dsm-dialog-primary {
    background: #0066cc;
    border-color: #0066cc;
}
.dsm-dialog-primary:hover {
    background: #0052a3;
}

/* Toast Notifications */
.dsm-toast-container {
    position: fixed;
    top: 54px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.dsm-toast {
    pointer-events: auto;
    width: 320px;
    background: rgba(18, 26, 40, 0.94);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: dsmToastIn 0.25s ease;
}
@keyframes dsmToastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
.dsm-toast.hiding {
    animation: dsmToastOut 0.25s ease forwards;
}
@keyframes dsmToastOut {
    to { opacity: 0; transform: translateX(20px); }
}
.dsm-toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}
.dsm-toast-content {
    flex: 1;
}
.dsm-toast-title {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
}
.dsm-toast-desc {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.dsm-shake {
    animation: dsmShakeAnim 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes dsmShakeAnim {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
